Smanar / Domoticz-deCONZ

deCONZ plugin for Domoticz (Zigbee application)
GNU General Public License v3.0
36 stars 26 forks source link

Some errors #169

Closed arjannv closed 2 months ago

arjannv commented 2 months ago

Hi Smanar,

After updating Domoticz, DeConz and this plugin (I'm on the extended branch), I got an error from the DeConz plugin. This did not happen directly after update, I only found out about it since this morning.

2024-07-24 08:40:49.120 DeConz Hub: ### Device > 161 Name:Lucht Garage Type:ZHAParticulateMatter Details:{'airquality': 'excellent', 'lastupdated': '2024-07-24T06:39:33.994', 'measured_value': 0, 'pm2_5': 0} and {'on': True, 'reachable': True}
2024-07-24 08:40:49.121 DeConz Hub: ### Update device (PM2.5 Garage) : {'nValue': 0.0, 'sValue': '0'}
2024-07-24 08:40:49.121 Error: DeConz Hub: Call to function 'onHeartbeat' failed, exception details:
2024-07-24 08:40:49.121 Error: DeConz Hub: Traceback (most recent call last):
2024-07-24 08:40:49.121 Error: DeConz Hub: File "/home/arjan/domoticz/plugins/Domoticz-deCONZ/plugin.py", line 1248, in onHeartbeat
2024-07-24 08:40:49.121 Error: DeConz Hub: _plugin.onHeartbeat()
2024-07-24 08:40:49.121 Error: DeConz Hub: File "/home/arjan/domoticz/plugins/Domoticz-deCONZ/plugin.py", line 536, in onHeartbeat
2024-07-24 08:40:49.121 Error: DeConz Hub: self.ManageInit()
2024-07-24 08:40:49.121 Error: DeConz Hub: File "/home/arjan/domoticz/plugins/Domoticz-deCONZ/plugin.py", line 603, in ManageInit
2024-07-24 08:40:49.121 Error: DeConz Hub: self.SendCommand("/api/" + Parameters["Mode2"] + "/" + self.INIT_STEP[0] + "/")
2024-07-24 08:40:49.121 Error: DeConz Hub: File "/home/arjan/domoticz/plugins/Domoticz-deCONZ/plugin.py", line 1135, in SendCommand
2024-07-24 08:40:49.121 Error: DeConz Hub: self.UpdateBuffer()
2024-07-24 08:40:49.121 Error: DeConz Hub: File "/home/arjan/domoticz/plugins/Domoticz-deCONZ/plugin.py", line 1176, in UpdateBuffer
2024-07-24 08:40:49.121 Error: DeConz Hub: self.NormalConnexion(_Data)
2024-07-24 08:40:49.121 Error: DeConz Hub: File "/home/arjan/domoticz/plugins/Domoticz-deCONZ/plugin.py", line 885, in NormalConnexion
2024-07-24 08:40:49.121 Error: DeConz Hub: self.InitDomoticzDB(i,_Data[i],self.INIT_STEP[0])
2024-07-24 08:40:49.121 Error: DeConz Hub: File "/home/arjan/domoticz/plugins/Domoticz-deCONZ/plugin.py", line 821, in InitDomoticzDB
2024-07-24 08:40:49.121 Error: DeConz Hub: UpdateDevice(key, Type_device, kwarg, self.SpecialDeviceList)
2024-07-24 08:40:49.121 Error: DeConz Hub: File "/home/arjan/domoticz/plugins/Domoticz-deCONZ/plugin.py", line 1423, in UpdateDevice
2024-07-24 08:40:49.121 Error: DeConz Hub: UpdateDeviceProc(kwarg, IEEE)
2024-07-24 08:40:49.121 Error: DeConz Hub: File "/home/arjan/domoticz/plugins/Domoticz-deCONZ/plugin.py", line 1536, in UpdateDeviceProc
2024-07-24 08:40:49.121 Error: DeConz Hub: setattr(device.Units[Unit], a, kwarg[a])
2024-07-24 08:40:49.121 Error: DeConz Hub: TypeError: 'float' object cannot be interpreted as an integer

Hope you can make anything from this, thanks! :)

