mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
don't create HA sensor for wifi rssi if only ethernet
This commit is contained in:
20
src/mqtt.cpp
20
src/mqtt.cpp
@@ -702,15 +702,17 @@ void Mqtt::ha_status() {
|
|||||||
snprintf_P(topic, sizeof(topic), PSTR("sensor/%s/system/config"), mqtt_base_.c_str());
|
snprintf_P(topic, sizeof(topic), PSTR("sensor/%s/system/config"), mqtt_base_.c_str());
|
||||||
Mqtt::publish_ha(topic, doc.as<JsonObject>()); // publish the config payload with retain flag
|
Mqtt::publish_ha(topic, doc.as<JsonObject>()); // publish the config payload with retain flag
|
||||||
|
|
||||||
// create the sensors
|
// create the sensors - must match the MQTT payload keys
|
||||||
// must match the MQTT payload keys
|
if (!EMSESP::system_.ethernet_connected()) {
|
||||||
publish_mqtt_ha_sensor(DeviceValueType::INT, DeviceValueTAG::TAG_HEARTBEAT, F("WiFi RSSI"), EMSdevice::DeviceType::SYSTEM, F("rssi"), DeviceValueUOM::DBM);
|
publish_mqtt_ha_sensor(DeviceValueType::INT, DeviceValueTAG::TAG_HEARTBEAT, F("WiFi RSSI"), EMSdevice::DeviceType::SYSTEM, F("rssi"), DeviceValueUOM::DBM);
|
||||||
publish_mqtt_ha_sensor(DeviceValueType::INT,
|
publish_mqtt_ha_sensor(DeviceValueType::INT,
|
||||||
DeviceValueTAG::TAG_HEARTBEAT,
|
DeviceValueTAG::TAG_HEARTBEAT,
|
||||||
F("WiFi strength"),
|
F("WiFi strength"),
|
||||||
EMSdevice::DeviceType::SYSTEM,
|
EMSdevice::DeviceType::SYSTEM,
|
||||||
F("wifistrength"),
|
F("wifistrength"),
|
||||||
DeviceValueUOM::PERCENT);
|
DeviceValueUOM::PERCENT);
|
||||||
|
}
|
||||||
|
|
||||||
publish_mqtt_ha_sensor(DeviceValueType::INT, DeviceValueTAG::TAG_HEARTBEAT, F("Uptime"), EMSdevice::DeviceType::SYSTEM, F("uptime"));
|
publish_mqtt_ha_sensor(DeviceValueType::INT, DeviceValueTAG::TAG_HEARTBEAT, F("Uptime"), EMSdevice::DeviceType::SYSTEM, F("uptime"));
|
||||||
publish_mqtt_ha_sensor(DeviceValueType::INT,
|
publish_mqtt_ha_sensor(DeviceValueType::INT,
|
||||||
DeviceValueTAG::TAG_HEARTBEAT,
|
DeviceValueTAG::TAG_HEARTBEAT,
|
||||||
|
|||||||
Reference in New Issue
Block a user