ble_monitor
ble_monitor copied to clipboard
[Bug]: Naming scheme
What happened?
All the integrations within HA follow a standard scheme without adding the protocol information in front. Which is not the case with ble_monitor. All the enitiy_ids get a ble suffix in front. Of course entity id's can be renamed individually but... Although this will be a breaking change - ibelieve it will affect only new users of the integration. I might be wrong
Sensor type
All of them
Relevant log output
Not applicable
Changing the naming scheme will definitely impact the BLE Gateway integration, which enables ESP32 devices to forward BLE messages for BLE Monitor to parse. https://github.com/myhomeiot/esphome-components#ble-gateway.
The impact is with the template sensor, which searches for any device tracker or sensor that starts with ble_. Full code below:
template:
- binary_sensor:
- name: BLE Gateway icon: mdi:bluetooth state: "{{ is_state('input_boolean.settings_ble_gateway', 'on') }}" attributes: devices: "{{ states | selectattr('entity_id', 'search', '^(device_tracker|sensor).ble_') | selectattr('attributes.mac_address', 'defined') | map(attribute='attributes.mac_address') | unique | sort | join('') | replace(':', '') ~ (states('input_text.settings_ble_gateway_add_device') | replace(':', '') | trim) if is_state('binary_sensor.ble_gateway', 'on') }}"
Might be wrong but this can be implemented via the attributes for the entity
I don’t think it will be a breaking change for BLE monitor, as the unique_id remains the same and I don’t think HA will change existing entities. But I will check that. But we have to think about other side effects, like being raised by @sg1888 . I do not (yet) understand with which attribute we can do the filtering.
Since Ble Monitor has an integration ID (ble_monitor), any referencing integration may be able to enumerate the entities. @petro referenced some code in the HA forums that may be applicable: https://community.home-assistant.io/t/how-to-enumerate-entities-belonging-to-an-integration/343748/6.
This would probably necessitate some code changes to the BLE Gateway by @myhomeiot. Of course, it might end up breaking other things as well :/.