My dodgy logic :)

Posted on
Fri Aug 29, 2014 8:56 am
evansgo offline
Posts: 223
Joined: Nov 29, 2013

My dodgy logic :)

I'm trying to do something that is pretty simple, but I think I am making it MUCH more difficult than it really is.
Currently it is sort of working, but it has loads of steps, triggers etc and isn't easy to add a new person, so I was wondering if some kind person could unknot my logic and probably do what I want to do in a much neater way.

All I want is some proximity detection.

Four users (using fingscan) and I want to set variable for users1 to 4 as soon as they arrive home, and set them to false 15mins after they leave. Easy so far.
I also want to set true or false a variable 'isHome' if all of my users leave., the problem I have is that I have had to write this four times in order to get the triggers - that in itself isn't so bad, but the last two of my users change all the time, so I need to be able to amend them nice and simply and not in lots of different places.

Hopefully that all makes sense.... :D
Thanks
Gareth

Posted on
Fri Aug 29, 2014 10:48 am
jay (support) offline
Site Admin
User avatar
Posts: 18261
Joined: Mar 19, 2008
Location: Austin, Texas

Re: My dodgy logic :)

What you really need is a Device Group like mechanism but for FING devices. Maybe Karl could add a new device type that's a collection of FING devices (FING group?) that could be configured to go ON when any or all devices in the group are home.

I don't use the FING plugin at the moment so I'm just shooting in the dark, but it seems like it would be a very handy construct to add to the plugin.

Aside from that - you're going to have to build a state machine yourself. You may have done it already. I would do it in one script then fire that script every time one of the devices changes (so one trigger for each). The script would then go through the list of devices, determine if any are home and if not set your isHome variable to "false" otherwise set it to "true". I'm sure there are plenty of other ways as well, that's just how I'd do it off the top of my head.

Rather than one trigger per device, you could just have your script stay open and just poll devices periodically. Then you'd just need one trigger that fires on server start that starts up the script (make it a script file so it can run forever).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Aug 29, 2014 12:53 pm
FlyingDiver offline
User avatar
Posts: 7265
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: My dodgy logic :)

Something like this should work. I haven't actually tested it, but...

1. Set up a trigger for each fingscan device that you want to track. Have the trigger activate on any state change. Have the action write a timestamp to a variable. Same variable for each device. Set a specific variable that that device to true/false depending on home/away status.

2. Set up a trigger that activates any time the variable in step 1 changes. This will run any time any of the users' states changes. Use conditionals to make sure all the states are away, then set your variable and trigger any actions.

That should work for immediate actions on any home or all away. Delaying the away by 15 minutes would mean putting a delay in the actions for that step.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Aug 29, 2014 1:22 pm
kw123 offline
User avatar
Posts: 8392
Joined: May 12, 2013
Location: Dallas, TX

Re: My dodgy logic :)

JAY: fingscan does exactly that, you can create an event that can be used to triggers if all of 1...5 devices are HOME or AWAY, you can set timing of how much delay, wait etc...

see included PDF file for details.

[EDIT] for figscan:
home event triggers if ONE device is home
away event triggers if ALL devices are gone.

I guess this is what you want?
or do you want to have something where ALL devices must be home. that currently is not included, but should not be difficult. could do it early next week.

changing a device as part of the trigger is not too difficult: go into configuration and change the device you like to replace, rest should not change.
(max number of devices per event definition is 5)

Posted on
Fri Aug 29, 2014 1:44 pm
jay (support) offline
Site Admin
User avatar
Posts: 18261
Joined: Mar 19, 2008
Location: Austin, Texas

Re: My dodgy logic :)

Thanks Karl, I suspected that you'd already thought about that.

Gareth: does that work for you?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Aug 30, 2014 1:33 am
evansgo offline
Posts: 223
Joined: Nov 29, 2013

Re: My dodgy logic :)

All,

Thanks very much, I'd missed the 1 to 5 device option, I'll go read up.
I also like the time variable to trigger an event variation, I'd not thought of that, the combination of them should get it sorted nicely.

Thanks all

Gareth


PS Ah it turns out I was using an old version of fingscan (I had no PDF) I downloaded it from the indigo site and assumed! that that would be the most up to date version. I've now found the drop box link.

Posted on
Sat Aug 30, 2014 4:58 am
kw123 offline
User avatar
Posts: 8392
Joined: May 12, 2013
Location: Dallas, TX

Re: My dodgy logic :)

the latest version does not have the pdf attached.. I fixed an error while on the road.
==>download the version before that. It has the PDF attached. Then download the latest version for the plugin.

will fix when I am back home.

Karl

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 7 guests