Create in use binary sensor for RN8209 Current sensor (#1474)
This commit is contained in:
1 parent
7510e7a273
commit
032a82e5e2
2 files changed
+3
-1
No files matched your search
@@ -779,7 +779,7 @@ void pubMqttDiscovery() {
|
|||||||
{"sensor", "volt", "RN8209", "voltage", jsonVolt, "", "", "V"},
|
{"sensor", "volt", "RN8209", "voltage", jsonVolt, "", "", "V"},
|
||||||
{"sensor", "current", "RN8209", "current", jsonCurrent, "", "", "A"},
|
{"sensor", "current", "RN8209", "current", jsonCurrent, "", "", "A"},
|
||||||
{"sensor", "power", "RN8209", "power", jsonPower, "", "", "W"},
|
{"sensor", "power", "RN8209", "power", jsonPower, "", "", "W"},
|
||||||
{"binary_sensor", "inUse", "RN8209", "power", jsonPower, "", "", ""}
|
{"binary_sensor", "inUse", "RN8209", "power", jsonInuse, "", "", ""}
|
||||||
//component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement
|
//component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ void announceDeviceTrigger(bool use_gateway_info,
|
|||||||
# define jsonTime "{{ value_json.time }}"
|
# define jsonTime "{{ value_json.time }}"
|
||||||
# define jsonCount "{{ value_json.count }}"
|
# define jsonCount "{{ value_json.count }}"
|
||||||
# define jsonAlarm "{{ value_json.alarm }}"
|
# define jsonAlarm "{{ value_json.alarm }}"
|
||||||
|
# define jsonInuse "{{ value_json.power | float > 0 }}"
|
||||||
#else // Home assistant autodiscovery value key definition
|
#else // Home assistant autodiscovery value key definition
|
||||||
# define jsonBatt "{{ value_json.batt | is_defined }}"
|
# define jsonBatt "{{ value_json.batt | is_defined }}"
|
||||||
# define jsonLux "{{ value_json.lux | is_defined }}"
|
# define jsonLux "{{ value_json.lux | is_defined }}"
|
||||||
@@ -201,6 +202,7 @@ void announceDeviceTrigger(bool use_gateway_info,
|
|||||||
# define jsonTime "{{ value_json.time | is_defined }}"
|
# define jsonTime "{{ value_json.time | is_defined }}"
|
||||||
# define jsonCount "{{ value_json.count | is_defined }}"
|
# define jsonCount "{{ value_json.count | is_defined }}"
|
||||||
# define jsonAlarm "{{ value_json.alarm | is_defined }}"
|
# define jsonAlarm "{{ value_json.alarm | is_defined }}"
|
||||||
|
# define jsonInuse "{{ value_json.power | is_defined | float > 0 }}"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define stateClassNone ""
|
#define stateClassNone ""
|
||||||
|
|||||||
Reference in new issue
Block a user