How to check presence of Beacon ?

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

korniza
Posts: 157
Joined: Thursday 27 August 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6028
Location: Greece
Contact:

Re: How to check presence of Beacon ?

Post by korniza »

Still I have FHEM as prefered solution as it supports even more PRESENCE types (wifi, SNMP, BLE remote/local). it is 100% stable and memory footprint is so small. The delay is less than 3 sec!

The only issue is that community is german speaking so for people that do not understand German, google translate is their friend. :lol:
Also it did not read battery or button status of beacon which would be great to have.
>>>> Google Home <<<<<
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

Anybody out the that wouldn't mind helping me get started here? I just want to use the beacon to set to HOME and AWAY for myself and my wife.

I appreciate all the help
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise »

Micbou,

Describe a bit more your need. What do you want to do with this information ?

Because, you already have this information in uservariable.

If you succeed to install the system, you have done the most difficult.
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

jmleglise wrote:Micbou,

Describe a bit more your need. What do you want to do with this information ?

Because, you already have this information in uservariable.

If you succeed to install the system, you have done the most difficult.

This is what I want. When I (Tag_Michel with device IDX 23 ) am not home I want a switch to show AWAY and the same for my wife (Tag_Vanessa with device IDX 20). Obviously I'd like it to show 'HOME' when I am at home. When both me and my wife (Tag_Vanessa with device IDX 20) aren't in the house I want the alarm to trigger to 'AWAY'. Also when I come home I want a TTS switch to welcome me home with some news.

Is there a way to do this w/ Blocky? I have build 2 virtual switches, but they don't show an off and on state.


Thanks again for your patience and help...


To add: my log stopped working. When checking status I get

Code: Select all

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise »

If you want to go into alarm and TTS things, I advise you to start discover Lua. You 're going to struggle a bit several days, and then you will go much more far than with blocky.

However , that is a starting point in blocky :
blocky_presence.jpg
blocky_presence.jpg (25.88 KiB) Viewed 5147 times
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

jmleglise wrote:If you want to go into alarm and TTS things, I advise you to start discover Lua. You 're going to struggle a bit several days, and then you will go much more far than with blocky.

However , that is a starting point in blocky :
blocky_presence.jpg
thanks. Could you help me 1 step back and show me how to add the 'away' and 'home' status?
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise »

I don't undesrtand your question . What do you call away and home status ?
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

jmleglise wrote:I don't undesrtand your question . What do you call away and home status ?
in your blocky you state if the tags are "AWAY" the alarm goes on. How do I set the switch to "AWAY"

like in the wiki where can I get the uservariable from?

Image
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise »

- You create in domoticz manually 1 uservariable for each beacon.
- the python script update those uservariables accordingly of the presence of the beacons.
- you use those uservariables in your domoticz logic

So if your installation of the script (from the wiki) works, that means that the uservariables are always up to date : Away, home, or the RSSI of the beacon, accordingly to the mode that you chose in the python script.
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

jmleglise wrote:- You create in domoticz manually 1 uservariable for each beacon.
- the python script update those uservariables accordingly of the presence of the beacons.
- you use those uservariables in your domoticz logic

So if your installation of the script (from the wiki) works, that means that the uservariables are always up to date : Away, home, or the RSSI of the beacon, accordingly to the mode that you chose in the python script.
Ok so here's what I did.
SETUP > User Variable
Variable name Tag_Michel
Variable type: String
Variable Value AWAY
ADD

Variable name Tag_Vanessa
Variable type: String
Variable Value AWAY
ADD
is that all? So does my domoticz now know when the value isn't AWAY because it sends a signal to the RPi3 and do I also need to set up switches?
Again, sorry for being such a noob and thanks for you patience.
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise »

It's Ok for the uservariable.
And,
-Did you configure the python script ?
-Is the uservariable updated accordingly to the presence of beacon ? Refresh the domoticz uservariable page : "AWAY" shall be replaced by "Home" or a negativ number.
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

Its working! Pfewwww... this was a tough one for me.
Lets hope I can keep the service up
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise »

Switch On or Off an "Alarm" Switch automatically.
Assume that the beacon uservariables begin by "Tag"

It's a variable script !

script_variable_autoArmAlarm.lua

Code: Select all

--Variable scripts receive 7 tables from Domoticz: otherdevices, otherdevices_lastupdate, otherdevices_svalues, otherdevices_idx, , uservariables, uservariables_lastupdate and uservariablechanged 

