BLE Room Presence with Home Assistant

I’m using OpenMQTTGateway 0.8.1 with many changes on home assistant to simulate HappyBubbles devices.

It works well, but ESP32 loses the connection very often. I have to restart them without stopping.

With the latest version of OpenMQTTGateway, I can no longer simulate HappyBubbles devices.

Unfortunately, I do not find solutions. Can someone guide me?

I try to have a detection per room, as was the case with the 0.8.1, or at worst a global detection but on several ESP32.

I hope to find a solution, otherwise I will try other possibilities with RaspberryPi.

Thank you .

Hello,

Per default the last versions of OMG publish presence data into :
Base_Topic "home_presence/" Gateway_Name

Which is dedicated to home assistant integration, does this miss something to integrate properly with HA?

I’m also having trouble with HA integration. I can see the home/home_presence/gatewayName data being published on mqtt, but HA doesn’t show any sensor anywhere. In mqtt integration I can see binary_sensor.openmqttgateway1 (state online) and sensor.gatewaybt (state unknown).

I’m also trying to set them up manually using:

  • sensor:
    platform: mqtt_room
    name: a name
    device_id: “f5:35:56:xx:xx:xx”
    state_topic: “home/home_presence”

But it always shows as not_home. HA logs show a warning:

[homeassistant.components.mqtt] Can’t decode payload b’{“id”:“4b:02:a6:xx:xx:xx”,“manufacturerdata”:"\xe0",“rssi”:-72,“distance”:4.287841}’ on home/home_presence/OpenMQTTGateway1 with encoding utf-8

And the very weird thing is that neither the id, manufacturerdata, rssi or distance are values that have been published by OMG. I can see 3 devices on the mqtt stream, but none of them share the id, rssi, distance, that I’m seeing in that error. They make sense but that’s not what OMG is publishing.

Edit: More info about my setup:

  • Home Assistant 0.95.4 in a Docker (x86) with reverse proxy and letsencrypt certificates
  • Mosquitto in a docker
  • OMG 0.9.1 in an ESP32s
  • No Flora devices, only one Mi Band 2 and a couple of cellphones. I can see them in mqtt
  • MQTT integration in HA. mqttdiscovery enabled in HA
  • ZgatewayBT and Zmqttdiscovery uncommented in OMG user_config.h

Ok, I commented line 69 in file ZgatewayBT

// if (advertisedDevice.haveManufacturerData()) BLEdata.set(“manufacturerdata”, (char *)advertisedDevice.getManufacturerData().c_str());

So manufacturerdata is not being published and now HA accepts it correctly. I can track my Mi Band 2 with no problems

This is strange that HA doesn’t accept manufacturer data.

Is it possible it’s tripping up about “\xe0” in the manufacturerdata?

oh yeah, if you want to test it just try to publish to the broker 2 different payload, one with the \ and one without

Hello.
It publish well to home_presence topic but I have nothing on HA.
Maybe the same issue. I will see tomorrow.
Thanks

Log Details (WARNING)

Can’t decode payload b’{“id”:“42:79:24:18:92:9d”,“manufacturerdata”:"\xe0",“rssi”:-87,“distance”:18.07764,“servicedata”:“0000000000000000000000000000000000000000”,“servicedatauuid”:“0000fe9f-0000-1000-8000-00805f9b34fb”}’ on home/Second/BTtoMQTT/42792418929D with encoding utf-8