Xiaomi Mi flora sensors unavailable

Hi

I´m trying to collect xiaomi mi flora data from two sensors for a start.
But I can´t find out how.
I have identified the MAC addresses from my intel nuc (with updated Bluetooth drivers) on Debian 9, Hassio 0.92.2
The Mi floras are the international version (at least, that’s what I ordered)

I have set up configuration.yaml like this:

  • platform: miflora
    mac: ‘C4:7C:8D:6A:B0:B4’
    name: Jord1
    median: 3
    adapter: hci0
    scan_interval: 600
    monitored_conditions:
    • moisture
    • light
    • temperature
    • conductivity
    • battery
      All the sensors are visible, but values are permanently Unavailable.

In home-assistant.log I get a lot of these:
“Updating miflora sensor took longer than the scheduled update interval 0:10:00”
“Update of sensor.jord1_temperature is taking over 10 seconds”

Questions:

  1. What else do I have to do? Do I have to pair the sensors to my nuc? I tried but without any luck.
  2. How far away from the server can the sensors be placed? It looks like they don´t reach very far.
  3. Is there a way to extend the bliuetooth/BLE range that I can use? I will need several sensors up to 25 meters away and through walls/floors.

Helge

Try and format your code so we can confirm that there are no indentation issues:

at first glance, looks ok. Bring the sensor close to the server/BT dongle and wait. It can take several minutes for the data to be picked up

Standard bluetooth range is 10m / 30ft in open range

Not that I know of. A few Rapsberry PIs could be a solution but sounds a bit expensive.

I waited more than minutes. It´s been days with no response.
To cover the whole field, I guess I´ll have to consider two or three RPis or maybe some NodeMCUs (which I have used for other projects).
With RPis, what´s the best way? Separate hassio installations and MQTT to the main server?
Maybe I can find a way for the NodeMCUs to read the sensors.

have a look at plantgateway - https://github.com/ChristianKuehnel/plantgateway - then you can offload the interfacing to one or more RPI zero W, and use MQTT to push the data to your HASS install.

Do you have access to the syslog on the NUC - grep it for miflora and see if anything going on there.,…

Be warned - bluetooth and 2.5Ghz wifi can clash as they may be on similar frequencies - I gave up using a RPIzero and a bluetooth presence detector for this reason (but the plantgateway works great as as it polls then sends)

I tried this on a RPi3B.
When I run plantgateway I get:
/usr/local/lib/python3.5/dist-packages/plantgw/plantgw.py:33: YAMLLoadWarning: calling yaml.load() without Loader=… is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
config = yaml.load(config_file)
Sun, 26 May 2019 12:22:13 INFO PlantGateway version 0.5.1
Sun, 26 May 2019 12:22:13 INFO loaded config file from /home/pi/.plantgw.yaml
Sun, 26 May 2019 12:22:13 INFO Getting data from sensor jord1
Sun, 26 May 2019 12:22:13 ERROR could not read data from C4:7C:8D:6A:B0:B4 (jord1) with reason: [Errno 111] Connection refused
Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/plantgw/plantgw.py”, line 212, in process_all
self.process_mac(sensor)
File “/usr/local/lib/python3.5/dist-packages/plantgw/plantgw.py”, line 190, in process_mac
self._publish(sensor_config, poller)
File “/usr/local/lib/python3.5/dist-packages/plantgw/plantgw.py”, line 163, in _publish
self.start_client()
File “/usr/local/lib/python3.5/dist-packages/plantgw/plantgw.py”, line 137, in start_client
self._start_client()
File “/usr/local/lib/python3.5/dist-packages/plantgw/plantgw.py”, line 159, in _start_client
self.mqtt_client.connect(self.config.mqtt_server, self.config.mqtt_port, 60)
File “/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py”, line 839, in connect
return self.reconnect()
File “/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py”, line 962, in reconnect
sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
File “/usr/lib/python3.5/socket.py”, line 712, in create_connection
raise err
File “/usr/lib/python3.5/socket.py”, line 703, in create_connection
sock.connect(sa)
I get this for both sensors. What am I doing wrong?
Helge

Hooray!
I tried https://github.com/ThomDietrich/miflora-mqtt-daemon, and it works very well! So, now I’ll just create one or two more RPi’s and have my whole house and garden covered,