mother discussion

Posted on
Wed Apr 15, 2015 11:23 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

mother discussion

I have a Mother-device+4 cookies https://sen.se/store/mother/ up and running and can publish the device/sensor data in an indigo device in a plugin.

I would need some feedback on how to design this:

Some constraints you should be aware of.
1. you need to apply as a developer to get access to your information: https://sen.se/developers/register/
2. all data goes to a web server and must be picked up from there. No direct access to the mother device.
3. turn around time for a request to the web server is about 1 second
4. the "cookies" have sensors for temperature/ movement + state "connected" + signal strength. from that the web server calculates several states like how much time has been active, how was sleep and presence/ absence etc
5. the time to go from present (i.e. the mother device gets signals from the cookies) to absent takes about 3 minutes
6. the time its needs to go from absent to present is about 5 to15 seconds.
7. There is a maximum of 100 requests per minute
8. there is unfortunately not a single webpage that delivers all data. It is a complicated structure /User/cookie/sensor/data one has to traverse.

I can "easily" setup the following:

per sensors for each cookie
- temperate / timestamp of last change
- movement / timestamp of last change
- present/absent/ timestamp of last change
- signal streng for each data point


It would likely not make sense to poll temperature every second - ~ 1/ minute is likely enough.
For the other two a 2 second poll interval would be the fastest doable
!!! But if you have 4 cookies, and each cookie/sensor takes 1 seconds round trip to get the data from the server the fastest polling time is 8 seconds per cookie& sensor.
That would send a data request to the web server every second.

any comments / suggestions welcome.


Karl

Posted on
Wed Apr 15, 2015 11:31 am
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: mother discussion

all data goes to a web server and must be picked up from there. No direct access to the mother device.

Man, if I were using or considering those, I would be very tempted to sniff the communication to its home server just in case it sends the updates in a JSON or similar format. In that case you could potentially just redirect it to instead send directly to your Indigo box and bypass their servers as well as any polling (without Mother knowing).

Of course, depending upon their embedded software this may or may not be possible -- but would be relatively easy to try most likely.

Adam

Posted on
Sat Apr 18, 2015 4:00 am
Nine offline
Posts: 78
Joined: Feb 15, 2015
Location: Zurich, Switzerland

Re: mother discussion

Great job Karl!!! :D

I do have to following issues:

  • [fixed in 0.3.2] If I rename a cookie in Indigo, I can not change any device settings: "Error validating fields...."
  • [fixed in 0.3.2] Triggers: There is a 'mother event' called 'Device is back home': how can I set which cookie to track? I do have one cookie for every family member...
  • [fixed in 0.3.2] My log is spamed with: "data file not present/users/indigo/documents/mother/big iceBattery and .../big iceMotion Seems like the plugin has some problems with these two cookies. My other cookies works great! 'Disable Indigo communication' for these two cookies does not affect anything :?
  • Indigo shows only my first 4 cookies. Number 5 and 6 (used as sleep-tracker) aren't listed in Indigo.

Nine
Last edited by Nine on Sat Apr 18, 2015 4:49 am, edited 1 time in total.

Posted on
Sat Apr 18, 2015 4:29 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: mother discussion

for the blank names see new download .. use 0-3-2!!

as for the trigger see:
Screen Shot 2015-04-18 at 5.27.17 AM.png
Screen Shot 2015-04-18 at 5.27.17 AM.png (26.82 KiB) Viewed 7858 times


setup 2 triggers for each cookie (away / home)

use 0 for away and 2 for present

Karl

Posted on
Sat Apr 18, 2015 4:31 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: mother discussion

as for the missing #5 and #6 that requires paging the returned results .. = not all data comes down in one query .. have to do several pages to get all, then combine into one json object .. will take a day.

when you download 0-3-2 please delete the indigo devices first. they will be recreated automatically.

Karl

Posted on
Sat Apr 18, 2015 4:43 am
Nine offline
Posts: 78
Joined: Feb 15, 2015
Location: Zurich, Switzerland

Re: mother discussion

kw123 wrote:
for the blank names see new download .. use 0-3-2!!

as for the trigger see:
The attachment Screen Shot 2015-04-18 at 5.27.17 AM.png is no longer available


setup 2 triggers for each cookie (away / home)

use 0 for away and 2 for present

Karl



Great :D

"Presence" is called "Presence_data" on my Indigo:

Bildschirmfoto 2015-04-18 um 12.41.31.png
Bildschirmfoto 2015-04-18 um 12.41.31.png (65.85 KiB) Viewed 7858 times

Posted on
Sat Apr 18, 2015 10:20 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: mother discussion

I changed that one in the new version, but it is active only for newly created devices.

funktioniert der Rest? Ich habe noch nicht die üä probiert..


you can check the hone/away process to the trigger by removing the battery from the cookie .. after ~ 3 minutes mother thinks you are gone. then put back the battery and after ~ 15 seconds it should go to home.