commandArray = {}
--beaconAway=0
beaconHome=0
for variableName, variableValue in pairs(uservariables) do
    if string.sub(variableName,1,3)=="Tag" and variableValue ~= "AWAY" then
		beaconHome=beaconHome+1
	--else
	--	beaconAway=beaconAway+1
    end
end

if otherdevices['Alarm'] == 'On' and beaconHome>=1 then   -- switch Off Alarm because 1 beacon come back Home
    table.insert (commandArray, { ['Alarm'] ='Off' } )
--	print("switch Off")
elseif otherdevices['Alarm'] == 'Off' and beaconHome==0 then  -- switch On Alarm because all beacon are away
    table.insert (commandArray, { ['Alarm'] ='On' } )
--	print("switch On")	
end

return commandArray
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

jmleglise wrote:Switch On or Off an "Alarm" Switch automatically.
Assume that the beacon uservariables begin by "Tag"

It's a variable script !

script_variable_autoArmAlarm.lua

Code: Select all

--Variable scripts receive 7 tables from Domoticz: otherdevices, otherdevices_lastupdate, otherdevices_svalues, otherdevices_idx, , uservariables, uservariables_lastupdate and uservariablechanged 

commandArray = {}
--beaconAway=0
beaconHome=0
for variableName, variableValue in pairs(uservariables) do
    if string.sub(variableName,1,3)=="Tag" and variableValue ~= "AWAY" then
		beaconHome=beaconHome+1
	--else
	--	beaconAway=beaconAway+1
    end
end

if otherdevices['Alarm'] == 'On' and beaconHome>=1 then   -- switch Off Alarm because 1 beacon come back Home
    table.insert (commandArray, { ['Alarm'] ='Off' } )
--	print("switch Off")
elseif otherdevices['Alarm'] == 'Off' and beaconHome==0 then  -- switch On Alarm because all beacon are away
    table.insert (commandArray, { ['Alarm'] ='On' } )
--	print("switch On")	
end

return commandArray
ah, this I can read. Thanks!
So I just go to 'SETUP' > 'More options' > 'Event's > LUA and paste above and then Im good to go?
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise »

Yes probably,

But as far as I'm concerned, I use the old way : I prefer to write the script in filesystem.
=> in domoticz/script/lua
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

jmleglise wrote:Yes probably,

But as far as I'm concerned, I use the old way : I prefer to write the script in filesystem.
=> in domoticz/script/lua
that's a few steps to advanced for me 8-)

I'm noticing that the NUT's sometimes go into 'AWAY' status even though they are more than in reach of the Bluetooth signal. Do you have this experience as well?
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise »

With my hardware, up to a distance of 7m, I've experienced no probleme. Beyond, it's more uncertain. If you need a distance between 7-12m, you should, extend the timeout parameter in the python script. Perhaps, the distance depends of the battery life too.
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
korniza
Posts: 157
Joined: Thursday 27 August 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6028
Location: Greece
Contact:

Re: How to check presence of Beacon ?

Post by korniza »

Don't take it wrong, but I like to share the experience I have using FHEM.

I just installed another raspberry to the rooms that NUT get out of range. I installed on the new raspberry (slave) a bluetooth dongle and followed the guide on http://www.fhemwiki.de/wiki/Anwesenheitserkennung
On slave device there is no domoticz required of full FHEM installation! just 3 services to run and using collectord I can now walk around home without losing the presence flag. As FHEM supports rooms, now I know where any bluetooth device is present! So for the panic buttons it is usefull to know where button is pressed and run different scenarios (if it pressed on bedroom, turn on the bedroom lamp etc). :D

Next step: Add an extra raspberry or lower power device to garden attached with usb bluetooth dongle, so I can get garden lights turned on/off.
Attachments
Home, Sweet Home.png
Home, Sweet Home.png (212.68 KiB) Viewed 5004 times
>>>> Google Home <<<<<
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise »

hello everybody,

To fine tune the timeout of each beacon, here is a new script to understand how your beacon works :

Code: Select all

wget https://raw.githubusercontent.com/jmleglise/mylittle-domoticz/master/Presence%20detection%20%28beacon%29/test_beacon.py

Code: Select all

sudo python test_beacon.py
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

@ korniza , I have two questions as I like what you've did:

- how did you configure the panic button on the NUTs?
- how to run FHEM next to Domoticz in slave mode?

Thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest