diff --git a/lighthub/item.cpp b/lighthub/item.cpp index ac14fb2..b5e763b 100644 --- a/lighthub/item.cpp +++ b/lighthub/item.cpp @@ -198,7 +198,7 @@ boolean Item::getEnableCMD(int delta) { #define MAXCTRLPAR 3 -int Item::Ctrl(char * payload, boolean send){ +int Item::Ctrl(char * payload, boolean send, char * subItem){ if (!payload) return 0; // debugSerial< "); } debugSerial<name,sizeof(topic)); strncat(topic,"/",sizeof(topic)); @@ -450,7 +448,7 @@ void onMQTTConnect(){ if (format[0]) { //strncpy_P(topic, outprefix, sizeof(topic)); - setTopic(topic,sizeof(topic),T_OUT); + setTopic(topic,sizeof(topic),T_DEV); strncat(topic,item->name,sizeof(topic)); strncat(topic,"/",sizeof(topic)); @@ -460,7 +458,7 @@ void onMQTTConnect(){ item = item->next; } //if //strncpy_P(topic, outprefix, sizeof(topic)); - setTopic(topic,sizeof(topic),T_OUT); + setTopic(topic,sizeof(topic),T_DEV); strncat_P(topic, nodes_P, sizeof(topic)); mqttClient.publish(topic,buf,true); } @@ -519,7 +517,7 @@ void ip_ready_config_loaded_connecting_to_broker() { strncpy_P(willMessage,disconnected_P,sizeof(willMessage)); // strncpy_P(willTopic, outprefix, sizeof(willTopic)); - setTopic(willTopic,sizeof(willTopic),T_OUT); + setTopic(willTopic,sizeof(willTopic),T_DEV); strncat_P(willTopic, state_P, sizeof(willTopic)); diff --git a/lighthub/options.h b/lighthub/options.h index 2ac7360..ff6839a 100644 --- a/lighthub/options.h +++ b/lighthub/options.h @@ -82,14 +82,17 @@ #endif */ +//Default output topic #ifndef OUTTOPIC #define OUTTOPIC "s_out" #endif +//Topic to receive CLI commands #ifndef CMDTOPIC -#define CMDTOPIC "command" +#define CMDTOPIC "$command" #endif +//Default broadcast topic #ifndef INTOPIC #define INTOPIC "in" #endif diff --git a/lighthub/utils.cpp b/lighthub/utils.cpp index 7844dd0..84bb0d2 100644 --- a/lighthub/utils.cpp +++ b/lighthub/utils.cpp @@ -369,7 +369,7 @@ void printIPAddress(IPAddress ipAddress) { } -char* setTopic(char* buf, int8_t buflen, topicType tt, char* suffix=NULL) +char* setTopic(char* buf, int8_t buflen, topicType tt, char* suffix) { aJsonObject *_root = NULL; aJsonObject *_l2 = NULL;