433mhz, infrared IR to and from MQTT on ESP8266

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.

@1technophile would we compatibility with the ā€œroom-assistantā€ or happy bubbles

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

Did you guys take a look at this: https://github.com/schollz/find

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

1 Like

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!