don't create HA sensor for wifi rssi if only ethernet

This commit is contained in:
proddy
2021-06-07 21:15:46 +02:00
parent 66f14fff82
commit feed65bea6

View File

@@ -702,8 +702,8 @@ 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,
@@ -711,6 +711,8 @@ void Mqtt::ha_status() {
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,