KNXOutputLightDimmer::KNXOutputLightDimmer(Params &p):
    OutputLightDimmer(p)
{
    useRealState = true;

    // Define IO documentation
    ioDoc->friendlyNameSet("KNXOutputLightDimmer");
    ioDoc->descriptionSet(_("Light dimmer with KNX and eibnetmux"));
    ioDoc->linkAdd("eibnetmux", _("http://eibnetmux.sourceforge.net"));
    ioDoc->paramAdd("knx_group", _("KNX Group address, Ex: x/y/z"), IODoc::TYPE_STRING, true);

    std::string knx_group = get_param("knx_group");

    //KNXCtrl::Instance(get_param("host"))->readValue(knx_group, KNXValue::EIS_Switch_OnOff);

    KNXCtrl::Instance(get_param("host"))->valueChanged.connect([=](const std::string group_addr, const KNXValue &v)
    {
        if (group_addr != get_param("knx_group")) return;
        KNXValue val = v;
        val.setEis(KNXValue::EIS_Dim_UpDown);
        value = val.toInt();
        EmitSignalIO();
        emitChange();
    });

    cInfoDom("input") << "knx_group: " << knx_group;
}
bool KNXInputSwitch::readValue()
{
    string knx_group = get_param("knx_group");

    KNXValue val = KNXCtrl::Instance(get_param("host"))->getValue(knx_group);

    return val.toBool();
}
bool KNXInputSwitchTriple::readValue()
{
    KNXValue val = KNXCtrl::Instance(get_param("host"))->getValue(knxBase->getReadGroupAddr());

    return val.toBool();
}