[userModule] Presence Switch (Updated 2016/04/20)

Tips, Tricks and Scripts to enhance your home automation and workaround known device bugs, limitations and incompatibilities
maros
Posts: 103
Joined: 05 Apr 2014 11:21

[userModule] Presence Switch (Updated 2016/04/20)

Post by maros » 26 Oct 2015 16:45

This module creates three virtual devices that display/store the current presence state. The module handles
  • Home vs. Gone
  • Vacation
  • Day vs. Night
This information can then be used by other modules to create smart automation rules (eg. thermostat operation modes based on presence status) Whenever presence modes are switched an event will be emitted. Day/Night can be switched either manually, or by adding a time by which the switch should happen automatically.

Based on this information a presence mode is calculated.
  • Home (Home during daytime)
  • Night (Home during nighttime)
  • Away (Away - both day and night)
  • Vacation (Prolonged absence - both day and night)
The events produced by this module can be caught and processed by the EventWatcher module. Furthermore the Thermostat Control module uses the presence modes to calculate the current heating setpoints. The Condition Switch module can be used to switch devices based on presence.

Tested with Z-Way version v2.2.2
Bug/Issue tracker at https://github.com/maros/Zway-Presence/issues
Documentation at https://github.com/maros/Zway-Presence/ ... /README.md
Download at https://github.com/maros/Zway-Presence/releases

Installation can be done directly via git or via the the Zway App-Store. Install the BaseModule first.
Last edited by maros on 12 Jul 2016 00:46, edited 8 times in total.
Z-Way 2.2.4 on Raspi B | My Zway GitHub repos | Amazon Wishlist to support module development

TritonT
Posts: 9
Joined: 16 Oct 2015 19:13

Re: [userModule] Presence switch (Updated 2015/11/03)

Post by TritonT » 23 Nov 2015 16:53

I was thinking of a way to do Presence reliably. Previously before moving to Z-Way I had used Tasker to switch presence to 'In' when one of the RFID tags that I have stuck to each door was tapped. This didn't work well as people forget to tap 'in' and 'out'. Next I tried Tasker message based on GPS location, this worked better, but normally lags by a few minutes and some phones just don't do it reliably.

The best seems to be presence based on whether the phone is on the local wifi. I have done a quick test using arpscan and it seems to work well against all the phones I have tried. I have just been running arpscan as a cron job and checking the result. Best of all it requires no interaction from the user and nothing to run on the phone.

So if you were thinking of expanding Presence module would you consider adding arp. The module would need to accept name / MAC address pairs and then check if any of the MAC addresses are present via arpscan, with another entry for frequency of scan.

It has been incorporated by a few other automation systems eg DomotiGa https://www.domotiga.nl/issues/527

I used this method for testing. http://superuser.com/questions/493003/h ... on-the-lan

Thanks for all the modules by the way. They have really helped me move to Z-Way.

maros
Posts: 103
Joined: 05 Apr 2014 11:21

Re: [userModule] Presence switch (Updated 2015/11/03)

Post by maros » 23 Nov 2015 17:40

Yes, that's a good idea. However I'd rather create a separate module than include it in the current presence module. I want to keep the installation process of core components (such as the presence switch) very simple and avoid any third party dependencies (for arp support you'd need to mangle .syscommands , install arping, arp-scan ...)
Z-Way 2.2.4 on Raspi B | My Zway GitHub repos | Amazon Wishlist to support module development

Gorilla
Posts: 14
Joined: 03 Jan 2015 23:47

Re: [userModule] Presence switch (Updated 2015/11/03)

Post by Gorilla » 04 Dec 2015 12:33

Hi Maroš,
I like your modules, do you have a blog entry or Manual of your configured System that describes how you connect all your modules to e.g. a security System?

maros
Posts: 103
Joined: 05 Apr 2014 11:21

Re: [userModule] Presence switch (Updated 2015/11/03)

Post by maros » 04 Dec 2015 20:51

not yet, since most of the modules are sill in heavy development and since vital parts are still missing (not yet released). I'll come up with a guide once things start settling
Z-Way 2.2.4 on Raspi B | My Zway GitHub repos | Amazon Wishlist to support module development

cbnidk
Posts: 17
Joined: 14 May 2015 11:25

Re: [userModule] Presence switch (Updated 2015/12/27)

Post by cbnidk » 29 Jan 2016 17:02

Hi

I am on 2.2.0 and I can't Presence to Work, the install goes wrong an error and the module will not start
any one that can help
:01 | Failed to load module because dependency was not instanciated: [DEP]::[MODUL] = BaseModule :: Presence

cbni

maros
Posts: 103
Joined: 05 Apr 2014 11:21

Re: [userModule] Presence switch (Updated 2015/12/27)

Post by maros » 29 Jan 2016 20:13

Please follow the installation instructions and install and instantiate BaseModule first
Z-Way 2.2.4 on Raspi B | My Zway GitHub repos | Amazon Wishlist to support module development

cbnidk
Posts: 17
Joined: 14 May 2015 11:25

Re: [userModule] Presence switch (Updated 2015/12/27)

Post by cbnidk » 29 Jan 2016 21:57

hi
I have now downgrade to 2.1.1, but I have an issu with instal the basemodule
{
"moduleName": "MyModule",
"dependencies" : ["BaseModule"],
can someone tell me where I set this in module.jons in the end or

cbni

bralez
Posts: 4
Joined: 04 Jan 2016 12:09

Re: [userModule] Presence switch (Updated 2015/12/27)

Post by bralez » 17 Feb 2016 17:09

Hi everybody,
I had the same error in 2.2.0, but after a debug session I have solved with a small patch in the module.json of BaseModule:

change these lines

Code: Select all

"options" : {},

"schema" : {},
in

Code: Select all

"options" : {
    "fields" : {}
},

"schema" : {
   "properties" : {}
},
then it's fundamental to "Add App" BaseModule first and after the PresenceModule.

The 404 error that I receive was in postModule of AppModuleAlpacaController:

Code: Select all

          if (!$filter('hasNode')(formData, 'options.fields') || !$filter('hasNode')(formData, 'schema.properties')) {
               $location.path('/error/404');
                $scope.alpacaData = false;
                $scope.loading = false;
                return;
            }
I hope it's useful.

Ciao
Alex
Last edited by bralez on 17 Feb 2016 17:57, edited 1 time in total.

bralez
Posts: 4
Joined: 04 Jan 2016 12:09

Re: [userModule] Presence switch (Updated 2015/12/27)

Post by bralez » 17 Feb 2016 17:12

... and thanks to maros for these modules (Presence, SecurityZone, EventWatcher and ConditionSwitch) :D

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests