Xiaomi Temperature Sensor issue
Closed this issue · 15 comments
I grabbed your latest commits today to try out some new Xiaomi gadgets. The Motion sensor and switch paired just fine, but something seems to have gone wrong with the temperature sensor. Mine is an original (round) Xiaomi sensor and it's flashing twice to indicate it's paired, and it's showing up in zigbee.db, but nowhere in the HA UI. I get these warnings in the log as well:
[0xdbfc:1] Message on unknown cluster 0x0405
12:10 AM core.py (WARNING)
[0xdbfc:1] Message on unknown cluster 0x0402
12:10 AM core.py (WARNING)
These seem to correlate with when the temp sensor is reporting.
Hi Tyler,
did you just paired it? One important point is to keep the sensor alive during the following initialization (pressing the button every 1-2 sec) until it shows up in the web gui.
It's a kind of two stage process:
- device join the device to the network, the zygpy api does the endpoint discovery and writes information to the DB, forward task to zha component
- the zha component, does some querries and initialitions and creates the HA objects and bindings for the sensors. for this the endpoint still needs to be active.
If you have my new code you should see a new tile, where you can see the status of the join operation.
I've tried it a few times now, even deleting the device from zigbee.db and starting fresh. Just to be sure, let me know if I'm doing this wrong. Here's how I'm pairing them:
- Call
permit
- Long press on sensor button until it blinks three times (Component status becomes Join)
- Short press on the button every 1-2 seconds (Component status becomes Device Init)
After that the component status goes back to Run
and nothing appears in HA. For the motion sensor and button after step 3 is when it appeared in the UI.
For background I'm running your latest branch, and I've installed your forks of zigpy
and bellows
using pip3 install git+<branch url>
. I'm not as familiar with Python as Ruby so let me know if I did something wrong there.
can you try again the pip3 command: I used
pip3 install --upgrade git+https://github.com/Yoda-x/bellows.git
pip3 install --upgrade git+https://github.com/Yoda-x/zigpy.git
Also please send a debug log for the failed join. I tried to reproduce your problem, but could not see the same error with my original xiaomi round sensor.
btw, during the init phase, you continued with the short key presses, right?
I pulled down the latest packages per your instruction and tried again after doing a long press on the temp sensor to unpair it. It didn't work, but I managed to grab some logs this time:
2018-03-15 03:32:52 WARNING (MainThread) [zigpy.device] [0x573d] Message on unknown endpoint 1
2018-03-15 03:32:52 WARNING (MainThread) [zigpy.endpoint] [0x573d:1] Message on unknown cluster 0x0000
2018-03-15 03:32:53 WARNING (MainThread) [zigpy.endpoint] [0x573d:1] Message on unknown cluster 0x0000
2018-03-15 03:32:57 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.lumi_lumisensor_switchaq2_021329bd_1 is taking over 10 seconds
2018-03-15 03:32:58 WARNING (MainThread) [zigpy.util] Error calling listener.device_updated: 'PersistingListener' object has no attribute 'device_updated'
I have a second temperature sensor arriving today, I'll try to pair that one and see if there's a difference in behaviour
Edit: Tried it, no dice. Same issue.
not sure if you use my versions of zigpz/bellows.
what kind of Hass installation you use?
hass.io, virtual environment or something else?
if virtual environment, did you activated it during the installation, otherwise the package was installed in a wrong place
I'm using Hassbian. I'll verify tonight the packages are being installed in the right place.
thanks, it"s the same procedure as described in the update doc
https://home-assistant.io/docs/installation/hassbian/upgrading/
So I think I've figured out the issue, but I'm not sure how to solve it. Installing your versions of zigpy
and bellows
works, and I was doing it before exactly the same as the link you posted. The issue seems to be that every time HA starts up it removes your versions and grabs the latest from the original repositories.
Example:
Before restarting HomeAssistant:
zeroconf (0.20.0)
zigpy (0.0.3.Y)
zigpy-xbee (0.0.2)
After starting Home Assistant:
zeroconf (0.20.0)
zigpy (0.0.3)
zigpy-xbee (0.0.2)
Success!
For future reference to anyone having trouble getting this working. First, HA was reverting my pip3
package updates on launch. I was able to get around this by launching hass -skip-pip
. The second issue, a bigger one, was that I'd originally cloned the contents of this repo as the pi
user without thinking. The files were fine but the links inside the /device
folder were not working. I've since recloned and everything is working now.
Thanks for your patience @Yoda-x, thanks so much for your good work here.
Hi @tyler-vincent
Thanks for your update.
Your findings are rather interesting.
Thanks to you
@tyler-vincent What do you mean in regards to cloning the contents as pi user? I'm having a similar issue after trying to pull down the latest updates:
2018-03-18 21:43:25 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.zha_new. Make sure all dependencies are installed Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/homeassistant/loader.py", line 142, in get_component module = importlib.import_module(path) File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 673, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 673, in exec_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "/home/pi/.homeassistant/custom_components/zha_new.py", line 17, in <module> from bellows.zigbee.device import Device ImportError: No module named 'bellows.zigbee.device' 2018-03-18 21:43:25 ERROR (MainThread) [homeassistant.loader] Unable to find component zha_new 2018-03-18 21:43:25 ERROR (MainThread) [homeassistant.setup] Setup failed for zha_new: Component not found.
I also have my base hass in /home/pi/.homeassistant, is this the issue perhaps? Any advice would help greatly - I was running as custom version of zha_new for a while for my sengled bulbs as stock zha doesn't work very well with them....now I'm rather stuck! I can get on discord in a bit, if that helps, Yoda!
@CSCG At first glance it looks like you don't have Yoda's fork of zippy
and bellows
installed. Try the following commands:
sudo systemctl stop home-assistant@homeassistant.service
sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate
pip3 install --upgrade git+https://github.com/Yoda-x/bellows.git
pip3 install --upgrade git+https://github.com/Yoda-x/zigpy.git
exit
sudo systemctl start home-assistant@homeassistant.service
That should upgrade the libraries to Yoda's forks and restart home assistant
I tried the following commands:
sudo systemctl stop home-assistant@homeassistant.service
sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate
pip3 install --upgrade git+https://github.com/Yoda-x/bellows.git
pip3 install --upgrade git+https://github.com/Yoda-x/zigpy.git
exit
sudo systemctl start home-assistant@homeassistant.service
Before restarting HomeAssistant:
bellows (0.6.0-YD)
zigpy (0.1.1-Y)
zigpy-xbee (0.1.1)
After starting Home Assistant:
bellows (0.6.0)
zigpy (0.1.1)
zigpy-xbee (0.1.1)
So, how to restart HA with --skip-pip?
I've read about zha_new but I do not know how to use it? (copy all the files and folders in ha-zha-new/custom_components/ into /home/homeassistant/.homeassistant/custom_components ???)