Update a dummy temp sensor using DomoticzEvents

Python and python framework

Moderator: leecollings

Post Reply
froglock30
Posts: 1
Joined: Friday 13 December 2019 8:55
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Update a dummy temp sensor using DomoticzEvents

Post 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.
peerkersezuuker
Posts: 70
Joined: Monday 14 December 2015 22:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Mierlo
Contact:

Re: Update a dummy temp sensor using DomoticzEvents

Post 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
pipiche
Posts: 2016
Joined: Monday 02 April 2018 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Re: Update a dummy temp sensor using DomoticzEvents

Post 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 ?
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices

If the plugin provides you value, you can support me with a donation Paypal.

Wiki is available here.

Zigbee for Domoticz FAQ
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Update a dummy temp sensor using DomoticzEvents

Post 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=
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pipiche
Posts: 2016
Joined: Monday 02 April 2018 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Re: Update a dummy temp sensor using DomoticzEvents

Post 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 ;-)
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices

If the plugin provides you value, you can support me with a donation Paypal.

Wiki is available here.

Zigbee for Domoticz FAQ
pipiche
Posts: 2016
Joined: Monday 02 April 2018 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Re: Update a dummy temp sensor using DomoticzEvents

Post 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"
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices

If the plugin provides you value, you can support me with a donation Paypal.

Wiki is available here.

Zigbee for Domoticz FAQ
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Update a dummy temp sensor using DomoticzEvents

Post 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) )
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pipiche
Posts: 2016
Joined: Monday 02 April 2018 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Re: Update a dummy temp sensor using DomoticzEvents

Post by pipiche »

thanks @waaren
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices

If the plugin provides you value, you can support me with a donation Paypal.

Wiki is available here.

Zigbee for Domoticz FAQ
bobbytux
Posts: 2
Joined: Friday 30 October 2020 17:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Update a dummy temp sensor using DomoticzEvents

Post 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 :)
Deltree
Posts: 2
Joined: Thursday 11 March 2021 17:15
Target OS: Linux
Domoticz version:
Contact:

Re: Update a dummy temp sensor using DomoticzEvents

Post 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.)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest