zigpy / zigpy-deconz

A library which communicates with Deconz radios for zigpy
GNU General Public License v3.0
87 stars 20 forks source link

No response to 'Command.read_parameter' command with seq id '0x02' #222

Closed rrooggiieerr closed 1 year ago

rrooggiieerr commented 1 year ago

Since todays update of HA my ZHA won't work after a restart, also reloading my the ZHA integration doesn't work

2023-05-14 23:50:49.053 WARNING (MainThread) [zigpy_deconz.api] No response to 'Command.read_parameter' command with seq id '0x02'                                    
2023-05-14 23:50:49.067 ERROR (MainThread) [zigpy.application] Couldn't start application                                                                             
Traceback (most recent call last):                                                                                                                                    
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for                                                                                            
    return fut.result()                                                                                                                      
asyncio.exceptions.CancelledError                                                                                                         

The above exception was the direct cause of the following exception:                                                                                               

Traceback (most recent call last):                                                                                                                                    
  File "/usr/local/lib/python3.10/site-packages/zigpy/application.py", line 193, in startup                                                                           
    await self.connect()                                                                                
  File "/usr/local/lib/python3.10/site-packages/zigpy_deconz/zigbee/application.py", line 81, in connect                                                              
    self.version = await api.version()                                                                                                                                
  File "/usr/local/lib/python3.10/site-packages/zigpy_deconz/api.py", line 457, in version                                                                            
    (self._proto_ver,) = await self.read_parameter(                                                                                 
  File "/usr/local/lib/python3.10/site-packages/zigpy_deconz/api.py", line 422, in read_parameter                                                                     
    r = await self._command(Command.read_parameter, 1 + len(data), param, data)                                                                                       
  File "/usr/local/lib/python3.10/site-packages/zigpy_deconz/api.py", line 306, in _command                                       
    return await asyncio.wait_for(fut, timeout=COMMAND_TIMEOUT)                                         
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for                             
    raise exceptions.TimeoutError() from exc                                                                
asyncio.exceptions.TimeoutError                                                                                                                                     
2023-05-14 23:50:49.306 WARNING (MainThread) [homeassistant.components.zha.core.gateway] Couldn't start deCONZ = dresden elektronik deCONZ protocol: ConBee I/II, Rasp
Traceback (most recent call last):                                                                                                                                    
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for                                                                                            
    return fut.result()                                                                                                                                               
asyncio.exceptions.CancelledError                                                                                                                                     

The above exception was the direct cause of the following exception:                                                                                                  

Traceback (most recent call last):                                                                                                                                    
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 205, in async_initialize                                                           
    self.application_controller = await app_controller_cls.new(                                                                                                       
  File "/usr/local/lib/python3.10/site-packages/zigpy/application.py", line 219, in new                                                                               
    await app.startup(auto_form=auto_form)                                                                                                                            
  File "/usr/local/lib/python3.10/site-packages/zigpy/application.py", line 193, in startup                                                                           
    await self.connect()                                                                                                                                              
  File "/usr/local/lib/python3.10/site-packages/zigpy_deconz/zigbee/application.py", line 81, in connect                                                              
    self.version = await api.version()                                                                                                                                
  File "/usr/local/lib/python3.10/site-packages/zigpy_deconz/api.py", line 457, in version                                                                            
    (self._proto_ver,) = await self.read_parameter(                                                                                                                   
  File "/usr/local/lib/python3.10/site-packages/zigpy_deconz/api.py", line 422, in read_parameter                                                                     
    r = await self._command(Command.read_parameter, 1 + len(data), param, data)                                                                                       
  File "/usr/local/lib/python3.10/site-packages/zigpy_deconz/api.py", line 306, in _command                                                                           
    return await asyncio.wait_for(fut, timeout=COMMAND_TIMEOUT)                                                                                                       
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for                                                                                            
    raise exceptions.TimeoutError() from exc                                                                                                                          
asyncio.exceptions.TimeoutError                                                                                                                                       
puddly commented 1 year ago

This isn't a software problem: the error indicates that the Conbee isn't responding at all to any commands. Unplug it and plug it back in, or check your USB passthrough if you're using a VM.

rrooggiieerr commented 1 year ago

Sorry, didn't mention, but I'm using a RaspBee II which is connected to the GPIO of my Raspberry pi.

Rebooting the hardware, seems to fix it, but then after a restart of HA Core (not the hardware) brings it into trouble agian

MattWestb commented 1 year ago

Is you using hard or software UART for the RaspBee ? Standard is software for the GIPO and hardware for the BT.

rrooggiieerr commented 1 year ago

I don't know if I use software or hardware UART, is this configured during the ZHA integration installation? Any place where I could look this up?

After a couple of hardware restarts its now working stable. Not sure what happens when I restart again

MattWestb commented 1 year ago

Pi 3B and older its in the pi config and Pi 4 its little different but look on deCONZ setup instructions / Wiki they is writing it there (was having one RaspBee I that was working OK on Pi 3B+).

rrooggiieerr commented 1 year ago

I', using a Pi 4. Never knew there were extra steps involved, so I learned something new. A quick check of the /mnt/boot/config.txt of my Pi reveals enable_uart=1, so that's good.

Hedda commented 1 year ago

@rrooggiieerr since the question instead belongs in https://community.home-assistant.io/ can you close this issue now? See ex:

https://community.home-assistant.io/t/raspbee-ii/370391

https://community.home-assistant.io/t/zha-cant-connect-to-freshly-installed-raspbee-ii-on-rpi-4b-raspbee-ii-seems-not-available/210550/

https://community.home-assistant.io/t/home-assistant-on-raspberry-pi-with-raspbee-ii-installation/451438/

https://community.home-assistant.io/t/raspbee-raspberrypi-4/132547

https://community.home-assistant.io/t/zha-cant-connect-to-freshly-installed-raspbee-ii-on-rpi-4b-raspbee-ii-seems-not-available/210550/

https://community.home-assistant.io/t/raspbee-2-and-homeassistant/383218

Anyway, I believe also need to disable Bluetooth (bt) for GPIO in /boot/config.txt file in order to free up the UART for RaspBee:

enable_uart=1
dtoverlay=miniuart-bt
dtoverlay=disable-bt

https://r.obin.ch/blog/2022/08/02/integrate-raspbee-2-into-home-assistant/

https://phoscon.de/en/raspbee2/install

https://www.dresden-elektronik.de/download/datenblaetter.html?file=files/dresden-elektronik/content/downloads/datenblaetter/wireless%20light%20control/RaspBee-BHB-en.pdf

MattWestb commented 1 year ago

Not needed disabling the BT comport but moving it to software ones so the GPIO can sing the hardware comport from the SOC so the last config can being left out and getting BT working but not in one good way then software comports is not working great on RPIs (CPU frequencies is not optimal for it).

rrooggiieerr commented 1 year ago

Since latest HA OS everything is working fine again, even bluetooth