timer- variable dependancy

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
krommetje3108
Posts: 12
Joined: Saturday 05 November 2016 7:52
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: netherlands
Contact:

timer- variable dependancy

Post by krommetje3108 »

If possible I would like to have a timer that checks if a variable is a 0 or 1. That way I can program several timers for e.g. hollidays

e.g: a schoolholiday the var vacation is set to 1
not a schoolvacation the var vacation is set to 0

So can make timers that check the var and act accordingly....
D'rMorris
Posts: 138
Joined: Thursday 01 May 2014 9:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands - Sittard
Contact:

Re: timer- variable dependancy

Post by D'rMorris »

Did you read the wiki?
If you define a user variable called "vacation", you can use that in a script / blockly. You can either directly call the uservariable in a script like so:

Code: Select all

 if ( uservariables["vacation"] == "1" ) then .....
I always put the uservariables in local script variables, this makes the code more readable and easier to debug imho.

In a script you would first fill a script variable based on the user variable like:
vacation = uservariables["vacation"]

Then you can just do:

Code: Select all

 if (vacation == "1") then .....
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest