[BT Discovery] Improve BM2 discovery (#1510)

to filter advertisement coming from iBeacon packets that contains volt
as the voltage is not properly advertised throught the iBeacon packet and render a wrong voltage
This commit is contained in:
Florian authored and GitHub committed 2023-03-07 19:35:57 -06:00
1 parent a9f8f803e5
commit 8f47a80303
2 files changed
+4 -2

No files matched your search

+2
View File
@@ -167,6 +167,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 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 }}"
# define jsonLux "{{ value_json.lux | is_defined }}"
@@ -203,6 +204,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 jsonVoltBM2 "{{% if value_json.model_id == \"BM2\" and value_json.volt is defined -%} {{value_json.volt}} {%- endif %}}"
#endif
#define stateClassNone ""