Karl

Posted on
Sun Apr 19, 2015 1:40 am
Nine offline
Posts: 78
Joined: Feb 15, 2015
Location: Zurich, Switzerland

Re: mother discussion

I do get this error in the log:

Code: Select all
  mother                          in Line '288' has error=''key Motion_queryWait not found in dict''


In addition: if I already have a device in Indigo named like a cookie, your plugin seems to assing this cookie to my existing device: I don't get that additional cookie (#5 and 6), but if I rename my existing (philips hue-)device (adding a prefix LED), I see this in the log:

Code: Select all
Bett Simon                      indigoID: 1344603982,  indigoNAME: LED Bett Simon-
----Motion                      {'used': True, 'url': u'https://apis.sen.se/v2/feeds/.../events/', 'pid': '39355', 'queryWait': 10, 'ignore': False, 'fileDate': 1429428654.0, 'date': '2015-04-19 09:03:16', 'payload': '', 'lastSecond': 1429428526.647495}


How can I force mother-plugin to re-initiate alle cookies? That does not help:

Bildschirmfoto 2015-04-19 um 09.29.07.png
Bildschirmfoto 2015-04-19 um 09.29.07.png (26.15 KiB) Viewed 7781 times

Posted on
Sun Apr 19, 2015 7:43 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: mother discussion

the re- assemble does the following:
- query the sen.se web site for all cookies, then try to match to existing indigo devices.
If it has the cookie already in its config file, it tries to find an match in indigo: (a) indigo device # (b) indigo name or (c) cookie name. If it any of these match it assumes it is a cookie.
I will add to also match the device- model as a test not to match to existing other devices.

if no match it will try to create an indigo device with the name of the cookie.

To improve that I will add another test to see if cookie = indigo name but not the model create an indigo device with cookieName+"cookie", you then can change the indigo device name later.

As for the line 288 error . Either it is not a cookie device or the state name in your cookie device is wrong: delete the indigo cookie device and re-assemble. the Indigo device will be recreated with the proper state name

give me 1/2 a day. should be fixed this evening.

Karl

Posted on
Sun Apr 19, 2015 10:13 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: mother discussion

Simon,

try version 0.5. It should fix your problems

Also if you want to erase things i.e. start from scratch:
- disable the "thePlugin" (*)
- delete directory ~/documents/mother
- you might want to delete the INDIGO cookie devices too.

and enable thePlugin

Karl

(*) I should have used a different name for this. (thePlugin = mother)

Posted on
Sun Apr 19, 2015 10:23 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: mother discussion

for Presence states:

it looks as if there a t least 3 states:

1. Presence= 0 Presence_String={u'body': u'Absent', u'code': 404} = away
2. Presence = 1 Presence_String= {u'body': u'Present, not linked', u'code': 201} = inbetween may be weak signal
3. Presence = 2 Presence_String = {u'body': u'Present', u'code': 200} = home

If you want to use this in your trigger. you can see the information in your log file if you set loglevel to DEBUG DATAREAD

Don't yet understand =1

Posted on
Sun Apr 19, 2015 10:38 am
Nine offline
Posts: 78
Joined: Feb 15, 2015
Location: Zurich, Switzerland

Re: mother discussion

kw123 wrote:
Simon,

try version 0.5. It should fix your problems

Also if you want to erase things i.e. start from scratch:
- disable the "thePlugin" (*)
- delete directory ~/documents/mother
- you might want to delete the INDIGO cookie devices too.

and enable thePlugin

Karl

(*) I should have used a different name for this. (thePlugin = mother)


Karl,

funktioniert hervorragend. Herzlichen Dank für deine grossartige Arbeit!!!

Needed to delete everything and restart from scratch – but now it's working perfectly. Thank you for your great job!

Next step is trying to integrate my cookies, which are tracking my sleep.... as long as I am in bed, my 'night'-mode should be active 8)

Simon

Posted on
Sun Apr 19, 2015 1:38 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: mother discussion

question:

currently the timestamp Presence_date is the timestamp of the last communication from cookie to mother to sen.se called the lastEvent.

Question: should we add for presence (and others) a timestamp when the value last changed ie when did we come home/leave OR when did the cookie last communicated (which is how it is now)

You might want to see when was last communication AND when was the last status change!

any comments?

Karl

Posted on
Sun Apr 19, 2015 2:08 pm
Nine offline
Posts: 78
Joined: Feb 15, 2015
Location: Zurich, Switzerland

Re: mother discussion

Would be nice Karl.
I'm using a variable for that :-)


Gesendet von iPhone mit Tapatalk

Posted on
Sun Apr 19, 2015 7:40 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: mother discussion

Soon


Sent from my iPhone using Tapatalk

Who is online

Users browsing this forum: No registered users and 1 guest

cron