My Flora sensor on Synology

Hello, i’m running HA 0.62.1 on a synology nas using docker and i want to know if it’s possible with this config to read the data from the ‘My Flora’ sensors.

I have attached a bluetooth usb dongle to my nas, i have the bluetooth_tracker in my device_tracker list. Tt discovered my tv, phone and tablet perfectly but not the xiaomi sensors. So i have downloaded ‘BLE Scanner’ on my android phone, it’s an app that’s scan the nearby bluetooth devices so i have founded the mac adress of my sensor:

  - platform: miflora
    mac: 'C4:7C:8D:66:12:13'
    name: Fleur 1
    force_update: false
    median: 3
    monitored_conditions:
      - moisture
      - light
      - temperature
      - conductivity
      - battery

With the MAC adress i thought it will work but unfortunately it doesn’t. I’m receiving this kind of errors now in the log:

2018-02-05 19:21:52 WARNING (MainThread) [homeassistant.components.sensor] Updating miflora sensor took longer than the scheduled update interval 0:00:30
2018-02-05 19:22:00 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.fleur_1_moisture is taking over 10 seconds
2018-02-05 19:22:21 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.fleur_1_moisture fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 201, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 308, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 327, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/sensor/miflora.py", line 143, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.6/site-packages/miflora/miflora_poller.py", line 128, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.6/site-packages/miflora/miflora_poller.py", line 60, in fill_cache
    firmware_version = self.firmware_version()
  File "/usr/local/lib/python3.6/site-packages/miflora/miflora_poller.py", line 102, in firmware_version
    _HANDLE_READ_VERSION_BATTERY, self._format_bytes(res))
  File "/usr/local/lib/python3.6/site-packages/miflora/miflora_poller.py", line 170, in _format_bytes
    return ' '.join([format(c, "02x") for c in raw_data]).upper()
TypeError: 'NoneType' object is not iterable

Any kind of help will be greatly appreciated.

Thanks

Hass.io only supports Bluetooth on Raspberry Pi 3 via the Bluetooth BCM43xx (/addons/bluetooth_bcm43xx/) addon. Hass.io doesn’t support external Bluetooth dongles.

Thank you for your reply.

So the only way to make it work is switching from my nas to Raspberry Pi 3?

Is the Bluetooth included in the Rasp3?
Can i use one available usb port on my nas or a phone charger to power it up or do i need to buy a external power supply.

Thanks

You could try something like this TTS on Bluetooth speaker via Raspberry Pi even if your on a NAS. basically you have to tell the OS to use that bluetooth dongle I dont think it will work out of the box. best of luck

https://www.raspberrypi.org/help/faqs/#powerReqs

Thank you ‘Andrew-Lozoya’ i will have a closer look at it.

Hi @Romquenin

I have my Synology working with multiple MiFlora sensors with no problems.

- platform: miflora
  mac: 'C4:7C:8D:64:3F:C7'
  name: Aloe Vera
  force_update: true
  monitored_conditions:
- moisture
- light
- temperature
- conductivity
- battery 

I am using a Belkin F8T065BF USB 4.0 Bluetooth Adapter. I really see no reason to move away from your NAS to a Raspberry pi. I also have this set up as a device tracker.

Let me know if you need any more info or help ill do my best. Are you running in Docker?

Did you have to install anything to get the dongle working out of box? i always thought you had to configure to hardware to pick up on the dongle

Hi @Andrew_Lozoya

Didn’t install anything just made sure to get a compatible USB by visiting
https://www.synology.com/en-uk/compatibility
and gave my Docker container access to the bus by adding the below.

-v /dev/bus/usb:/dev/bus/usb

1 Like

Hello ‘jamieb’, thanks for your answer. Glad to know that my synology is still in the race!
I have two bluetooth usb dongle compatible with my synology, one asus and one belkin.

Maybe my Docker container doesn’t have access to the sensor.

Can you help me a little bit more with the code, i’m sorry but missing something

Thank you very much.

I have seen this code from http://philhawthorne.com.

sudo docker run --name home-assistant --restart=always --net=host --privileged -itd  -v /volume1/Shared/docker/homeassistant/config:/config --device /dev/ttyUSB0 -v /dev/bus/usb:/dev/bus/usb homeassistant/home-assistant

After i enter this code i get an error and a new home assistant container in docker.

Maybe this can help you to troubleshoot my issue.

Thanks.

1 Like

Did you create the directories you are mapping your container too?

If we break down the command you ran…

sudo docker run --name home-assistant --restart=always --net=host --privileged -itd -v /volume1/Shared/docker/homeassistant/config:/config --device /dev/ttyUSB0 -v /dev/bus/usb:/dev/bus/usb homeassistant/home-assistant

The extract below is mapping the container to a local folder.
-v /volume1/Shared/docker/homeassistant/config:/config

To keep the command the same create a new shared folder on your Synology called “Shared” and within that create a folder called “Docker” then within that a folder called “homeassistant”

This is where your HomeAssistant configs will live.

Hello jamieb. Thank you for you response.

Correct me if i’m wrong but if i can use bluetooth_tracker and discover some devices it sould mean that my container already have access to the usb bus?

So now i have two different installation of HA on two different containers.

I moved the files from my previous config to the new container but it’s not working i’m having the same issue.

2018-02-06 13:15:26 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.fleur_1_moisture is taking over 10 seconds
2018-02-06 13:15:47 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.fleur_1_moisture fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 201, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 308, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 327, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/sensor/miflora.py", line 143, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.6/site-packages/miflora/miflora_poller.py", line 128, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.6/site-packages/miflora/miflora_poller.py", line 60, in fill_cache
    firmware_version = self.firmware_version()
  File "/usr/local/lib/python3.6/site-packages/miflora/miflora_poller.py", line 102, in firmware_version
    _HANDLE_READ_VERSION_BATTERY, self._format_bytes(res))
  File "/usr/local/lib/python3.6/site-packages/miflora/miflora_poller.py", line 170, in _format_bytes
    return ' '.join([format(c, "02x") for c in raw_data]).upper()
TypeError: 'NoneType' object is not iterable
2018-02-06 13:15:47 WARNING (MainThread) [homeassistant.components.sensor] Updating miflora sensor took longer than the scheduled update interval 0:00:30
2018-02-06 13:15:57 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.fleur_1_battery is taking over 10 seconds

I think i’m getting lost, Thanks anyway.