Global event for any state change

Posted on
Sun Jul 10, 2016 2:40 am
jh71283 offline
Posts: 127
Joined: Jun 16, 2014

Global event for any state change

Hi all

I'm developing a database for the state of my devices over time (After all, how smart is a house if it doesn't remember anything?)

At the moment I have a python script that runs every 15 secs and posts every state of every device to my web service.

As you can imagine, that's both massively inefficient, and not granular enough. If a door sensor opens and closes in between that 15 sec interval, it will never be recorded in the DB.

Ideally, what I would like is a way to run a script when *any* device's state changes, as long as I can also find out which device / state changed :)

Can anybody suggest how this can be achieved?

Thanks!

Posted on
Sun Jul 10, 2016 4:04 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Global event for any state change

Head to this page and have a look at the subscribeToChanges() method.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sun Jul 10, 2016 8:16 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Global event for any state change

If you run sqllogger ALL that info is in the database
Why do you need another database?


Sent from my iPhone using Tapatalk

Posted on
Sun Jul 10, 2016 9:38 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Global event for any state change

Karl's correct - the included SQL Logger plugin does this.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Jul 10, 2016 11:46 am
jh71283 offline
Posts: 127
Joined: Jun 16, 2014

Re: Global event for any state change

Darn it!

I wish I has asked this question before spending my weekend coding!

LOL!

Posted on
Sun Jul 10, 2016 6:41 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Global event for any state change

And from experience : use Postgres much more robust and scalable than SQLite


Sent from my iPhone using Tapatalk

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest