Page 1 of 1
Someonehome
Posted: Monday 08 January 2018 15:41
by Lebo2d9
Hi,
I have a blocky the set the temp of 2 rooms when someone is at home. (Precense detection based on Life360)
The problem is when there is already some body at home (someonhome is on) and an other persons enter the geofence the someonehome switched is again set to on and the command to set the room temperature is sended again but this is not needed.
How can i avoid the set temperature when there is already someone at home?
Kind regards
Koen Deschepper
Re: Someonehome
Posted: Monday 08 January 2018 16:04
by triton
My first reaction would be don't switch On someonehome when On already and trigger the set temp in a separate blocky event based on the someonehome switch, check what the switch did, become On or Off.
Does that help?
Re: Someonehome
Posted: Monday 08 January 2018 16:05
by emme
I assume Life360 will update to ON a switch... so re-assign On the same device will trigger again the script
you would need a second controlled variable (or device) to check that will count is someone is already at home or not
...how do you handle the absence of persons at home? simply having the Life360 switch set to off?
do you have a switch for a single person or do you have a common switch for all?
...maybe it would be better if you could post your script also
Re: Someonehome
Posted: Monday 08 January 2018 17:46
by febalci
Try this:
Create a user variable "Family Presence" and the following lines in a Lua Device Script.
Code: Select all
commandArray = {}
if (devicechanged['Life360 - Person1 Presence'] or devicechanged['Life360 - Person2 Presence'] or devicechanged['Life360 - Person 3 Presence']) then
if (otherdevices['Life360 - Person Presence'] == 'On' or otherdevices['Life360 - Person Presence']== 'On' or otherdevices['Life360 - Person Presence']== 'On') then
if uservariables['Family Presence'] == 'Away' then
os.execute('curl -s "http://user:[email protected]:8084/json.htm?type=command¶m=setactivetimerplan&ActiveTimerPlan=4" &')
commandArray['Variable:Family Presence'] = 'Home'
print("Family is Home")
end
else
os.execute('curl -s "http://user:[email protected]:8084/json.htm?type=command¶m=setactivetimerplan&ActiveTimerPlan=3" &')
commandArray['Variable:Family Presence'] = 'Away'
print("Family is Away")
end
end
return commandArray
I use this to switch timer plan when anyone of the family is at home. You can put room temperature setting.
Re: Someonehome
Posted: Tuesday 09 January 2018 13:16
by Lebo2d9
febalci wrote:Try this:
Create a user variable "Family Presence" and the following lines in a Lua Device Script.
Code: Select all
commandArray = {}
if (devicechanged['Life360 - Person1 Presence'] or devicechanged['Life360 - Person2 Presence'] or devicechanged['Life360 - Person 3 Presence']) then
if (otherdevices['Life360 - Person Presence'] == 'On' or otherdevices['Life360 - Person Presence']== 'On' or otherdevices['Life360 - Person Presence']== 'On') then
if uservariables['Family Presence'] == 'Away' then
os.execute('curl -s "http://user:[email protected]:8084/json.htm?type=command¶m=setactivetimerplan&ActiveTimerPlan=4" &')
commandArray['Variable:Family Presence'] = 'Home'
print("Family is Home")
end
else
os.execute('curl -s "http://user:[email protected]:8084/json.htm?type=command¶m=setactivetimerplan&ActiveTimerPlan=3" &')
commandArray['Variable:Family Presence'] = 'Away'
print("Family is Away")
end
end
return commandArray
I use this to switch timer plan when anyone of the family is at home. You can put room temperature setting.
Hi febalci,
I changed to LUA and now it is working. I think I wiĺl change all my blockly scripts to LUA