Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team
Search the Community
Showing results for tags 'presence detection'.
-
BLE Detector v1.2.zip HC3_iNode_-_BLE_Users_2.0.fqa I recently came up with an idea to keep track of each resident presence with Bluetooth devices they keep taking with them. To achieve that I bought iNode LAN device, which can bring BLE devices into existence in Ethernet network. The idea was not really that... fresh as I thought. Just see here. But I definitely didn't want to use any other pieces of equipment. And this post is about how to get all these things work together (HC2 + iNode LAN) with full source code attached. What you need (except your HC2): iNode LAN - it can detect any Bluetooth 4.0/4.1 device (Bluetooth Low Energy = BLE) BLE tag (iNode Beacon , TrackR , notiOne , etc.) Remarks about the list above: Instead of iNode LAN, you could buy an extended version iNode LAN Duos, but I don't recommend that. Why? The "Duos" version has equipment for both BLE and Bluetooth 2.1 so that you could detect older devices too. But these devices most probably will not be proper for the goal we want to achieve. Bluetooth 2.1 devices have shorter range and drain the battery much more quickly. If we use them for identifying persons we can experience more "flickering" about someone's presence (range issues). Moreover, changing the battery of a small device attached to a bunch of keys every few days or weeks (not months!) would make the solution too hard for maintenance. If we are going to stick to BLE devices, the "non-Duos" version is good enough. Instead of iNode Beacon you can use any device that you can carry with you. The device has to communicate via BLE, that's all. That might be your smartphone as long as you keep your Bluetooth ON all the time. What should you do: Configure your iNode LAN to use unicast or broadcast for sending datagrams (UDP packets) Go to the Setup page. For "BLE IP address" put your HC2 IP address (unicast) or broadcast address (192.168.1.255 e.g.) For "BLE IP port" you may leave the default value (20000). Create a new virtual device (BLE Detector). Update IP Address and TCP Port (use the same values as for iNode LAN in step 1). Create a new scene (BLE Users). Update config values in the scene (provide names and MAC addresses of persons and their belongings). That's all to make it work! Now you can use global variables you have defined in step "2-second-dot" to check if a person is away or home. Want to tweak it? Sure! There are more options. Please read all the comments in the source code. You may try to: define MACs of devices to ignore in discovery (your iNode LAN itself), define signal values for IN/OUT events (separately for each user), define the timeout value for each device (this also makes user away), turn on/off debug messages. What are these scripts missing? Only basic information is decoded from BLE datagrams (counter, MAC address, and signal strength). If you use iNode Sensors you will not get additional values (like temperature, pressure, magnetic or movement changes). Why is it better than other solution (x) of presence detection? It does not depend on any movement in your house, which can make many false positives - a running dog e.g. (x = motion sensors) It is independent of other devices. HC2 communicates directly with iNode LAN. (x = RaspberryPi to read iNode and press some virtual buttons in HC2) More stable results (x = python script from iNode website; explained below). The Python script published by iNode manufacturer for presence detection uses only signal strength. That means to detect that someone is leaving we need to use some (lower part) signal range to have the record of going away. This additionally reduces the signal range for detecting "being home" (higher part of the signal range) and can give effect to the person appearing and disappearing all the time. To avoid that we also check the latest timestamp of the device activity. Owing to this feature we may extend range signal for "being home" to all possible values, and use only timeout to decide whether a person is home or not (set "-100" to both signalIn and signalOut in users config to achieve that). A few more details. Here are some logs of the working device... [DEBUG] 23:29:58: No: 35216 MAC: 00:12:6F:E0:BB:DB Signal: -16 dBm [DEBUG] 23:30:03: No: 35217 MAC: C0:36:A0:DC:87:99 Signal: -79 dBm [DEBUG] 23:30:08: No: 35218 MAC: 00:12:6F:E0:BB:DB Signal: -16 dBm [DEBUG] 23:30:09: No: 35219 MAC: C0:36:A0:DC:87:99 Signal: -79 dBm [DEBUG] 23:30:12: No: 35220 MAC: C0:36:A0:DC:87:99 Signal: -69 dBm and the scene: [DEBUG] 23:30:21: MAC: C0:36:A0:DC:87:99 Signal: -79 (dBm) Time ago: 0 (sec) [DEBUG] 23:30:21: MAC: DF:12:45:F7:40:65 Signal: -84 (dBm) Time ago: 30 (sec) [DEBUG] 23:30:21: Gienia is home [DEBUG] 23:30:21: Zenek is home [DEBUG] 23:30:24: MAC: DF:12:45:F7:40:65 Signal: -84 (dBm) Time ago: 0 (sec) [DEBUG] 23:30:24: MAC: C0:36:A0:DC:87:99 Signal: -79 (dBm) Time ago: 3 (sec) [DEBUG] 23:30:24: Zenek is home [DEBUG] 23:30:24: Gienia is home For my configuration, I am using two pieces of notiOne. They are really tiny, the batteries are supposed to stay alive for about a year. Additionally, you can track them whenever someone with BLE and their App is near. The results I get in my flat, where walls are made of silicate blocks, are quite stable. iNode LAN can detect these notiOnes with the weakest signal (-90 to -88 dBm) from a distance of 7-8 meters even through two silicate walls (24cm + 12cm thick). So placing iNode LAN in the middle of the flat covers the whole area.
-
Version 1.2
62 downloads
Features The virtual device communicates with iNode LAN, receives and decodes information about all BLE devices available nearby. This allows tracking user presence if small BLE tags are attached to their belongings (like notiOne with a bunch of keys, e.g.). What you need iNode LAN - it can detect any Bluetooth 4.0/4.1 device (Bluetooth Low Energy = BLE) BLE tag (iNode Beacon , TrackR , notiOne , etc.) Installation Configure your iNode LAN to use unicast or broadcast for sending datagrams (UDP packets) Go to the Setup page. For "BLE IP address" put your HC2 IP address (unicast) or broadcast address (192.168.1.255e.g.). For "BLE IP port" you may leave the default value (20000). Create a new virtual device (BLE Detector). Update IP Address and TCP Port (use the same values as for iNode LAN in step 1). Create a new scene (BLE Users). Update config values in the scene (provide names and MAC addresses of persons and their belongings). That's all to make it work! Now you can use global variables you have defined in Lua scene (users variable) to check if a person is away or home. Want to tweak it? Sure! There are more options. Please read all the comments in the source code. You may try to: define MACs of devices to ignore in discovery (your iNode LAN itself), define signal values for IN/OUT events (separately for each user), define the timeout value for each device (this also makes user away), turn on/off debug messages. Zip file content Virtual device: "BLE Detector". Lua scene with user detection configuration: "BLE Users". Device icon for iNode LAN. FAQ What are these scripts missing? Only basic information is decoded from BLE datagrams (counter, MAC address, and signal strength). If you use iNode Sensors you will not get additional values (like temperature, pressure, magnetic or movement changes). Why is it better than other solution (x) of presence detection? It does not depend on any movement in your house, which can make many false positives - a running dog e.g. (x = motion sensors) It is independent of other devices. HC2 communicates directly with iNode LAN. (x = RaspberryPi to read iNode and press some virtual buttons in HC2) More stable results (x = python script from iNode website; explained below). The Python script published by iNode manufacturer for presence detection uses only signal strength. That means to detect that someone is leaving we need to use some (lower part) signal range to have the record of going away. This additionally reduces the signal range for detecting "being home" (higher part of the signal range) and can give effect to the person appearing and disappearing all the time. To avoid that we also check the latest timestamp of the device activity. Owing to this feature we may extend range signal for "being home" to all possible values, and use only timeout to decide whether a person is home or not (set "-100" to both signalIn and signalOut in users config to achieve that). What messages should I expect to get from working device? Here are some logs of the working device... [DEBUG] 23:29:58: No: 35216 MAC: 00:12:6F:E0:BB:DB Signal: -16 dBm [DEBUG] 23:30:03: No: 35217 MAC: C0:36:A0:DC:87:99 Signal: -79 dBm [DEBUG] 23:30:08: No: 35218 MAC: 00:12:6F:E0:BB:DB Signal: -16 dBm [DEBUG] 23:30:09: No: 35219 MAC: C0:36:A0:DC:87:99 Signal: -79 dBm [DEBUG] 23:30:12: No: 35220 MAC: C0:36:A0:DC:87:99 Signal: -69 dBm and the scene: [DEBUG] 23:30:21: MAC: C0:36:A0:DC:87:99 Signal: -79 (dBm) Time ago: 0 (sec) [DEBUG] 23:30:21: MAC: DF:12:45:F7:40:65 Signal: -84 (dBm) Time ago: 30 (sec) [DEBUG] 23:30:21: Gienia is home [DEBUG] 23:30:21: Zenek is home [DEBUG] 23:30:24: MAC: DF:12:45:F7:40:65 Signal: -84 (dBm) Time ago: 0 (sec) [DEBUG] 23:30:24: MAC: C0:36:A0:DC:87:99 Signal: -79 (dBm) Time ago: 3 (sec) [DEBUG] 23:30:24: Zenek is home [DEBUG] 23:30:24: Gienia is home Is it a stable solution? Can you share any experience about it? For my configuration, I am using two pieces of notiOne. They are really tiny, the batteries are supposed to stay alive for about a year (from my experience it was usually about 6 months). Additionally, you can track them whenever someone with BLE and their App is near. The results I get in my flat, where walls are made of silicate blocks, are quite stable. iNode LAN can detect these notiOnes with the weakest signal (-90 to -88 dBm) from a distance of 7-8 meters even through two silicate walls (24cm + 12cm thick). So placing iNode LAN in the middle of the flat covers the whole area. My iNode LAN works with firmware version published in December 2017 ("FW date: Dec 14 2017/09:10:32"). I had no issues about it for more than 18 months right now. It is stable. I even use it as a power failure indicator: it is not plugged to UPS (whereas HC2 and NAS are), so when the device disappears from my LAN, I know there is something wrong with the power line. Is there any way to extend Bluetooth range for iNode LAN? My house is too large for a single device of that kind. Well, the device range is connected to Bluetooth limitations. If you need a larger area to be covered with BLE devices detection you could use more then one iNode LAN device. Each device should use a different global variable for storing detected BLE events (BleDevicesA, BleDevicesB, ...). The best way to merge these results would be an updated Lua scene, which could analyze more variables and properly select best data (i.e. select stronger signal if the same BLE tag is seen in many iNode LAN devices). This is not supported with the current version of Lua scene. Another (not so nice, but quicker to achieve) workaround for that could be duplicating not only the BLE Detector VD but also the BLE Users scene. Each scene copy should have different global variables for users (like: isZenekHomeA, isZenekHomeB, ...) and additional code can interpret these variables to get final detection value (local isZenekHome = isZenekHomeA or isZenekHomeB or ...)