platform: arduino: mqtt: add support for loadConfig command
This commit is contained in:
parent
9b1600f00b
commit
85b42469f9
@ -234,14 +234,13 @@ MQTTTelemetry::loopOnline()
|
|||||||
m_json["os_version"] = ESP.getSdkVersion();
|
m_json["os_version"] = ESP.getSdkVersion();
|
||||||
m_json["localip"] = WiFi.localIP().toString();
|
m_json["localip"] = WiFi.localIP().toString();
|
||||||
m_json["pixelCount"] = Static<ConfigService>::instance()->coordMap()->physicalPixelCount();
|
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["RSSI"] = WiFi.RSSI();
|
||||||
m_json["free_ram"] = ESP.getFreeHeap();
|
m_json["free_ram"] = ESP.getFreeHeap();
|
||||||
m_json["fps"] = FastLED.getFPS();
|
m_json["fps"] = FastLED.getFPS();
|
||||||
String availTopic = m_rootTopic + "/available";
|
String availTopic = m_rootTopic + "/available";
|
||||||
publishDoc(Lightswitch.heartbeatTopic().c_str());
|
publishDoc(Lightswitch.heartbeatTopic().c_str());
|
||||||
m_mqtt.publish(Device.availabilityTopic.c_str(), "online");
|
m_mqtt.publish(Device.availabilityTopic.c_str(), "online");
|
||||||
//Log.trace("Heartbeat: %s", buf);
|
|
||||||
|
|
||||||
String fpsCounter = String(FastLED.getFPS());
|
String fpsCounter = String(FastLED.getFPS());
|
||||||
m_mqtt.publish(FPSSensor.statTopic().c_str(), fpsCounter.c_str());
|
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>()});
|
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")) {
|
if (m_json.containsKey("save")) {
|
||||||
setEvent(InputEvent{InputEvent::SaveConfigurationRequest});
|
setEvent(InputEvent{InputEvent::SaveConfigurationRequest});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user