JohnvandeVrugt / toonapilib4domoticz

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

setting thermostat temperature not working #1

Closed darkrain-nl closed 5 years ago

darkrain-nl commented 5 years ago

Setting the thermostat temperature is not working. Looking at the code this perhaps is because the API is never asked to do this...

I tried fixing this but could not get it to work.

Perhaps being able to set the states (which I know is a todo/wish) makes this a non issue...

JohnvandeVrugt commented 5 years ago

States seem to have the same issue. I guess we need to ask the toonapilib developer for same help on this matter.

JohnvandeVrugt commented 5 years ago

Open an issue at the toonapilib repository.

darkrain-nl commented 5 years ago

Line 142 and 150 are for updating the devices inside Domoticz, that works fine.

This issue is about changing the real Toon thermostat setpoint via the API, Line 82, this is not working at the moment. @JohnvandeVrugt is in touch with the developer of the toonapilib for assistance on this matter.

JohnvandeVrugt commented 5 years ago

That's right, the developer of toonapilib already replied, but he needs some time to figure it out.

costastf commented 5 years ago

As far as I can see https://github.com/JohnvandeVrugt/toonapilib4domoticz/blob/5cfe4d2d6270b3933d2373be8a14823c209642ab/plugin.py#L82 should provide you with the usability that you need, setting the temperature to the provided value. Can you maybe provide some logging that would help troubleshoot the issue? I am not super excited by the usage of globals and not sure if that is the preferred way to work in domoticz. What would help is if I can get a log output of the setting of the value. Please enable debug logging and provide the output here and see where that takes us or maybe guide me with a way that I could trouble shoot this through a docker image or something.

costastf commented 5 years ago

https://github.com/JohnvandeVrugt/toonapilib4domoticz/blob/5cfe4d2d6270b3933d2373be8a14823c209642ab/plugin.py#L76 references myToon while the global is actually MyToon. Usage of all those globals makes it impossible to reason about the code, having no way to know about the state when it is spread all over the place. Of course that should not affect the fact that the value should be set because MyToon is not a variable but an object of which assigning the thermostat state should set it internally. Essentially that global reference with the wrong letter casing should not be there at all, but that does not seem to be the issue with the code.

costastf commented 5 years ago

This should be fixed with v3.0.10 of the library that can set temperatures even if the program is set. Thanks for reporting!

stephanvdplas commented 5 years ago

I see now that indeed the setpoint change is reflected on the Toon when the program is off. In version 3.0.10 of the ToonApiLib this will be fixed. Great work! But is also fixed that setting the program (sleep, away, etc) on the domoticz selector is not effected on the Toon at this moment? (This was the case in the former ToonThermostat hardware).

JohnvandeVrugt commented 5 years ago

No stephan, that requires some work in the plugin.

stephanvdplas commented 5 years ago

Clear. It would be great because some of my DZvents Scripts rely on this setting. The logic is (/should be) that the program of the Thermostat itself is turned off, but the Domoticz selector can switch the home, away, sleep and comfort modes and the Toon reflects this setting without the program be set on. The other way around: The selector should show what state is set on the Toon even when the program is off.

JohnvandeVrugt commented 5 years ago

I just committed a new version that supports setting the state of the program. I cannot remember that the native domoticz toon plugin had a switch to set/unset the program being run.

I'm also not sure that we can set both program state and program 'active' seperately from the toonapilib / toon api. The Toon app has apart from the program states also an extra switch for the program to run. We have to investigate that.

JohnvandeVrugt commented 5 years ago

I have create a new issue concerning the states. #7

stephanvdplas commented 5 years ago

I'm also not sure that we can set both program state and program 'active' seperately from the toonapilib / toon api.

It is not that you were able to set both program state and program 'active', the thing is that when the program is off on the Toon, you still can use the 4 states (without the automatic evolving to other states of course). These states should be reflected on the Domoticz device, and not as it is doing right now setting the state to 00 (holiday).

JohnvandeVrugt commented 5 years ago

Stephan,

please update toonapilib to version 3.0.11. I think I fixed the update issue in the toonapilib. See https://github.com/costastf/toonapilib/pull/25

stephanvdplas commented 5 years ago

3.0.11 is not available. When I upgrade (pip install toonapilib --upgrade) 3.1.0 is installed. I guess this is what you mean :) I'll try and let you know the outcome.

JohnvandeVrugt commented 5 years ago

Yep; moving on! I was testing with updating toonapilib through pip and while testing I suddenly ended up with version 3.1.0 as well 😆

costastf commented 5 years ago

I just released 3.1.0 that exposes some extra stuff so you guys got that. The fix is there so you should be good to go.

On Mon, Mar 4, 2019 at 1:04 PM John van de Vrugt notifications@github.com wrote:

Yep; moving on! I was testing with updating toonapilib through pip and while testing I suddenly ended up with version 3.1.0 as well 😆

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JohnvandeVrugt/toonapilib4domoticz/issues/1#issuecomment-469228860, or mute the thread https://github.com/notifications/unsubscribe-auth/AEbFa88kdk8cMcb5BAkzmeFk-rvDUpHsks5vTQuzgaJpZM4bOd55 .