Im doing some simple math in a lua and trying to set a switch ON for the calculated time
commandArray['Lamptest'] = 'On FOR testtime'
testtime is in this case a local variable in the lua script, whitch aint working, is it even possible?
On FOR variable possible?
Moderator: leecollings
- jvdz
- Posts: 2334
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: On FOR variable possible?
Assuming testtime is a variable in LUA this should work fine:
Jos
Code: Select all
commandArray['Lamptest'] = 'On FOR ' .. tostring(testtime)
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Re: On FOR variable possible?
Thx alot Josjvdz wrote:Assuming testtime is a variable in LUA this should work fine:JosCode: Select all
commandArray['Lamptest'] = 'On FOR ' .. tostring(testtime)
- havnegata
- Posts: 114
- Joined: Wednesday 10 September 2014 11:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10162
- Location: Norway
- Contact:
Re: On FOR variable possible?
Trying to understand the concept of variable. Why is it an advantage to use a variable in your script instead of just f.ex 'On FOR 5' ?
Re: On FOR variable possible?
Because im doing some math in the LUA script depending on how cold it is outside, whitch makes me wanna put a switch on for X min.havnegata wrote:Trying to understand the concept of variable. Why is it an advantage to use a variable in your script instead of just f.ex 'On FOR 5' ?
On FOR xxx Minutes would ofc work but better to use the calculated value instead.
- havnegata
- Posts: 114
- Joined: Wednesday 10 September 2014 11:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10162
- Location: Norway
- Contact:
Re: On FOR variable possible?
Thanks for the reply, I'm beginning to understand, but can you please post the code, that way it's possible to get a greater understanding 

Re: On FOR variable possible?
Will post it later this weekend, atm im doing some small changes to the code =)havnegata wrote:Thanks for the reply, I'm beginning to understand, but can you please post the code, that way it's possible to get a greater understanding
- havnegata
- Posts: 114
- Joined: Wednesday 10 September 2014 11:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.10162
- Location: Norway
- Contact:
Re: On FOR variable possible?
Thanks, awaiting
Sent fra min Nexus 7 via Tapatalk

Sent fra min Nexus 7 via Tapatalk
Who is online
Users browsing this forum: No registered users and 1 guest