Hello,
I have a LYWSD03MMC which is successfuly working with the hacs component. In addition I also have a LYWSDCGQ. Due to the hacs mitemp_bt component, I had to remove the “mac:xxx:xxx…” line and now I don’t know how to connect this sensor to my home assistant.
Any idea ?
Nothing needs to be configured (additional) for LYWSDCGQ.
If you have custom.mitemp_bt installed and the signal from the sensor reaches your host, then the corresponding entities will appear automatically.
i have been using your addon @Magalex for a two months now. I believe, that is the best option to make my three: LYWSD03MMC work under HA. I want to thank you for it very much.
I am reading all this statements above and starting thinking, that my configuration is wrong. Why? Because:
previously to make it work i needed to give new and new Binkeys after few HA restart.
Since last HA update those three LYWSD03MMC just don’t want to connect back. I keep generating bindkeys - no luck. I even capitalize all letters in it - still nothing.
Can you please (or anybody) tell me how to find the error?
EDIT: Obviously, as you wrote in point 6 in your installation manual, I left the sensors paired with my mobile.
EDIT2: Versions: Home Assistant 0.109.4 and BLE monitor 0.6.8.
Keys can fly off only if the sensors have passed the pairing procedure. In any case, I am not aware of other reasons. Even changing the battery does not reset the keys.
First, check the HA log for errors and other suspicious messages.
Secondly, enable debug mode as described in our FAQ.
Tell me more about the host configuration - is this a standard Hassio image or is it installed on a generic Linux host (Python venv)?
How did you determine the need to generate new keys?
Make sure that no other applications (including MiHome) are connected to the sensors because during the active connection they stop broadcasting (this can be determined by the active Bluetooth icon on the sensor display).
Thank you for so quick reply. I will try to be as much precise as possible. Please bear in mind, that I quite new HA user, so some answers can be a little bit funny.
You mean log from: Supervisor > System > Supervisor, Core, Host, DNS, … ?
Done that. I restarted HA after that, and found nothing suspicious in above logs. Maybe one thing - the time is 2hrs in the past. I will be happy to paste it here, but can you please tell me which one is that?
I am getting new keys by using this modified app: https://www.kapiba.ru/2017/11/mi-home.html. Basically I installed the app, created folders, pair the sensors and open the file which contained bind keys.
Ok, so you are saying, that after I have go the bindkeys I should remove sensors from xiaomi app, right?
What interests me is not the way to get the keys, but what were you based on when you made the decision to change the keys? The fact is that if the key does not match, then in the log (indicated above) there will be a corresponding error message. If it is not, then the reason is different.
Ok, so you are saying, that after I have go the bindkeys I should remove sensors from xiaomi app, right?
No, no, you must not remove sensors from the application in any case (keys will be lost). Just make sure the application is not active (just in case). When an application is active, it can connect to the sensor, which is why it stops broadcasting.
Ok, thank you for giving info about the logs. I don’t want to make mess here but in short this is what i have got from Hassio:
Got exception while fetching the state: No response from the device
9:45:59 PM – xiaomi_miio (WARNING) - message first occurred at 9:30:59 PM and shows up 32 times
Got error when receiving: timed out
9:45:59 PM – components/xiaomi_miio/vacuum.py (ERROR) - message first occurred at 9:30:59 PM and shows up 32 times
Updating xiaomi_miio vacuum took longer than the scheduled update interval 0:00:20
9:45:58 PM – Vacuum (WARNING) - message first occurred at 9:32:22 PM and shows up 12 times
Update of vacuum.xiaomi_vacuum_cleaner is taking over 10 seconds
9:45:48 PM – __main__.py (WARNING) - message first occurred at 9:31:30 PM and shows up 31 times
Error handling message: required key not provided @ data['category']. Got None
9:31:08 PM – Home Assistant WebSocket API (ERROR)
Setup of vacuum platform xiaomi_miio is taking over 10 seconds.
9:30:48 PM – Vacuum (WARNING)
Setup of binary_sensor platform ping is taking over 10 seconds.
9:30:48 PM – Binary sensor (WARNING)
Setup of sensor platform command_line is taking over 10 seconds.
9:30:48 PM – Sensor (WARNING)
Regarding changing keys itself. Why did I started to changed them?
I found the red Icon called “restored” from Configuration> Entities. Once I get this icon, the values never show. If this icon dissapear (after changing bindkeys) I always received temperature and humidity values.
This is normal behaviour when restarting HA. In this case, the sensor has the state UNAVAILABLE. At least one period (your period option) must elapse after a restart so that entities are updated. If during the first period HA has not received data from the sensor, sensor state changes to UNKNOWN. Since LYWSD03 sends data approximately once every 10 minutes (battery once per hour), it may take 10-12 minutes before the actual sensor reading appear.
That is clear for me, unfortunately I am waiting way much longer after restart to be able to see new (most recent) data from sensors. This is what I have get:
To get the bindkeys I should use the app (add the sensors) and straight after that I should switch off app/bluetooth an the bindkeys paste to my configuration. Restart the HA an leave it for the night, yes? It dosn’t metter are the letters are as capital or not.
There is nothing related to the sensors in logs, right? I haven’t found anything interesting, but as I said I am newbie. So I rather to kindly ask.
Yes. Yes. In fact, turning off Bluetooth is not necessary. It may not even be necessary to unload the application from memory - I advise you to try this for confidence.
Yes. In the log, you showed there, is nothing related to our component.
In general, for now, I suggest that you tolerate and just wait. Depending on further behaviour, we will decide what to do next. Check the log from time to time. If the sensors still do not appear, then you must enable debugging mode, as I wrote above.
Hello! The entry with the text Parsed: 0 hci events,... is an alarming entry, often saying that something is wrong at the system level.
Describe in more detail your system - hardware, software, how do you install Home Assistant.
Do you have the ability to run the hcitool lescan command outside and inside the container?
Also, check the system log for any errors related to bluetooth.
Perhaps the matter is access rights to the bt interface. I definitely can’t tell you how to check this in the case of docker. The bottom line is that the process working with the bt-interface should get the rights, as indicated here(step 1). Probably in the case of Docker, these rights should be granted both inside the container to the python process and to the container itself. But I can be wrong, because I have no experience with docker…
Googling on your dongle’s ID shows that it could be a pretty old device. Is it supports Bluetooth Low Energy (has been included in the Bluetooth specification since version 4.0)?
sudo btmgmt info
Index list with 1 item
hci0: Primary controller
addr 00:22:F7:17:D5:75 version 4 manufacturer 10 class 0x000104
supported settings: powered connectable fast-connectable discoverable bondable link-security
sudo hciconfig hci0 lestates
Can't read LE supported states on hci0: Input/output error(5)