Someonehome

Post Reply
Lebo2d9
Posts: 147
Joined: Tuesday 06 September 2016 20:39
Target OS: Raspberry Pi
Domoticz version: L stab
Location: Belgium
Contact:

Someonehome

Post by Lebo2d9 » Monday 08 January 2018 16:41

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
Domoicz on RPI3 (wifi) directly connected 3x ds18b20 for CV temp, Evohome (9 zone), 1 remote 220V switch based on ESP-12. RFXtrx433E, 16x AMST-606, 5 Somfy RTS motors
Domoticz on RPI3(wifi) as slave for terraruim control
More to come

triton
Posts: 15
Joined: Monday 03 April 2017 15:01
Target OS: Linux
Domoticz version: 4.9701
Location: Netherlands
Contact:

Re: Someonehome

Post by triton » Monday 08 January 2018 17:04

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?

User avatar
emme
Posts: 847
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Someonehome

Post by emme » Monday 08 January 2018 17:05

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
The most dangerous phrase in any language is:
"We always done this way"

febalci
Posts: 327
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Someonehome

Post by febalci » Monday 08 January 2018 18:46

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:pass@192.168.1.90:8084/json.htm?type=command&param=setactivetimerplan&ActiveTimerPlan=4" &')
            commandArray['Variable:Family Presence'] = 'Home'
            print("Family is Home")
        end
    else
        os.execute('curl -s "http://user:pass@192.168.1.90:8084/json.htm?type=command&param=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.

Lebo2d9
Posts: 147
Joined: Tuesday 06 September 2016 20:39
Target OS: Raspberry Pi
Domoticz version: L stab
Location: Belgium
Contact:

Re: Someonehome

Post by Lebo2d9 » Tuesday 09 January 2018 14:16

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:pass@192.168.1.90:8084/json.htm?type=command&param=setactivetimerplan&ActiveTimerPlan=4" &')
            commandArray['Variable:Family Presence'] = 'Home'
            print("Family is Home")
        end
    else
        os.execute('curl -s "http://user:pass@192.168.1.90:8084/json.htm?type=command&param=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
Domoicz on RPI3 (wifi) directly connected 3x ds18b20 for CV temp, Evohome (9 zone), 1 remote 220V switch based on ESP-12. RFXtrx433E, 16x AMST-606, 5 Somfy RTS motors
Domoticz on RPI3(wifi) as slave for terraruim control
More to come

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests