nice way to work with home presence detection

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Eugene
Posts: 33
Joined: Wednesday 21 December 2016 19:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

nice way to work with home presence detection

Post by Eugene »

hi guys,

I am quite new to domoticz - so far i was using it for a year only for heating control and for couple of switches. All devices i have were triggered or configured only via default domoticz GUI config (like set temperature on time, switch on/off socket on time, etc).

recently got couple of PIR sensors and started playing with lua scripts to switch on/off lights based on detected motion.

Now I am thinking about making presence detection at home to shutdown lights and heating if no motion detected for 12 hours for example. I clearly see how i can make it with lua scripts however I can't imagine how lua scripts can co-exist with time based actions in domoticz GUI.

Do I understand right that all time based settings in GUI i should replace with settings applied from lua scripts? or is there a way where both (GUI and scripts) can co-exist without making the setup extremely complicated to manage?

thanks
ronnyandre
Posts: 7
Joined: Monday 02 January 2017 10:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Oslo, Norway
Contact:

Re: nice way to work with home presence detection

Post by ronnyandre »

They can coexist, however this will be messy and there will be multiple places you have to edit your events. I would definitely keep to the Events system (LUA/dzVents) rather than timers.
Newbie just started with Domoticz and home automation.
User avatar
Egregius
Posts: 2589
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: nice way to work with home presence detection

Post by Egregius »

That's quite easy in pass2php.
I also do that:
If all the lastupdate timestamps of the pirs are more than 4 hours ago the house goes into sleep mode.
If they're all more than 12 hours ago the house goes into away mode.

In pass2php it's easy to see all the current statusses and their timestamp. Just loop thru a array and it's done:

Code: Select all

<?php
if(past('pirliving')>14395&&past('pirgarage')>14395&&past('pirinkom')>14395&&past('pirhall')>14395&&past('Weg')>14395&&$Weg==0){apcu_store('Weg',1);telegram('Slapen ingeschakeld na 4 uur geen beweging',false,2);}
if(past('pirliving')>43190&&past('pirgarage')>43190&&past('pirinkom')>43190&&past('pirhall')>43190&&past('Weg')>43190&&$Weg==1){apcu_store('Weg',2);telegram('Weg ingeschakeld na 12 uur geen beweging',false,2);}
My script also detects when the last 'home' status is set (Weg), that timestamp gets updated whenever I push one of the buttons of a minimote that I use to control my media. So, the house only goes into sleep mode if no movement is detected and I didn't do anything on my media for 4 hours.
Eugene
Posts: 33
Joined: Wednesday 21 December 2016 19:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: nice way to work with home presence detection

Post by Eugene »

Thanks, Gentlemen for your thoughts.

ronnyandre, thanks for confirming that approach i have in mind will be the less messy one (not to mix timers and scripts, go scripts only)

Egregius, i have similar logic in mind but with PIR sensors and hopefully i will deliver it with LUA scripts (i am not big fan of PHP :) )

Thanks
Eugene
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests