Presence detection, BLE, mi flora, RF gateway with ESP32, OpenMQTTGateway is now compatible

I read this post explaining how to add IR support to the Sonoff RF Bridge (using its two free I/O pins).

Would there be a way of adding Bluetooth support to the Sonoff RF Bridge? Possibly with this Bluetooth module?

For my purposes, I need 433 MHz and Bluetooth support. Rather that use an Arduino or ESP device, I like the RF bridge because it’s an inexpensive ‘off-the-shelf’ device (i.e. has its own enclosure and needs no assembly). If I can cram a Bluetooth module into the enclosure, and have it supported by OpenMQTTGateway, that would be an ideal solution for me.

as there is 2 gpios free on sonoff rf bridge and hm10 needs 2 pins it could work, the only things we can do is testing it.

1 Like

I m planning to upgrade my hass version to 0.88 and see how it behave with omg. I will go back to you when done.

ok. So we can see if it’s related to ha version. Thank you!

Hi,

any update?

I monitored my HA and till now nothing changed.

I will do some test this week end

Hi, at least do you see the mi flora messages on your mqtt broker?

Indeed the mi flora auto discovery is not developped, but I will add it in the next release.

A first implementation of auto discovery of BLE sensors for test purpose is now on the developement branch

Well the first problem is that I can’t see OMG available on home assistant while I see the ltw status on the broker.

Here’s the status from the broker:

online

**qos**  : 0,  **retain**  : false,  **cmd**  : publish,  **dup**  : false,  **topic**  : home/OpenMQTTGateway 2/LWT,  **messageId**  : ,  **length**  : 34,  **Raw payload**  : 111110108105110101

but using this mqtt sensor it seems offline:

  - platform: mqtt
    name: "Wifi OpenGateway 2 ESP32"
    state_topic: "home/OpenMQTTGateway 2/SYStoMQTT"
    unit_of_measurement: 'dB'
    value_template: "{{ value_json.rssi}}"
    availability_topic: "home/OpenMQTTGateway 2/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    icon: "mdi:wifi"
    json_attributes:
      - version
      - uptime
      - freeMem
      - SSID
      - module

UPDATE:

I’ve commented define RF and now I can see flower care in mqtt broker.

But it is still unavailable in Home assistant.

It says

1551550953: New client connected from 192.168.2.208 as OpenMQTTGateway 2 (c1, k15, u’jarvis’).

1551550990: Client OpenMQTTGateway 2 has exceeded timeout, disconnecting.

1551550990: Socket error on client OpenMQTTGateway 2, disconnecting.

Did you downloaded the latest developement version mi flora auto discovery was not present before yesterday.

Yes. I’m using non latest dev version and there’s nothing on HA side.

Did you activated autodiscovery on mqtt integration?

Yes:

mqtt:
  discovery: true
  # discovery_prefix: homeassistant
  broker: 192.168.2.100
  port: 1883
  client_id: home-assistant-1
  username: user
  password: pass

Infact I can see any tasmotized device that I added. So the mqtt is working. There’s some problem between OMG and broker.

ok, did you uncommented zmqttdiscovery in user_config.h?

No in the dev version. I reflash and let you know.

Well.

Here I am again. I flashed the last dev version and I can confirm that now mi flora are autodiscovered and added to HA.

Great add indeed!

Maybe I’m a bit offtopic but can I ask you what are your plans ? Do you will add autodiscovery also for other sensor?

In term of add behaviour is it done one “state of the art” way as I’m not an HA expert if you can give me feedback don’t hesitate.

On what sensors are you thinking about?

  1. feedback: I see that it create different sensor called miflora_1 miflora_2 etc. But are those sensor somehow linked to the hardware miflora? Let me explain: if I move the plant from one room to other (for example from living room to the balcony in spring) what happens? The other OMG understand that is the same device in a different location (using bt Mac address?) Or rediscovery as a new device?

  2. I was thinking to mi bands for room detection. But maybe it’s not so relevant.

yes by the mac adress. It will be the same device at a different location.

Yes it could work, what type of sensor should we create automaticaly?

Hi,

sorry for the delay in response. Well as already told it will be great to integrate data from mibands but I don’t know which information are sent via BT.

Meanwhile I need maybe your support. Starting from 0.88 I see this message in logs and notification:

Your configuration contains extra keys that the platform does not support.
Please remove [optimistic], [retain].

I see also many error all related to plant component. Here’s an example:

Error doing job: Exception in callback <function async_track_state_change..state_change_listener at 0x7f3e95044510>
Traceback (most recent call last):
File “uvloop/cbhandles.pyx”, line 64, in uvloop.loop.Handle._run
File “/usr/src/app/homeassistant/helpers/event.py”, line 82, in state_change_listener
event.data.get(‘new_state’))
File “/usr/src/app/homeassistant/core.py”, line 333, in async_run_job
target(*args)
File “/usr/src/app/homeassistant/components/plant/init.py”, line 203, in state_changed
self._brightness = int(float(value))
ValueError: could not convert string to float

This happens to brightless, temperature, conductivity etc.

May this two issue can be related?