Page 1 of 1
Howto: LUA setting EvoTouch status
Posted: Monday 04 April 2016 21:22
by bertoost
Hi all,
I am trying several things to set the status over my Evohome EvoTouch device. Would like to set the status from Auto to Away or from Away to Auto. What I tried in LUA script was this;
Code: Select all
commandArray['EvoTouch'] = 'Auto'
//...
commandArray['EvoTouch'] = 'Away'
And also tried to use the "evo-setmode.sh" script like
Code: Select all
script:///home/pi/evohome-client/evohomeclient2/evo-setmode.sh {status}
//...
commandArray['EvoTouch'] = 'On'
But non of these seems to work. At least; Domoticz did not get updated and the Evohome phone app doesn't change either.
Anyone some experience with this?
Thanks in advance.
Regards, Bert
Re: Howto: LUA setting EvoTouch status
Posted: Saturday 09 April 2016 11:26
by bertoost
Anyone knows how to set that {status} via LUA script?
Tried multiple things, but don't know how.
Should be something like;
Code: Select all
commandArray['EvoTouch'] = 'On#Auto'
But dont know how to pass {status} via LUA.
Re: Howto: LUA setting EvoTouch status
Posted: Tuesday 12 April 2016 10:02
by bertoost
I have the latest version, currently v3.5051
Re: Howto: LUA setting EvoTouch status
Posted: Tuesday 12 April 2016 20:02
by bertoost
Hm will try that manually..
But how can u update EvoTouch switch in Domoticz right after I change de mode?
My LUA script is now checking the state of my iphone and the EvoTouch. I want to avoid a panic attack on my EvoTouch
Code: Select all
if (otherdevices['iPhone Home'] == 'On' and otherdevices['EvoTouch'] ~= 'Auto') then
commandArray['EvoTouch'] = 'Auto'
print('EvoTouch should be set to AUTO now...')
end
[edit]
And yes; it's working via the Domoticz interface and also via command line calling the setmode script
Re: Howto: LUA setting EvoTouch status
Posted: Tuesday 12 April 2016 21:24
by bertoost
I now fixed it by running os.execute and tracking 2 minutes of time in a user variable (for a wait on the update command). Like this;
Code: Select all
if (otherdevices['OnMyWayHome'] == 'On' and otherdevices['EvoTouch'] ~= 'Auto' and (timeFull - uservariables['EvoTouchChanged']) >= 120) then
os.execute('sudo ./home/pi/evohome-client/evohomeclient2/evo-setmode.sh Auto');
commandArray['Variable:EvoTouchChanged'] = timeFull
-- commandArray['SendNotification'] = 'Evohome#aangezet!'
-- print('EvoTouch should be AUTO now...')
end
Note; the "on my way home" is a dummy switch which I use with the Pilot app to set to ON when I am at some (one-way-traffic) point on my way home
. Reaching this "checkpoint" means I am at home in 10 minutes
Re: Howto: LUA setting EvoTouch status
Posted: Wednesday 13 April 2016 7:35
by bertoost
And that is?
Now getting "lua script is running for 10 seconds" error in the log.
Re: Howto: LUA setting EvoTouch status
Posted: Wednesday 13 April 2016 7:47
by narfight
for the time out, change your os.execute like this :
Code: Select all
os.execute('sudo ./home/pi/evohome-client/evohomeclient2/evo-setmode.sh Auto &');
(add & to the end for "send and no wait")
Re: Howto: LUA setting EvoTouch status
Posted: Wednesday 13 April 2016 9:43
by bertoost
Ah of course. Good one. Added it.
Any suggestions for the normal commandArray method?
Re: Howto: LUA setting EvoTouch status
Posted: Wednesday 13 April 2016 10:42
by bertoost
Right..
Sounds very difficult to me
I will try out and finetune the os.execute approach.. Only used to get my evotouch out away mode when I drive home and put back in when leaving.
Re: Howto: LUA setting EvoTouch status
Posted: Wednesday 04 April 2018 22:21
by JuanUil
Hi all,
any progress on this lua scripting to change the state of evohome?
Jan
Re: Howto: LUA setting EvoTouch status
Posted: Wednesday 04 April 2018 22:43
by DanM
Take a look at
https://www.domoticz.com/wiki/Evohome - there is a part titled automation about 2/3rds of the way down the page.
In my case evohome is device IDX 161 so I use the following to set eco mode when Im way from home:
Code: Select all
os.execute('curl "127.0.0.1:8080/json.htm?type=command¶m=switchmodal&idx=161&status=AutoWithEco&action=1&ooc=1"')
Re: Howto: LUA setting EvoTouch status
Posted: Thursday 05 April 2018 18:39
by JuanUil
Thanx,
I will go working with the json commands.
jan
Re: Howto: LUA setting EvoTouch status
Posted: Sunday 20 December 2020 19:48
by bertoost
Any updates on this? It was still not working from LUA script...
As I have a for loop at the end of my LUA script, since I have some backup groups/scenes (for when some lights did not turned on), I have extended this loop with this piece;
Code: Select all
if (key == 'EvoTouch') then
EvoTouchIdx = otherdevices_idx['EvoTouch']
os.execute('curl "127.0.0.1:8080/json.htm?type=command¶m=switchmodal&idx=' .. EvoTouchIdx .. '&status=' .. value .. '&action=1&ooc=1"')
end
From here I can do this anyway