Update (dummy) devices _within_ the script

Moderator: leecollings

Post Reply
Keesje
Posts: 6
Joined: Sunday 03 November 2019 13:53
Target OS: NAS (Synology & others)
Domoticz version: 2020.2
Contact:

Update (dummy) devices _within_ the script

Post by Keesje »

Hi all,

I've searched the forum but couldn't find a similar thread. Maybe, I used the wrong query-words, then sorry bothering.

I would like to update a device value within the script. The "commandArray-technique", as shown in many examples, updates after finishing the script. Regardless if this is elegant, I would like to update a physical or dummy/virtual device, and subsequently use that value down the script.

Is this possible?

thanks in advance.
Kees
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Update (dummy) devices _within_ the script

Post by waaren »

Keesje wrote: Tuesday 29 December 2020 14:17 I would like to update a physical or dummy/virtual device, and subsequently use that value down the script.
Maybe I miss your point but...
If you update a device from within your script you will have the value available within the script and you can simply use that value in your code.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Keesje
Posts: 6
Joined: Sunday 03 November 2019 13:53
Target OS: NAS (Synology & others)
Domoticz version: 2020.2
Contact:

Re: Update (dummy) devices _within_ the script

Post by Keesje »

Thanks for considering.

As I'm using sub functions, changing a device value in one function won't be updated until ending the main script.
In my case it might be useful to have the device updated in stead of sending variables back and forth through function calls.

So if anyone has an idea, it's appreciated!

regards,
Kees
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Update (dummy) devices _within_ the script

Post by waaren »

Keesje wrote: Tuesday 29 December 2020 15:53 As I'm using sub functions, changing a device value in one function won't be updated until ending the main script.
In my case it might be useful to have the device updated in stead of sending variables back and forth through function calls.

So if anyone has an idea, it's appreciated!
There is no need to send anything from and to functions when the variables are declared at a script level.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest