Time user variable  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
PSUtec
Posts: 9
Joined: Sunday 11 November 2018 12:25
Target OS: Linux
Domoticz version: 12896
Location: Ferrières (BE)
Contact:

Time user variable

Post by PSUtec »

Hi,
I've created a user variable VH1, type time, value 05:00.
How can I assign a new value (e.g. 06:00) to this variable in a script?
I've tried:
- dz.variables('VH1').value='06:00'
- dz.variables('VH1').time.hour=6
- dz.variables('VH1') .time='06:00'
- dz.variables('VH1')=dz.variables('VH1').addHours(1)

No error, but no change!
Some idea to solve this problem?

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

Re: Time user variable  [Solved]

Post by waaren »

PSUtec wrote: Monday 02 November 2020 19:07 I've created a user variable VH1, type time, value 05:00.
How can I assign a new value (e.g. 06:00) to this variable in a script?
as described in the wiki page on this. To set a variable to a value use the method set.

So here you would use

Code: Select all

dz.variables('VH1').set('06:00')
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
PSUtec
Posts: 9
Joined: Sunday 11 November 2018 12:25
Target OS: Linux
Domoticz version: 12896
Location: Ferrières (BE)
Contact:

Re: Time user variable

Post by PSUtec »

Thanks for this fast answer.

I had tried dz.variables('VH1').time.set('06:00') which causes an error.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest