it works now. tq!
i donāt catch the pointļ¼ could you share your conf in HAļ¼
Sure! Iām using it with:
sensor.yaml:
- platform: mqtt_room
device_id: <your device mac>
name: "Lyra"
state_topic: "home/BTtoMQTT/room"
away_timeout: 60
you may change the subjectBTtoMQTTRoom from āhome/BTtoMQTT/room/casaā, to the name of your room. Since i just have one scanner Iām using ācasaā (which means āhomeā).
If I have more than one nodemcu with Hm-10, such as 3 , every room owns one module, and I only have one ibeacon, can I use your conf and working well? They will update location correctly?
@jxjhheric good question and one that I intend to discover when my other hm-10 arrive. From reading the docs about mqttroom, yes, it should work correctly and homeassistant āshouldā update the location to the detector who sent the lowest distance. Maybe you have to add the ātimeoutā option which controls how much time the position is considered valid (but not yet āawayā). If I got it right mqttroom do a similar job as the āroom-assistantā or happy bubbles, but with a simpler algorithm.
Also this led to another question: if you can use āgroupā to your room locations! Letās say you have āhallā, āliving roomā and ākitchenā but also wants to group them as āhomeā, so some automations use the room and others just āhomeā.
If you just want to know if the beacon is at home but not which room, you may just use the same subjectBTtoMQTTRoom topic to all of them.
thanks for your reply
of course i want to know if the beacon is at which room not just at homeļ¼use āgroupā is good idea for automations
iām newbie for the codeļ¼can i change the number belowļ¼
String mac = onedevice.substring(53,65);
String rssi = onedevice.substring(66,70);
float distance = rssi.toInt() / -10.0;
discResult = discResult.substring(78)
now i use @Petricaās conf to track the RSSI ļ¼but my mibandās RSSI is unstable when not movingļ¼-82ļ¼-79ļ¼-75ļ¼-80ā¦justlike thisļ¼canāt show the status correctly
Not sure what you want to do, but you may change this line:
float distance = rssi.toInt() / -10.0;
This line takes the rssi value and divides to -10 so you got a positive value which vaguely remember āmetersā, so, -82, become ādistance: 8.2ā. Which also means that when you get closer to the mcu the signals increases (ex: from -80 to -60), and the distance decreases (ex: from 8.0 to 6.0). Thereās no problem with a unstable RSSI as long as the RSSI read by the nearer mcu is better than the one read by the others. Maybe you can add/substract some value to one or other mcu if it has a better antenna and has a stronger/weaker signal than the others for the same real distance. Maybe you need to use room-assistant or happy bubbles as they use better algorithms to filter/adjust these values.
got it
better algorithms get better values
i read this code https://github.com/home-assistant/home-assistant/raw/e09e102e7819012ebd909ede0245e3db0fd382be/homeassistant/components/sensor/mqtt_room.py
and find that one of contributors is mKeRixļ¼he is also the author of room-assistantļ¼maybe the algorithm of room_mqtt in ha is same as the āroom-assistantā ?
No, itās not. room assistant uses something called āKalman filterā and mqtroom just do a simple distance comparison.
Following a previous post i was planning to make openmqttgateway compatible with happybubbles, but i m open to other solutions. It is very good that you explore how the beacon detector can be use with the gateway. I Will not do the job with all the presence server/module around, we have to select the best or the two bests.
Glad to hear that, looking forward to seeing the best way for the gateway
i flash the modify ZgatewayBT.inoļ¼in mqtt i got the idļ¼macļ¼distanceā¦ but in HAļ¼itās always away when i moving the ibeacon.
show us the modified code and the configuration, please. Are you using the three receptors?
Itās working now
I modified the distance formula for the correct distance
d = 10^((abs(RSSI) - A) / (10 * n))
d = distance to the sender [m]
A = absolute value of power at one meter distance to the sender [dBm]
n = path loss coe?cient
And now I have 2 receptors, it will change the room name when I move from one room to another
Nice! Which values did you used to āAā and ānā? Or better yet, how did you calculate it?
Just test for myself,
A=70
N=2.5
This number is fit for me,
You can try some other number for yours
@1technophile something strange with my gateway,everytime i start the gateway , the mqtt server will receive:
home/OpenMQTTGateway/LWT Online
home/commands/MQTTto433 13981488
the second command turn my light on, gateway on light on gateway on light onā¦ thatās not my expected
how can i solve that ļ¼
What would have to be done to make this work with the Adafruit Feather HUZZAH?
I have some RF door sensors, and the Huzzah is the board that I have.
Thanks!