Jump to content
  • Announcements

    • T.Konopka

      DOWNLOADS - new way of sharing solutions!   01/17/18

      Dear users, We want you to have a great time here on the Forum, therefore, we are introducing a new tool for sharing solutions! DOWNLOADS - a system of file sharing for all of you. DOWNLOADS - support topics - this is a new category for support topics. Check the short guide for Downloads on how to add a solution (all files have to be approved).   Crowd's Solutions will be closed for new submissions, but still open for replies in remaining topics. We ask the authors of the solutions to add their solutions to Downloads with the link to the topic at the top of the description. We will merge the support topic with the one from Crowd's Solutions.   If you have any questions, feel free to ask our administrators - @T.Konopka and @I.Srodka!
    • T.Konopka

      DOWNLOADS - nowy sposób dzielenia się rozwiązaniami!   01/17/18

      Szanowni użytkownicy, Chcemy, abyście świetnie spędzali czas na Forum, dlatego przedstawiamy wam nowe narzędzie do dzielenia się rozwiązaniami! DOWNLOADS - system dodawania i pobierania plików. DOWNLOADS - support topics - to jest nowa kategoria z tematami wsparcia. Sprawdźcie przewodnik dla Downloads, aby wiedzieć jak dodać rozwiązanie (wszystkie pliki muszą zostać zatwierdzone).   Rozwiązania Społeczności zostaną zamknięte dla nowych tematów, jednak tematy już wczęśniej dodane będą nadal dostępne. Prosimy autorów rozwiązań do przenoszenia ich do Downloads - prosimy o dodanie linkiem do tematu na górze opisu. Połączymy wtedy temat wsparcia z tematem z Rozwiązań Społeczności.   W przypadku pytań, prosimy o kontaktowanie się z administratorami - @T.Konopka and @I.Srodka. (Rozwiązania mogą być dodawane w języku polskim!)

[TUTORIAL] Presence detector - iNode LAN + any BLE gadget (and no more devices)

Recommended Posts


Please login or register to see this attachment.

Please login or register to see this attachment.


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

Please login or register to see this link.

. 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):

  1. Please login or register to see this link.

     - it can detect any Bluetooth 4.0/4.1 device (Bluetooth Low Energy = BLE)
  2. BLE tag (

    Please login or register to see this link.


    Please login or register to see this link.

    Please login or register to see this link.

    , 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:

  1. 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 ( e.g.)
  2. Go back to your HC2 and:
    • Create a new global variable for storing BLE events (BleDevices).
    • Create a new global variable for each person to be tracked.
  3. Download two files attached to this post.
  4. Create a new virtual device (BLE Detector). Read detailed steps inside the source code.
  5. Create a new scene (BLE Users). Again - read steps inside the source code.
  6. 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 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...

Please login or register to see this code.

and the scene:

Please login or register to see this code.


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.


Edited by macjoker
  • Like 1
  • Thanks 1

Share this post

Link to post
Share on other sites

Hi, thanks for you great work!


The presense detection is very convinient for home automation. But BLE is small range cover, somtimes my BLE smartwatches disconnecting from mobile when i go other room.

So, this is definatley NOT suitable for a big house.


I guess, the WiFi is better for this. But I have not seen ready solution for Fibaro. There is homebridge-people plugin I have tested for the Apple HomeKit and it works fine (for me)

It works this way: there is an array of people (actually host ip addresses) preconfigured, each host shows as presense sensor inside HomeKit.

It starts ping loop for every host and breach the sensor when it cross detection threshold.


If someone knows equal solution for the Fibaro, let me know, please



Share this post

Link to post
Share on other sites

I have an issue with the scense. When I try to run it I get an error. I have set BleDevices as Predefined Variable as Table (I will get the following error if I just put it as a regular variable [ fatal] Unknown exception: /opt/fibaro/scenes/41.lua:93: bad argument #1 to 'pairs' (table expected, got number)



Please login or register to see this code.

What else I miss?

The other variables (for example isZenekHome) what type they have to be? Do I need to insert the ip address/port of the inode device on the VD? Does it work on different subnets?

Please Help!


Share this post

Link to post
Share on other sites

it worked! it seems that there is another "hardware" limitation. iNode LAN has limited coverage on a house so it is not good for everyone. I wonder if we can increase coverage adding multiple iNode devices or even better hack the antenna. 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now