Govee BLE Thermometer/Hygrometer sensor

Awesome! This solved it, had to use -30.0 (needs that decimal apparently, if not you get config error).
Thanks for help!

Hi, Iā€™m running several Xiaomi bluetooth temperature sensors successfully with the passive BLE monitor integration. Now I got a Govee H5075 and I want to integrate it as well using this Govee integration. Unfortunately I always get this exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 231, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/govee_ble_hci/sensor.py", line 229, in setup_platform
    raise HomeAssistantError(error_msg) from error
homeassistant.exceptions.HomeAssistantError: Error connecting to Bluetooth adapter: [Errno 1] Operation not permitted

I am running Homeassistant Docker with docker-compose on a raspberry pi, I have already added privileged: true in my docker-compose yaml, but sadly this makes no difference.
Is this problem caused by also running the passive BLE integration at the same time? If so, how to integrate both kind of sensors? Canā€™t those two integrations somehow be merged into one integration that can handle both protocols?

Thanks

Unfortunately, the library this component currently uses, bleson, is active scanning and prevents other Bluetooth components from working without a second Bluetooth dongle. As there a few limitations with this component, I am planning a rewrite in the near future but cannot give an estimate on when it would be complete. At this point, my only suggestion is to either purchase a USB Bluetooth dongle for this component or try natekspencer/hacs-govee_ble which uses a different library.

thanks for your reply. Iā€™m wondering if the BLE monitor integration really is the only problem. I tried to disable that integration and still get the same exception. I didnā€™t try to delete it completely though since I donā€™t want to loose all of my configuration there. Anyway, I ordered a USB Bluetooth dongle and will try it this way, also hoping to improve my bluetooth range a little using an external dongle (the PI sits in a metal housing)
I couldnā€™t get this other component to work either, it shows no sensors and I have no glue how to configure itā€¦

I received the second USB bluetooth dongle, but I still get the same exaception:
Error connecting to Bluetooth adapter: [Errno 1] Operation not permitted

Has anybody got this integration working using Home Assistant with Docker Compose? Iā€™m using privileged : true in Docker compose but it doesnā€™t seem to work :frowning:

In your Home Assistant config, did you add hci_device: hci1 for this component? Also verify that there are more than one hci device with gdbus introspect --system --dest org.bluez --object-path /org/bluez | fgrep -i hci in the host Linux system. Which USB dongle did you purchase?

Yes, I added the hci_device configuration. I used hciconfig and it shows both bluetooth interfaces. Also I can switch between them in the BLE monitor integration, which works with both interfaces. The Govee integration doesnt, and I am pretty sure now that it has nothing to do with the BLE monitor integration running at the same time. There must be some problem with permissionsā€¦ Btw, the BLE monitor works on Docker even without priviledged:true

I canā€™t think of anything. Are there any errors in the log?

Only the govee integration as stated above. Or what log do you mean?
Can I check whether the priviliged:true actually works somehow? Because I get exactly the same eception with and without it.

That is the error I expected to see. I donā€™t think it has to do with priviliged:true. At some point, I remember seeing ble_monitor initializing by iterating over all adapters. I cannot find it again but did find this issue which alludes to it scanning multiple adapters.

For simplify sake, can you disable ble_monitor altogether and try again? Hopefully this will allow the govee component to work. If it does, then reenable ble_monitor and disable scanning of the adapter assigned to the govee component. An additional restart may be needed afterwards.

I deleted the BLE monitor integration and have rebooted the system, still the same errorā€¦

Hi, Iā€™m the developer of BLE monitor. I have never seen this error to be honest. BLE monitor does iterate over the possible hci adapters, and selects the first as default. But you can select another device yourself (based on MAC or hci).

@Thrilleratplay It seems not too difficult to integrate your integration into BLE monitor and to join forces. Iā€™m not sure if you are open to this, or prefer to keep your own integration (which I can also understand). But if you are willing to join forces, I can give you full access to the BLE monitor integration, to allow you to continue to work from there. Let me know what you think. From a user point of view, it seems convenient to have one integration that takes care of as much as possible BLE devices and because multiple integrations can sometimes interfere with each other.

Hi both,
yep, thatā€™s what I (from a user perspective) would highly prefer and appreciate. BLE monitor seems to have the basics perfectly working, including UI based configuration etc. Why not use it and simply add the Govee parsing to it.
Anyway, thanks a lot to both for taking the time and the support.

Excellent! Iā€™ve created an issue on github then to discuss how to get Govee into ble_monitor.

I is basically writing the parser, which is spitting out a dictionary with the data in readable form, probably just like you do it now.

I will grant you access to BLE monitor github tonight.

1 Like

Thank you for the invite. This will ultimately be the best solution for end users. I have not had success with detecting Govee device in passive mode but have not tried since migrating from HCI_tool. Iā€™ll start adding Govee support as soon as I can.

Just wanted to point that as of today (2021-06-13), H5174 is also supported. I can confirm that my two devices, which are in separate freezers, are reporting temp + humidity just fine to HA.

And of course, thanks to thrilleratplay and everyone else for the awesome work on this integration!

Hi, I have a few H5075s and have been using this custom component since last September-ishā€¦ About a month ago the battery read 0% on one of my sensorsā€¦ yet it is STILL reporting data. Also, if I go look at the physical unit itself the screen displays nothing. Has anybody experienced this where the battery reads 0% in HA and the physical unit has nothing on the screen? Seems to be the fault of the unit and not HA or this component, but just curious what other people have seen. The rest of my sensors havenā€™t drained the battery yet to see if they do the same thing. Thanks!

I am not sure if it was first mentioned somewhere in this forum topic or on Reddit, but yes this happens. The LCD uses the most energy and shuts off anywhere between 0%-5% battery life. Until the batteries are completely dead, the sensors and Bluetooth signal will continue to work. I have been meaning to add an alert to my HA instance that notifies me when the batteries are low in a device I do not look at regularly. The battery life on my H5075 devices is around 6 months and switched to rechargeable batteries so whenever a device below 10% on my dashboard I swap out the batteries before it becomes an issue.

Thanks for the info! I should probably do rechargeable as wellā€¦

I frequently use BLE Scanner app on android mobile device.