Govee BLE Thermometer/Hygrometer sensor

@Thrilleratplay Not too surprisingly, my component won’t work side-by-side with yours on a basic Raspberry Pi, since bleson only allows 1 scan to be started per hci# interface. Since I use both Govee and Moat sensors here, I ended up keeping all of your Govee device support in my fork for Moat. I also ended up adding some additional configuration options that other folks might be interested in too:

  • Native support for Fahrenheit, which fixes the history graph flakiness (also noticed by @gadgetrants) and ensures that we easily get the desired number of digits when rounding.
  • Per-sensor calibration (@iamhueman recently asked for this too)
  • Easily add entities for tracking RSSI, number of samples per period, and battery level. I know template entities can be created for all of these, but that felt unpleasant to maintain for many sensors.
  • Able to report “unavailable” if no measurements are received from a device during a reporting period.

If anyone feels like taking a look or giving it a try, the custom component and documentation is at (not on HACS yet).
After adding the code to custom_components, the only change you’d need to make to your configuration.yaml is to change from
platform: govee_ble_hci
platform: moat_temp_hum_ble
(and then enable any additional features that you want to try).

Thanks again for your work in making this all possible!

1 Like

Thanks. I’ll take a look at it later and integrate features that would not be disruptive. Some I do not see the value of, like tracking battery level.

As for the components not working side by side, this unfortunate but I am also not surprised. At one point, I thought about abstracting out the bleson observer into its own service but this seemed like over kill at the time. How it would work is in the a check would be added to add a callback to the existing service or create a service then add the callback. Allowing multiple components to use the bleson same instance…damn. The more I think about this, the better of an idea that becomes. The base could provide a list of devices it found complete with mac addresses and device names.

Hi, I’m trying to run this on the docker container provided by home-assistant. I’m getting an error

Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/helpers/", line 197, in _async_setup_platform

    await asyncio.shield(task)

  File "/usr/local/lib/python3.8/concurrent/futures/", line 57, in run

    result = self.fn(*self.args, **self.kwargs)

  File "/config/custom_components/govee_ble_hci/", line 202, in setup_platform

    adapter = get_provider().get_adapter(int(config[CONF_HCI_DEVICE][-1]))

  File "/usr/local/lib/python3.8/site-packages/bleson/providers/linux/", line 11, in get_adapter

  File "/usr/local/lib/python3.8/site-packages/bleson/providers/linux/", line 100, in off

    self.send_cmd_value(HCIDEVDOWN, self.device_id)

  File "/usr/local/lib/python3.8/site-packages/bleson/providers/linux/", line 47, in send_cmd_value

    fcntl.ioctl(self._socket.fileno(), cmd, value)

I saw someone else ran into something similar, but I wasn’t sure if there was a resolution. Any idea how to go about fixing this?

Just Home Assistant in a docker container without Supervisor? My guess is you are not running the container with the --privileged flag.

That was it! Little new to docker and wasn’t aware of this, thanks for pointing it out!

I had the integration working nicely for a couple of hours on HAACS 1.6.1, HA 0.117.0, HassOS 4.15. Now my 3 thermometers are not updated anymore (checked also InfluxDB/Grafana). I see updates on the Govee app. When I run bluetoothcl scan I can see the devices as online – no clue what happened. How do I access the log file and/or run the integration manually from the command line?

In the UI, Supervisor->System->Log Provider->core

In the HA command line, ha core logs

I am updating now. It may be a bug in the platform again, HassOS 4.14 did not work with the Bluetooth of the RaspberryPi 3.

UPDATE: Thus far, no issues for me since updating.

Hi there! Trying to set up my first H5075.
HomeAssistant is running in docker with priveleged:true and network_mode: host on Ubuntu 20.04 Intel machine.
Running hci-tool lescan shows the MAC both on the host and inside the container.
However, I’m still getting permission error from bleson:

