Page 1 of 1

Update (dummy) devices _within_ the script

Posted: Tuesday 29 December 2020 14:17
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

Re: Update (dummy) devices _within_ the script

Posted: Tuesday 29 December 2020 14:25
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.

Re: Update (dummy) devices _within_ the script

Posted: Tuesday 29 December 2020 15:53
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

Re: Update (dummy) devices _within_ the script

Posted: Tuesday 29 December 2020 17:43
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.