From e1fef642cd13860fb4204023b8e304a825a50ffe Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 21 Mar 2023 13:07:09 -0500 Subject: [PATCH] [BM2] Fix discovery relying on MODEL_ID (#1560) To don't take into account the iBeacons messages change the condition to is not defined --- main/config_mqttDiscovery.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/config_mqttDiscovery.h b/main/config_mqttDiscovery.h index 972a7ce962..f77cdf9c27 100644 --- a/main/config_mqttDiscovery.h +++ b/main/config_mqttDiscovery.h @@ -172,7 +172,7 @@ void announceDeviceTrigger(bool use_gateway_info, # 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 %}}" +# define jsonVoltBM2 "{% if value_json.uuid is not defined -%} {{value_json.volt}} {%- endif %}" #else // Home assistant autodiscovery value key definition # define jsonBatt "{{ value_json.batt | is_defined }}" # define jsonLux "{{ value_json.lux | is_defined }}" @@ -210,7 +210,7 @@ void announceDeviceTrigger(bool use_gateway_info, # 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 %}}" +# define jsonVoltBM2 "{% if value_json.uuid is not defined and value_json.volt is defined -%} {{value_json.volt}} {%- endif %}" #endif #define stateClassNone ""