JohnvandeVrugt / toonapilib4domoticz

A simple toonapilib based python plugin for domoticz
MIT License
7 stars 6 forks source link

Error. #28

Closed Addie363 closed 4 years ago

Addie363 commented 4 years ago

Since last week i see in the logging of Domoticz these errors and there are no commands send anymore to Toon: 2019-12-02 14:48:00.233 Error: (Toon) 'onCommand' failed 'AttributeError':''NoneType' object has no attribute 'on_command''. 2019-12-02 14:48:00.233 Error: (Toon) ----> Line 115 in '/home/pi/domoticz/plugins/toonapilib4domoticz/plugin.py' 2019-12-02 14:48:00.233 Error: (Toon) ----> Line 72 in '/home/pi/domoticz/plugins/toonapilib4domoticz/plugin.py'

What is wrong?

darkrain-nl commented 4 years ago

Did you update to the latest version of both the plugin and the library we use?

The authentication mechanism used by the API is changed quite a bit, therefore some changes are made to both the plugin and the library and you have to create an Access Token now to be able to connect.

Addie363 commented 4 years ago

Just did an new install, but i think there are no changes on de directorys. I can't even add the hardware anymore in the ToonApiLib4Domoticz type selection box. Is there a way to remove all off the installation and begin allover? I think there is no effect on the directorys on an the last install...

Addie363 commented 4 years ago

Closed the issue by mistake. is there a way to completely begin all over? I think nothing happens on the directorys. With the last install I blew it all for i can't see even the ToonApiLib4Domoticz type selection box.....

darkrain-nl commented 4 years ago

You can remove the plugin from "domoticz/plugins" then the plugin is gone.

For the toonapilib I would suggest to just run "sudo pip3 install toonapilib -U" on raspberry PI or "pip install toonapilib -U" when on Windows to make sure it is the latest version.

Then put back the folder for the plugin with the plugin.py and the devices folder inside it.

Then restart Domoticz and after that select the plugin again, fill in the Access Token you got from: "https://api.toon.eu/toonapi-accesstoken?tenant_id=eneco&client_id=" and you should be good to go!

Good luck.

Addie363 commented 4 years ago

The Domoticz is running on a Pi. I get "Requirement already satisfied, skipping upgrade" on "sudo pip3 install toonapilib -U", so no changes are made on this setup. The only option i see is the old type "Toon Thermostat" but this one does not work since last februari. Tommorow I wil give it another try...

darkrain-nl commented 4 years ago

Did you get it to work?

Addie363 commented 4 years ago

Last evening I've removed the toonapilib4domoticz dir's and did a new install, and it works now. The devices are present now. I think the fault was that there were tree directories: toonapilib4domoticz, toonapilib4domoticz.old and a toonapilib4domoticz.old1. It is working now, but it less from stable. I have to restart the domoticz services frequently. When I stop the Toonadlib in hardware it is stable. I see no errors...

darkrain-nl commented 4 years ago

What did you configure as update rate? Mine is pretty stable at 2 minutes (this is perhaps already to much for the API) but in that case there is an error in the log. Did you btw turn debug logging on?

Addie363 commented 4 years ago

Update rate is on 2 munites and the debug is on true. There is logging, but the tab probleem is empty. Seems to crash before it can be logged?

darkrain-nl commented 4 years ago

Do you run the latest beta from Domoticz?

Addie363 commented 4 years ago

Yes, allways running latest Beta version. I think I,ve captured a error in the logging now! 2019-12-06 12:11:02.069 Error: (Toon) 'onCommand' failed 'AttributeError':''NoneType' object has no attribute 'on_command''. 2019-12-06 12:11:02.069 Error: (Toon) ----> Line 109 in '/home/pi/domoticz/plugins/toonapilib4domoticz/plugin.py' 2019-12-06 12:11:02.069 Error: (Toon) ----> Line 69 in '/home/pi/domoticz/plugins/toonapilib4domoticz/plugin.py'

In these lines in the script is the word "Hue" present. Are the the Philips Hue?

darkrain-nl commented 4 years ago

No that is not the Philips Hue as support for that is not yet added to the plugin, I do have a PR ready to add it, but the native Hue in Domoticz is way better ;)

Those errors mean most likely that there is something wrong with the Toon object, perhaps the Access Token is not correct and therefore the object is not created, search the log for "Could not create a toonapilib object" to see if that is the case.

Addie363 commented 4 years ago

I can't find the error "Could not create a toonapilib object", but with the ToonApiLib hardware disabled I get every minuut "Error: Switch command not send!, Hardware device disabled or not found!"

I've created a new acces token and created a new peace of hardware. Devices are created and show themselfs in the devices tab. See what it wil do...

darkrain-nl commented 4 years ago

fingers crossed.

Addie363 commented 4 years ago

No errors or crashes for an hour now.... I think that I am going to make as the sodemieter an image of the config as it is now!

Addie363 commented 4 years ago

It has take some time, but it's back again....

2019-12-06 17:17:52.647 (Toon) Update power/solar usage: 8125118;8062532;3182909;7343892;4330;0

2019-12-06 17:18:00.183 EventSystem: Event triggered: Toon nw_2

2019-12-06 17:18:00.279 (Toon) onCommand called for Unit 9: Parameter 'Off', Level: 0

2019-12-06 17:18:30.328 Error: (Toon) 'onCommand' failed 'JSONDecodeError'.

2019-12-06 17:18:30.328 Error: (Toon) ----> Line 109 in '/home/pi/domoticz/plugins/toonapilib4domoticz/plugin.py'

2019-12-06 17:18:30.328 Error: (Toon) ----> Line 69 in '/home/pi/domoticz/plugins/toonapilib4domoticz/plugin.py'

darkrain-nl commented 4 years ago

I don't have any more ideas. @JohnvandeVrugt do you perhaps know what is going on here?

JohnvandeVrugt commented 4 years ago

Not running the latest beta. No issues here. Little bit short on free time to test with latest beta...

Addie363 commented 4 years ago

I'm restarting the service now for every 30 minutes. It starts without errors. See how long it lives... Tomorrow I will put the time-out on one hour. Looks like I'm the only one with this issue?

rene2716 commented 4 years ago

Running 4.10717 here without errors

Op vr 6 dec. 2019 18:53 schreef Addie363 notifications@github.com:

I'm restarting the service now for every 30 minutes. It starts without errors. See how long it lives... Tomorrow I will put the time out on one hour. Looks like I'm the only one with this issue?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JohnvandeVrugt/toonapilib4domoticz/issues/28?email_source=notifications&email_token=AJWNAS55DCVPWA5AID7GMQLQXKGQHA5CNFSM4JTWDGEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGE3OLQ#issuecomment-562673454, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWNAS5PT4DIPSJUNX57AR3QXKGQHANCNFSM4JTWDGEA .

JohnvandeVrugt commented 4 years ago

V4.11551 running over an hour without any issues. Reverting to stable V4.10717 that runs just fine with this plugin for a long time running on Pi3.

Addie363 commented 4 years ago

I'm on V4.11553 and sometimes it lifes for 6 hours. How can i revert to, say V4.10717? Is it somewhere available?

darkrain-nl commented 4 years ago

The only way to do that is to start over and restore a backup from V4.10717 or earlier. Downgrading Domoticz is not supported and the developers always say one should not downgrade.

Addie363 commented 4 years ago

Maybe it have something tot do with the troubles, but since last update to V4.11554 there was no crash anymore. Also the logging is very clean...

Addie363 commented 4 years ago

Still had troubles till last monday. After a reset of the Toon it all works fine. No errors and all scripts are working. This was the solution to me... Thanks for support!