Page 1 of 1

Problem retrieving devices! after enabling python plugin

Posted: Wednesday 11 October 2017 11:09
by lrybak
I have problem with one of my plugin (https://github.com/lrybak/domoticz-storm-report).
A while after enabling my plugin, Devices section won't load - Problem retrieving devices! alert message appears
The Devices sections doesn't load becouse of the problem with JSON parsing
I found that for some reason, after enabling my plugin some other devices (wunderground idx 168 and 169) are being changed.
After that JSON for Device section is malformed and refuse to load (/json.htm?type=devices&displayhidden=1&displaydisabled=1&filter=all&used=all)

Please see step I performed to reproduce this issue

I used v3.8564 but the issue exists on stable v3.8153 as well

Screens and log zipped: https://www.dropbox.com/s/jqswib3qgbtaj ... e.zip?dl=0

Hardware view
Image

Section Devices display correctly
Image

Data in DeviceStatus table (idx 168 and 169)
Image

Enable my plugin + domoticz restart
Image

Hardware view - plugin enabled
Image

Device view - Problem retrieving devices!
Image

Bad formated float value in json (/json.htm?type=devices&displayhidden=1&displaydisabled=1&filter=all&used=all)
Image
Image

Data in DeviceStatus table (idx 168 and 169) changed
Image

Hardware table
Image

I disabled plugin and did domoticz restart
sqlite> Update Hardware set Enabled=0 where Extra='domoticz-storm-report';
After a while Devices sections has appeared again
Image

Data in DeviceStatus table (idx 168 and 169) changed again to correct values
Everything is working correctly
Image

My plugin has nothing to do with the idx 168 and 169 devices.
Do you know what is the reason of such situation?


Edit:

I enabled verbose logging and found that a while after enabling my plugin the problematic device were updated (float value with comma and not with dot) causing JSON parse error and prevent Device page to load

Code: Select all

2017-10-11 22:59:15.020  SQLR result: 168;Stacja pogodowa;1;0;0;12.4;89;3;1018;3;2017-10-11 09:29:58;;
2017-10-11 22:59:15.020  SQLQ query : UPDATE DeviceStatus SET SignalLevel=12, BatteryLevel=100, nValue=0, sValue='10,5;92;3;1018;2', LastUpdate='2017-10-11 22:59:15' WHERE (ID = 168)
2017-10-11 22:59:15.020  SQLH UpdateValueInt Stacja pogodowa HwID:9  DevID:1 Type:84  sType:1 nValue:0 sValue:10,5;92;3;1018;2
2017-10-11 22:59:15.020  SQLQ query : SELECT ID, SwitchType, LastUpdate, LastLevel, Options FROM DeviceStatus WHERE (Name == 'Stacja pogodowa')
2017-10-11 22:59:15.020  SQLR result: 168;0;2017-10-11 22:59:15;0;;
2017-10-11 22:59:15.020  RFXN : GetLightStatus Typ:84 STyp: 1 nVal:0 sVal:10,5;92;3;1018;2 llvl: 0 isDim:0 maxDim: 0 GrpCmd:0 lstat:
A while after disabling my plugin again, proper float value (with dot) were updated - Device page is loading correctly

Code: Select all

2017-10-11 23:08:53.231  SQLR result: 168;Stacja pogodowa;1;0;0;10,5;92;3;1018;2;2017-10-11 22:59:15;;
2017-10-11 23:08:53.231  SQLQ query : UPDATE DeviceStatus SET SignalLevel=12, BatteryLevel=100, nValue=0, sValue='10.5;92;3;1018;2', LastUpdate='2017-10-11 23:08:53' WHERE (ID = 168)
2017-10-11 23:08:53.231  SQLH UpdateValueInt Stacja pogodowa HwID:9  DevID:1 Type:84  sType:1 nValue:0 sValue:10.5;92;3;1018;2
2017-10-11 23:08:53.231  SQLQ query : SELECT ID, SwitchType, LastUpdate, LastLevel, Options FROM DeviceStatus WHERE (Name == 'Stacja pogodowa')
2017-10-11 23:08:53.231  SQLR result: 168;0;2017-10-11 23:08:53;0;;
2017-10-11 23:08:53.231  RFXN : GetLightStatus Typ:84 STyp: 1 nVal:0 sVal:10.5;92;3;1018;2 llvl: 0 isDim:0 maxDim: 0 GrpCmd:0 lstat:
Strange, isn't?

Re: Problem retrieving devices! after enabling python plugin

Posted: Saturday 14 October 2017 23:24
by lrybak
I solved my issue. There was a problem with gettext module used. The problem has gone once I removed gettext based translations