How would you do something like a SmartSense Presence sensor



  • Could it be as simple as publishing a binary switch type device, and carrying the radio around with you, and when it gets within range of the gateway it triggers a scene with the appropriate luup coding to let it know who is home?


  • Mod

    @gbfromhb Yes, it could be that simple 😉

    Keep security in mind, though (I wouldn't unlock your door automatically, if I were you)



  • How would you approach it?


  • Hero Member

    @gbfromhb said:

    How would you approach it?

    If you want something secure I would opt for a challenge-response system:

    • Key sends message that is received by gateway
    • Gateway sends random number back
    • Key receives random number and applies a crypto algorithm with key on it and sends the output back to the gateway
    • Gateway does do the same with that random number and compares the outcome with what it received from the key

    For the crypto algorithm you can think of a hash algorithm like MD5 (not really secure anymore) or SHA-1. Just feed it with the random number of some ĭt sequence (key) shared between the key and gateway.


  • Contest Winner

    @gbfromhb

    At what range are you looking to be detected?

    your question made me think that you may want to use an arduino beacon attached to a car or a person or a pet, pulsing out "Hey I'm close".

    I would think that those could be rolling numbers, transmitted and processed by vera with Lua or PLEG. You could then look for the timestamp of the last update. If the update times out, presence is lost.

    Is that something like you want?

    Security is an issue if you are unlocking your house, but you can still do fun stuff with that approach, like getting it to work whilst you investigate a suitable way to secure the radio. (i.e. a secure radioset that you can use point-to-point and integrate the 'receiver station' with your MySensor network).



  • @BulldogLowell, yes this is what I'm thinking about. I saw that Samsung was thinking about buying SmartThings. After going through their website I saw their Presence Sensor, and was intrigued. Here is a link to there product. https://shop.smartthings.com/#!/bundles/i-can-know-whos-home-when-im-not

    It looks like it may sense presence as they connect to the house's WiFi would be my first guess.. If you have their smart phone app, it can also be configured to notify their hub you are home also.


  • Contest Winner

    @gbfromhb

    So, there is the iPhone locator on the Vera MiOS marketplace, along with the Ping app that can sense your mobile device as it connects to your router.

    You could put a WiFi module on an Arduino and use the ping app... just have to use MAC address filtering, which is reasonably secure.

    GPS/GSM combination might get you there too,

    I think that there are a few approaches that you can explore with Arduino and MySensors...


  • Admin

    Should be pretty simple to archive a presence sensor using a node that sends a value every X second.
    In 1.4 you will have an option to disable parent-auto-searching which makes this presence sensor much simpler and reliable to implement.

    https://github.com/mysensors/Arduino/commit/104fb4c35f0be8c6aa5a6877c72c9a370dab8646



  • @hek thank you. So I see it in the constructor, but what do I pass. I'm guessing the IODevice Varable from the MySensors Plugin device?


  • Admin

    @gbfromhb

    You pass the node id of the closest (repeater node) or the gateway itself (0).

    So if you for instance have a repeater node out at the gate (i.e. node 2) you can create a mobile node in your car where you initialize node 2 as your static parent.
    The car node will try to send a message to controller each 5-10 second. Normally you're our driving back and forth to your mother-in-law and the car node won't reach node 2. And by statically initializing the parent it will not try to find a new parent like normal nodes does.

    But once you reach your gate/home it will successfully transfer a message through node 2 back to your gateway/controller. And your controller will open the gate automatically.


  • Hero Member

    I was thinking about this too...i think i also posted here or micasaverde or whirlpool forum about it...

    My thoughts are to use some of these types of "ibeacon" tags
    http://www.phonecruncher.com/features/2227173/chipolo_vs_tile_vs_sticknfind_battle_of_the_bluetooth_finders.html There are loads of these types of devices out there... i have some trackr.com tags on the way...another drunken purchase 😉

    Anyway, each person in the house wears/carries one. ( personally id love to be able to embed one under skin...but unbelievably low WAF when mentioned!!!)

    And in each room, i have a mySensors device with a BLE "receiver" reporting back who's in the room etc.

    Why do this?

    • its my hobby....
    • so lights turn off when the kids leave them on!!!!! "how many times do i need to ask??!!!
    • activate alarm when everyone has left ( doors already lock automatically - little interest in unlocking)


  • @hek Thank you.



  • I've always thought the easiest way to do this would be to detect people's smartphones on the WiFi network...almost everyone already has one and already connects to the WiFi network.

    I've seen it discussed before but no one has really proposed any implementations from what I've seen - any ideas? Wouldn't this be easier?


  • Mod

    @naveen as long as you plan to give everyone in the household a mobile phone with WiFi (including the kids, dogs, cats, etc 🙂 ) this should be relatively easy.
    E.g. give the phones a static IP and ping these ip's continuously from a server. When the ping returns, the person is in.
    The OP also wanted to track people in the house which will be a lot harder using Wi-Fi.



  • @Yveaux

    Ah good point!

    Any idea how to implement (or begin to implement) pinging the phone IP and recognizing that on vera? Can you ping in lua code?

    Actually, I may have answered my own question with this:
    commandArray = {}

    ping_success=os.execute('ping -c1 192.168.1.156')
    if ping_success then
      print("ping success")
      commandArray['Ping']='On'
    else
      print("ping fail")
      commandArray['Ping']='Off'	
    end
    
    return commandArray
    

    And then just set the output of the code to change the state of a home/away switch


  • Mod

    @naveen I can ping in any code 👍
    Anyway, maybe you should make it a bit more robust. Now when a single ping fails your lights will go off, so to say.
    Test for a number of successive failures before concluding someone went away. Detecting presence can be done from a single successful ping.


  • Hero Member

    Just thought I would mention that there is a Ping sensor plugin available for Vera incase you did not know. It should have all needed features for occupancy sensing.

    http://apps.mios.com/plugin.php?id=1228



  • @korttoma said:

    Just thought I would mention that there is a Ping sensor plugin available for Vera incase you did not know. It should have all needed features for occupancy sensing.

    http://apps.mios.com/plugin.php?id=1228

    Awesome, thanks! I will try it out.

    Quickly realized that the iPhone won't connect when in sleep mode, so its not really a good home/away detector.


Log in to reply
 

Suggested Topics

  • 8
  • 1
  • 7
  • 1
  • 1
  • 2

57
Online

11.4k
Users

11.1k
Topics

112.7k
Posts