andrew-codechimp / HA-Battery-Notes

A Home Assistant integration to provide battery notes of devices
MIT License
554 stars 97 forks source link

Xiaomi lywsd02 and Xiaomi lywsdcgq not detected by the integration when added via ESPhome #765

Closed KixMan28 closed 9 months ago

KixMan28 commented 9 months ago

System Health details

System Information

version core-2024.1.6
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.6
os_name Linux
os_version 6.1.63-haos-raspi
arch aarch64
timezone Europe/Budapest
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.34.0 Stage | running Available Repositories | 1385 Downloaded Repositories | 30
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | February 16, 2024 at 01:00 relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | true google_enabled | false remote_server | eu-central-1-4.ui.nabu.casa certificate_status | ready instance_id | de2fba239ca9414e93a09258db315b04 can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 11.4 -- | -- update_channel | stable supervisor_version | supervisor-2023.12.1 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 219.4 GB disk_used | 22.9 GB healthy | true supported | true board | rpi4-64 supervisor_api | ok version_api | ok installed_addons | File editor (5.7.0), Mosquitto broker (6.4.0), Advanced SSH & Web Terminal (17.0.4), Samba share (12.2.0), MariaDB (2.6.1), ESPHome (2023.12.8), Samba Backup (5.2.0), ArgonOne Active Cooling (30a), VLC (0.3.0), Tailscale (0.14.0), Studio Code Server (5.15.0), openWakeWord (1.8.2), Zigbee2mqtt Edge (edge), CEC Scanner (3.0)
Dashboards dashboards | 4 -- | -- resources | 16 views | 19 mode | storage
Recorder oldest_recorder_run | February 1, 2024 at 22:01 -- | -- current_recorder_run | February 2, 2024 at 01:42 estimated_db_size | 1088.14 MiB database_engine | mysql database_version | 10.6.12
Sonoff version | 3.5.4 (a4a8c5f) -- | -- cloud_online | 1 / 4 local_online | 0 / 0

Checklist

Describe the issue

I have added my Xiaomi lywsd02 and Xiaomi lywsdcgq temperature and humidity sensors to HA via ESPhome BLE https://esphome.io/components/sensor/xiaomi_ble.html?highlight=xiaomi_lywsd02

These devices are not picked up by your integration and I cannot add them manually either, although these devices are mentioned in the known devices library.

Reproduction steps

  1. I try to add manually my device, but it won't show it in the available devices list
  2. ...

Debug logs

The debug logs are to long. I have attached the logfile to the diagnostics dump

Diagnostics dump

home-assistant_2024-02-02T08-57-35.431Z.log

andrew-codechimp commented 9 months ago

I've not got any experience of BLE via ESPHome but as long as it's showing as a device but doesn't have a battery level if you add the following to your configuration.yaml you will see all devices and should be able to add it manually.

battery_notes:
  show_all_devices: true
KixMan28 commented 9 months ago

These are my current settings in configuration.yaml:

battery_notes:
  enable_autodiscovery: true
  show_all_devices: true
  enable_replaced: true
  default_battery_low_threshold: 10
  battery_increase_threshold: 60
  hide_battery: true
  round_battery: false

So based on this I should see them, but when I try to add them, they don't appear in the list of devices.

See attached the entities which don't appear in the device list. Temp hub 1

andrew-codechimp commented 9 months ago

Looking at that I think you have 1 device with all the sensors in it. Since battery notes associates a battery type with a device this won't work with the BLE devices. I've seen something similar with an EcoWitt where the "hub" is the device.
Not much I can do about these really. I'm guessing other people are using a different way to get the BLE devices into HA where each is recognised as a separate device.

KixMan28 commented 9 months ago

@andrew-codechimp Thank you, I will check it how can I add them differently.