Page 1 of 1

Update a dummy temp sensor using DomoticzEvents

Posted: Friday 13 December 2019 9:03
by froglock30
Hi,

I wrote a python Time script to manage my boiler.

I am able to read my dummy temp sensor using : DomoticzEvents.Devices["My device"].n_value_string

But I am not able to write into this device

DomoticzEvents.Devices["My device"].n_value_string = 22.5 does nothing.

I am able to manage dummy switch on/off using DomoticzEvents.Command("MySwitch", "Off") and would like to know how to do the same for my temp dummy devices.

Thanks.

Re: Update a dummy temp sensor using DomoticzEvents

Posted: Sunday 15 December 2019 10:50
by peerkersezuuker
Hello,
I have a similar question.
From the python events module I can toggle switches On/Off with the DomoticzEvents.Command call, but I would like to set a dimmer to a specific level.
For now I am calling the JSON api : ("http://" + domoticzserver + "/json.htm?type=command&param=switchlight&idx=" + idx_schuifpui + "&switchcmd=Set Level&level=" + mid_level)

But I rather would like to set the level with a native attribute from the DomoticzEvents module.

Regards
Peer

Re: Update a dummy temp sensor using DomoticzEvents

Posted: Tuesday 06 October 2020 14:46
by pipiche
pretty old question, but still no answer. How can we set a value to a setpoint device while using the DomoticzEvents in python ?

Re: Update a dummy temp sensor using DomoticzEvents

Posted: Tuesday 06 October 2020 16:29
by waaren
pipiche wrote: Tuesday 06 October 2020 14:46 pretty old question, but still no answer. How can we set a value to a setpoint device while using the DomoticzEvents in python ?
Hardly know anything from python plugins but have you tried something as setSetPoint ?

In Lua it is

Code: Select all

commandArray['SetSetPoint:MySetPointIdx']='20.5'
the API

Code: Select all

/json.htm?type=command&param=setsetpoint&idx=&setpoint=

Re: Update a dummy temp sensor using DomoticzEvents

Posted: Tuesday 06 October 2020 17:12
by pipiche
waaren wrote: Tuesday 06 October 2020 16:29
pipiche wrote: Tuesday 06 October 2020 14:46 pretty old question, but still no answer. How can we set a value to a setpoint device while using the DomoticzEvents in python ?
Hardly know anything from python plugins but have you tried something as setSetPoint ?

In Lua it is

Code: Select all

commandArray['SetSetPoint:MySetPointIdx']='20.5'
the API

Code: Select all

/json.htm?type=command&param=setsetpoint&idx=&setpoint=
Thanks , I found it while looking into the EventSystem source code ;-)

Re: Update a dummy temp sensor using DomoticzEvents

Posted: Wednesday 07 October 2020 18:45
by pipiche
I'm trying to update a user variables with the following syntax but it seems that there no change happening.
What am I doing wrong ?


import DomoticzEvents as Dz

Dz.user_variables[ 'my variable' ] = "22"

Re: Update a dummy temp sensor using DomoticzEvents

Posted: Wednesday 07 October 2020 19:41
by waaren
pipiche wrote: Wednesday 07 October 2020 18:45 I'm trying to update a user variables with the following syntax but it seems that there no change happening.
Dz.user_variables[ 'my variable' ] = "22"
Lua does use
commandArray['Variable:MyVar']='Some value'

so it could be something along the same line. But if you read the template Python template script in the event editor, setting a uservariable is one of things on the TODO list and so likely not implemented yet (same is true for the wiki (also on the todo list) )

Re: Update a dummy temp sensor using DomoticzEvents

Posted: Wednesday 07 October 2020 19:49
by pipiche
thanks @waaren

Re: Update a dummy temp sensor using DomoticzEvents

Posted: Saturday 31 October 2020 20:18
by bobbytux
Looking at the sources, I found that for python :

DE.Command( 'CustomCommand:' + idx, doWhat) # I don't know how to use it and it's usage ..

DE.Command( 'SetSetpoint:' + idx, 'val1#val2#val3') # I don't know how to use it and it's usage ..

DE.Command( 'Variable:' + variable_name, value_to_affect) # OK, this one works fine ;)

No implémentation of UpdateDevice :(

Regards :)

Re: Update a dummy temp sensor using DomoticzEvents

Posted: Thursday 11 March 2021 17:32
by Deltree
I have gone into the same problem (I have a Eurotronic Spirit thermostatic valve).
Thanks to this thread and some other research and experimentation, I have found that:

Code: Select all

DE.Command('Variable:Foo', '14') # Sets User Variable "Foo" to value 14
DE.Command('SetSetpoing:123', '20') # Sets the Setpoint device of my valve to 20 (123 is the ID of the device)
DE.Command('Heater relay', 'On') # Sets my heater (name "Heater relay") to ON
The other possibilities seen in source code of DomoticzEvents module (eg. "CustomCommand") remain unknown to me (some need to go far in the code to understand what they do), and I even don't understand really how the "SetSetpoint" command does what it does (which is what I want).
There is also a DE.Devices.update() method, no idea how/what it does.

I still need to find a way to configure the "mode" of my valve (I can set it to "Heat" for maximum heating, "Eco", for lower temperature, "OFF", etc.)