Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create in use binary sensor for RN8209 Current sensor #1474

Merged
merged 1 commit into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main/ZmqttDiscovery.ino
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,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", jsonPower, "", "", ""}
{"binary_sensor", "inUse", "RN8209", "power", jsonInuse, "", "", ""}
//component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement
};

Expand Down
2 changes: 2 additions & 0 deletions main/config_mqttDiscovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ void announceDeviceTrigger(bool use_gateway_info,
# define jsonTime "{{ value_json.time }}"
# define jsonCount "{{ value_json.count }}"
# define jsonAlarm "{{ value_json.alarm }}"
# define jsonInuse "{{ value_json.power | float > 0 }}"
#else // Home assistant autodiscovery value key definition
# define jsonBatt "{{ value_json.batt | is_defined }}"
# define jsonLux "{{ value_json.lux | is_defined }}"
Expand Down Expand Up @@ -201,6 +202,7 @@ void announceDeviceTrigger(bool use_gateway_info,
# define jsonTime "{{ value_json.time | is_defined }}"
# define jsonCount "{{ value_json.count | is_defined }}"
# define jsonAlarm "{{ value_json.alarm | is_defined }}"
# define jsonInuse "{{ value_json.power | is_defined | float > 0 }}"
#endif

#define stateClassNone ""
Expand Down