homeassistant    | 2020-11-06 11:54:21 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up govee_ble_hci platform for sensor
homeassistant    | Traceback (most recent call last):
homeassistant    |   File "/usr/src/homeassistant/homeassistant/helpers/", line 197, in _async_setup_platform
homeassistant    |     await asyncio.shield(task)
homeassistant    |   File "/usr/local/lib/python3.8/concurrent/futures/", line 57, in run
homeassistant    |     result = self.fn(*self.args, **self.kwargs)
homeassistant    |   File "/config/custom_components/govee_ble_hci/", line 202, in setup_platform
homeassistant    |     adapter = get_provider().get_adapter(int(config[CONF_HCI_DEVICE][-1]))
homeassistant    |   File "/usr/local/lib/python3.8/site-packages/bleson/providers/linux/", line 11, in get_adapter
homeassistant    |
homeassistant    |   File "/usr/local/lib/python3.8/site-packages/bleson/providers/linux/", line 100, in off
homeassistant    |     self.send_cmd_value(HCIDEVDOWN, self.device_id)
homeassistant    |   File "/usr/local/lib/python3.8/site-packages/bleson/providers/linux/", line 47, in send_cmd_value
homeassistant    |     fcntl.ioctl(self._socket.fileno(), cmd, value)
homeassistant    | PermissionError: [Errno 1] Operation not permitted

What am I missing?

privelged: true, I am assuming that is from a docker-compose yaml config. Is hci-tool lescan being run in the docker container or on the host? If you are using an external Bluetooth, check if hciconfig has multiple devices. you may need to set the hci_device device in the Home Assistant configuration file.

Do you have any other components that use Bluetooth?

Yes, standard docker-compose.yaml.
I ran hcitool on both the host and inside the container, shows the MAC on both.
hciconfig shows the same output on both the host and inside the container (MAC masked just in case):

hci0:   Type: Primary  Bus: USB
        BD Address: F8:16:54:XX:XX:XX  ACL MTU: 1021:5  SCO MTU: 96:5
        UP RUNNING
        RX bytes:2128 acl:0 sco:0 events:187 errors:0
        TX bytes:27155 acl:0 sco:0 commands:161 errors:0

No other components that use Bluetooth.
I’m using Intel 7260AC mini PCI-E card that came with the machine.
Any ideas?

I vaguely remember an issue with docker-compose and the privileged flag. If you are getting a docker message “Ignoring unsupported options: privileged”, make sure the compose config version is at least version 3.3

Turns out it was my fault, I was running docker-compose restart which doesn’t reload docker-compose.yaml.
Running docker-compose up -d with privileged:true resolved the permission error.

I also tried setting the caps in docker-compose.yaml:

      - NET_RAW
      - NET_ADMIN

This also seems to work even if I disable privileged mode (which I understand grants all capabilities) so might be better from security standpoint.

Thank you for the super-quick response, and also for this really nice component!

1 Like

I am thinking about getting 2x H5102. I am running Hassio on a Rpi 4. I would have the H5102s in about 10 to 20 ft from the Rpi 4. Will they work for me? Are H5102 fairly accurate?

Probably, baring any significant interference between the Govee devices and the Pi. Accuracy is also subjective to your needs. They may be off one degree Fahrenheit but for most people that is close enough for the price they are paying.

Thanks for this great integration! A few weeks back I got an HT5075 and it works great.

Today I added 2 more of those, but strangely in the entity row everything displays in F as expected, but when I create a history-graph card, the original sensor shows in F, but the other 2 show in Celsius on a separate graph. Did anyone ever figure out how to fix this? I saw a few posts about it up above. I’ve done a few reboots on HA and my default HA units are in Fahrenheit, but I can’t figure out why the 2 new sensors are displaying the graph in Celsius.

EDIT: OK this is weird. Now they are all in Fahrenheit, but it is still 2 graphs and the 2 new units say it’s Celsius but the numbers are actually in Fahrenheit… It should be one chart displaying all 3 in F…

From my experience, the Celsius graphs should completely disappear after the initial data point scrolls off the left side of the X-axis (after 24 hours on the default graphs).

Good to hear! Thanks for the response. I guess I’ll see if it drops off tonight.

Yep all good after 24 hours! Thanks for the info.

Where do you set the cap_add in the docker-compose file? Is it global (outside of HA) or does it sit within the HA configuration of docker-compose?

Try with just privileged:true, that should be enough.