[BT] InUse updates for DT24 (#1553)
This commit is contained in:
1 parent
7c4c90d777
commit
d2470288e5
3 files changed
+6
-3
No files matched your search
+3
-2
@@ -501,7 +501,7 @@ void strupp(char* beg) {
|
||||
|
||||
# ifdef ZmqttDiscovery
|
||||
void DT24Discovery(const char* mac, const char* sensorModel_id) {
|
||||
# define DT24parametersCount 6
|
||||
# define DT24parametersCount 7
|
||||
Log.trace(F("DT24Discovery" CR));
|
||||
const char* DT24sensor[DT24parametersCount][9] = {
|
||||
{"sensor", "volt", mac, "voltage", jsonVolt, "", "", "V", stateClassMeasurement},
|
||||
@@ -509,7 +509,8 @@ void DT24Discovery(const char* mac, const char* sensorModel_id) {
|
||||
{"sensor", "watt", mac, "power", jsonPower, "", "", "W", stateClassMeasurement},
|
||||
{"sensor", "watt-hour", mac, "power", jsonEnergy, "", "", "kWh", stateClassMeasurement},
|
||||
{"sensor", "price", mac, "", jsonMsg, "", "", "", stateClassNone},
|
||||
{"sensor", "temp", mac, "temperature", jsonTempc, "", "", "°C", stateClassMeasurement}
|
||||
{"sensor", "temp", mac, "temperature", jsonTempc, "", "", "°C", stateClassMeasurement},
|
||||
{"binary_sensor", "inUse", mac, "power", jsonInuse, "", "", ""}
|
||||
//component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement
|
||||
};
|
||||
|
||||
|
||||
@@ -897,7 +897,7 @@ void pubMqttDiscovery() {
|
||||
{"sensor", "volt", "RN8209", "voltage", jsonVolt, "", "", "V"},
|
||||
{"sensor", "current", "RN8209", "current", jsonCurrent, "", "", "A"},
|
||||
{"sensor", "power", "RN8209", "power", jsonPower, "", "", "W"},
|
||||
{"binary_sensor", "inUse", "RN8209", "power", jsonInuse, "", "", ""}
|
||||
{"binary_sensor", "inUse", "RN8209", "power", jsonInuseRN8209, "", "", ""}
|
||||
//component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement
|
||||
};
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@ void announceDeviceTrigger(bool use_gateway_info,
|
||||
# define jsonCount "{{ value_json.count }}"
|
||||
# define jsonAlarm "{{ value_json.alarm }}"
|
||||
# define jsonInuse "{{ value_json.power | float > 0 }}"
|
||||
# define jsonInuseRN8209 "{{ value_json.power | float > 0.02 }}"
|
||||
# define jsonVoltBM2 "{{% if value_json.model_id == \"BM2\" -%} {{value_json.volt}} {%- endif %}}"
|
||||
#else // Home assistant autodiscovery value key definition
|
||||
# define jsonBatt "{{ value_json.batt | is_defined }}"
|
||||
@@ -208,6 +209,7 @@ void announceDeviceTrigger(bool use_gateway_info,
|
||||
# define jsonCount "{{ value_json.count | is_defined }}"
|
||||
# define jsonAlarm "{{ value_json.alarm | is_defined }}"
|
||||
# define jsonInuse "{{ value_json.power | is_defined | float > 0 }}"
|
||||
# define jsonInuseRN8209 "{{ value_json.power | is_defined | float > 0.02 }}"
|
||||
# define jsonVoltBM2 "{{% if value_json.model_id == \"BM2\" and value_json.volt is defined -%} {{value_json.volt}} {%- endif %}}"
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user