File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,21 @@ void mqttmsg_callback(MongooseString topic, MongooseString payload) {
195195 }
196196 }
197197
198+ else if (topic_string == mqtt_topic + " /config/set" ) {
199+ const size_t capacity = JSON_OBJECT_SIZE (128 ) + 1024 ;
200+ DynamicJsonDocument doc (capacity);
201+ DeserializationError error = deserializeJson (doc, payload_str);
202+ if (!error)
203+ {
204+ bool config_modified = config_deserialize (doc);
205+ if (config_modified)
206+ {
207+ config_commit (false );
208+ DBUGLN (" Config updated" );
209+ }
210+ }
211+ }
212+
198213 // Restart
199214 else if (topic_string == mqtt_topic + " /restart" ) {
200215 mqtt_restart_device (payload_str);
@@ -386,6 +401,10 @@ mqtt_connect()
386401 mqttclient.subscribe (mqtt_sub_topic);
387402 yield ();
388403
404+ mqtt_sub_topic = mqtt_topic + " /config/set" ;
405+ mqttclient.subscribe (mqtt_sub_topic);
406+ yield ();
407+
389408 // ask for a system restart
390409 mqtt_sub_topic = mqtt_topic + " /restart" ;
391410 mqttclient.subscribe (mqtt_sub_topic);
You can’t perform that action at this time.
0 commit comments