arjannv commented 2 months ago

I went back to the "beta" branch, and everything is OK there :)

Edit: to soon.. Plugin didn't crash but there was an error:

2024-07-24 09:29:08.213 DeConz Hub: ### Device > 161 Name:Lucht Garage Type:ZHAParticulateMatter Details:{'airquality': 'excellent', 'lastupdated': '2024-07-24T07:24:19.549', 'measured_value': 0, 'pm2_5': 0} and {'on': True, 'reachable': True}
2024-07-24 09:29:08.213 Error: DeConz Hub: (CDevice_update) DeConz Hub - Lucht Garage: Failed to parse parameters: 'nValue', 'sValue', 'Image', 'SignalLevel', 'BatteryLevel', 'Options', 'TimedOut', 'Name', 'TypeName', 'Type', 'Subtype', 'Switchtype', 'Used', 'Description', 'Color' or 'SuppressTriggers' expected.
2024-07-24 09:29:08.213 Error: DeConz Hub: Call to function 'CDevice_update' failed, exception details:
2024-07-24 09:29:08.213 Error: DeConz Hub: Exception: 'TypeError'. No traceback available.
Smanar commented 2 months ago

Hello, I m not able to reproduce the issue on my side, are you using the special option ENABLEBATTERYWIDGET ?

This defaut is caused by missing field in the update request, but there is "watchdog" in the fonction, not possible to have it without nValue or sValue, so there is at least thoses fields.

Edit: Ha I have perhaps see something, so yes can be caused by the ENABLEBATTERYWIDGET option. The normal update fonction have one more debug line before the critic request

        Domoticz.Debug("### Update device ("+Devices[Unit].Name+") : " + str(kwarg)
        Devices[Unit].Update(**kwarg)

What is your debug level ? Perhaps you are loging only "LOG" but not "DEBUG" ? On my side I m using "debug info only".

And ATM beta and master are synchronised.

arjannv commented 2 months ago

Hi Smanar, thanks for the quick reply. Both logs are with debug info only enabled. I have searched for the ENABLEBATTERYWIDGET option but did not find it. Where is it supposed to be?

Smanar commented 2 months ago

For ENABLEBATTERYWIDGET , if you don't know what is it, it mean you are not using it > https://github.com/Smanar/Domoticz-deCONZ?tab=readme-ov-file#configuration

Both logs are with debug info only enabled.

You mean on hardware tab, the option "debug" is set to "debug info only" ? I m checking again, you can have this error message only at start, during the device initialisation. You have it only for this device ? Can you try to delete this device in domoticz "Lucht Garage" and restart the plugin, can be created with older version.

On my side during the initialisation I have

2024-07-25 18:00:15.174 Deconz: ### Device > 1 Name:Daylight Type:Daylight Details:{'dark': False, 'daylight': True, 'lastupdated': '2024-07-25T11:58:18.719', 'status': 170, 'sunrise': '2024-07-25T04:16:18', 'sunset': '2024-07-25T19:40:18'} and {'configured': True, 'on': True, 'sunriseoffset': 30, 'sunsetoffset': -30}
2024-07-25 18:00:15.175 Deconz: ### Update device (Deconz - Daylight) : {'nValue': 1, 'sValue': 'On'}, IGNORED , no changes ! 

So I have the ouput ### Update device and the domoticz fonction is called after. I don't see how the code can crash before.

arjannv commented 2 months ago

You mean on hardware tab, the option "debug" is set to "debug info only" ? Yes correct.

I've removed the "Lucht Garage" sensor from Domoticz. It created a new Custom Sensor Device after startup, but with the same error. If I force a sensor update from the DeConz GUI, the error also happens, so it also happens during normal operation.

Smanar commented 2 months ago

I have found something finally. Can you switch to beta to make tries ? On plugin folder

git pull
git checkout beta
git pull
arjannv commented 2 months ago

Yes! That did it :) Thanks for your hard work :)

Smanar commented 2 months ago

NP, thx for report.