diff --git a/lighthub/abstractch.cpp b/lighthub/abstractch.cpp index 57e1ade..fdccd18 100644 --- a/lighthub/abstractch.cpp +++ b/lighthub/abstractch.cpp @@ -31,7 +31,7 @@ int abstractCh::publishTopic(const char* topic, const char * value, const char* { strncpy(addrstr,topic,sizeof(addrstr)); if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,topic); - strncat(addrstr,subtopic,sizeof(addrstr)); + strncat(addrstr,subtopic,sizeof(addrstr)-1); if (mqttClient.connected() && lanStatus == OPERATION && !ethernetIdleCount) { mqttClient.publish(addrstr, value, true); diff --git a/lighthub/item.cpp b/lighthub/item.cpp index 8e2e9f5..291e4bb 100644 --- a/lighthub/item.cpp +++ b/lighthub/item.cpp @@ -1074,9 +1074,9 @@ switch (itemType) { pinMode(iaddr, OUTPUT); if (inverse) - digitalWrite(iaddr, k = ((icmd == CMD_ON) ? LOW : HIGH)); + digitalWrite(iaddr, k = ((icmd == CMD_ON || icmd == CMD_AUTO) ? LOW : HIGH)); else - digitalWrite(iaddr, k = ((icmd == CMD_ON) ? HIGH : LOW)); + digitalWrite(iaddr, k = ((icmd == CMD_ON || icmd == CMD_AUTO) ? HIGH : LOW)); debugSerial<itemVal->valueint); + Float(item->itemVal->valuefloat); //debugSerial<setFloatVal(param.asfloat); - //case ST_FLOAT_CELSIUS: + // break; case ST_INT32: diff --git a/lighthub/main.cpp b/lighthub/main.cpp index 4cdbd08..9ad197e 100644 --- a/lighthub/main.cpp +++ b/lighthub/main.cpp @@ -257,6 +257,8 @@ int httpHandler(Client& client, String request, long contentLength, bool authori itemCmd ic; ic.loadItem(&item,SEND_COMMAND|SEND_PARAMETERS); + if (item.itemType == CH_GROUP) + {if (item.isActive()) item.setCmd(CMD_ON); else item.setCmd(CMD_OFF);} char buf[32]; response=ic.toString(buf, sizeof(buf)); @@ -270,7 +272,7 @@ int httpHandler(Client& client, String request, long contentLength, bool authori request+=body; debugSerial<