platform: arduino: mqtt: add support for loadConfig command
This commit is contained in:
		| @@ -234,14 +234,13 @@ MQTTTelemetry::loopOnline() | ||||
|     m_json["os_version"] = ESP.getSdkVersion(); | ||||
|     m_json["localip"] = WiFi.localIP().toString(); | ||||
|     m_json["pixelCount"] = Static<ConfigService>::instance()->coordMap()->physicalPixelCount(); | ||||
|     //m_json["startPixel"] = Static<ConfigService>::instance()->coordMap()->startPixel; | ||||
|     m_json["loadedProfile"] = Static<ConfigService>::instance()->loadedProfile(); | ||||
|     m_json["RSSI"] = WiFi.RSSI(); | ||||
|     m_json["free_ram"] = ESP.getFreeHeap(); | ||||
|     m_json["fps"] = FastLED.getFPS(); | ||||
|     String availTopic = m_rootTopic + "/available"; | ||||
|     publishDoc(Lightswitch.heartbeatTopic().c_str()); | ||||
|     m_mqtt.publish(Device.availabilityTopic.c_str(), "online"); | ||||
|     //Log.trace("Heartbeat: %s", buf); | ||||
|  | ||||
|     String fpsCounter = String(FastLED.getFPS()); | ||||
|     m_mqtt.publish(FPSSensor.statTopic().c_str(), fpsCounter.c_str()); | ||||
| @@ -302,6 +301,11 @@ MQTTTelemetry::callback(char* topic, const char* payload) | ||||
|         setEvent(InputEvent{InputEvent::SetDisplayOffset, m_json["startPixel"].as<int>()}); | ||||
|       } | ||||
|  | ||||
|       if (m_json.containsKey("loadConfig")) { | ||||
|         Log.notice("Loading new config"); | ||||
|         setEvent(InputEvent{InputEvent::LoadConfigurationByName, m_json["loadConfig"].as<const char*>()}); | ||||
|       } | ||||
|  | ||||
|       if (m_json.containsKey("save")) { | ||||
|         setEvent(InputEvent{InputEvent::SaveConfigurationRequest}); | ||||
|       } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user