Govee BLE Thermometer/Hygrometer sensor

I believe those are all from when I had the Z-wave dongle unplugged.
this is from a fresh reboot

[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
Client error on /homeassistant/restart request Server disconnected
s6-svscanctl: fatal: unable to control /var/run/s6/services: supervisor not listening
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] udev.sh: executing... 
[20:16:01] INFO: Using udev information from host
[cont-init.d] udev.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
2021-03-01 20:16:06 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2021-03-01 20:16:36 ERROR (Recorder) [homeassistant] Error doing job: Unclosed connection

Fix the recorder error.

Thanks for the help so far.
I cleared the recorder error by deleting home-assistant_v2.db but it changed into a (synchworker_6) error of the same type. disabled the hacs integration and that cleared that up for now.
Have a clean boot with no errors right now but I will dig further tomorrow and do a few more reboots to clarify.
I will let you know how I am doing at a later date. Hopefully the problem will show itā€™s ugly head soon.

Sorry. I am not sure why it is not working for you.

Hello,

I thought I did everything correctly, but apparently not. My H5075 isnā€™t showing in HA.

configuration.yaml is:

sensor:
  - platform: govee_ble_hci
    period: 120
    use_median: True
    govee_devices:
      - mac: "A4:C1:38:F6:24:54"
        name: office

and the log has the following errors:

Logger: homeassistant.components.sensor
Source: custom_components/govee_ble_hci/sensor.py:179
Integration: Sensor (documentation, issues)
First occurred: 9:48:41 PM (1 occurrences)
Last logged: 9:48:41 PM

Error while setting up govee_ble_hci platform for sensor
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 199, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/govee_ble_hci/sensor.py", line 248, in setup_platform
    scanner.start(config)
  File "/home/homeassistant/.homeassistant/custom_components/govee_ble_hci/sensor.py", line 179, in start
    ["hcidump", "--raw", "hci"], stdout=self.tempf, stderr=self.devnull,  # noqa
  File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'hcidump': 'hcidump'

I donā€™t have HACS, so I manually installed the four files located here in my /home/homeassistant/.homeassistant/custom_components/govee_ble_hci/ folder.

Fingers crossed on this. Thanks!

Those are very out of date, version 0.1. In Github, switch to the master branch for the latest version. hcidump and hcitool dependencies were removed due to compatibility issues. I would strongly suggest using HACS, as it makes this and any updates simple.

No HACS available, unfortunately, since Iā€™m running HA Core. But, I did grab the latest, and hereā€™s the latest log errors:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 199, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/govee_ble_hci/sensor.py", line 206, in setup_platform
    adapter = get_provider().get_adapter(int(config[CONF_HCI_DEVICE][-1]))
  File "/srv/homeassistant/lib/python3.7/site-packages/bleson/providers/linux/linux_provider.py", line 11, in get_adapter
    adapter.off()
  File "/srv/homeassistant/lib/python3.7/site-packages/bleson/providers/linux/linux_adapter.py", line 100, in off
    self.send_cmd_value(HCIDEVDOWN, self.device_id)
  File "/srv/homeassistant/lib/python3.7/site-packages/bleson/providers/linux/linux_adapter.py", line 47, in send_cmd_value
    fcntl.ioctl(self._socket.fileno(), cmd, value)
PermissionError: [Errno 1] Operation not permitted

How are you running HA Core? In a docker container? If so, you are probably missing the --privileged flag in the docker run command.

Hi, but there are some mode to improve or decrease the sensibility of Rapberry pi 4 ?
I have 3 Govee H5075
The homeassistant have see all devices for a monthā€¦
ā€¦and today 2 are disapper, and return visible only if situated in the same room whare are the Rapberryā€¦
(note te battery of the devices are at 95 %)

Not that I am ware of. I am currently using a Raspberry Pi 4, which is is located on the second floor and can pick up Govee devices in the basement, attic, first floor and outside. Without knowing the the size or construction of the building, I can only suspect that there is interference from within the walls or something else on the same 2.4GHz frequency Bluetooth uses such as wifi.

I am not an expert in tracking down signal interference and basically I just keep trying things until they work. To be honest, I am not sure where to point you who would be able to help. Does anyone else have any suggestions on how to track down interference?

I have noted that the problem appear when I connect the HDD
:open_mouth:

Iā€™ve got an intel NUC running Ubuntu as the host with HassOS in a virtual machine. With Govee BLE installed through HACS, I get the following error below. I believe this is an issue because the onboard bluetooth (hci0) controller is not available to the VM. Does anyone now how to make this available to a VM, or will I need a separate usb bluetooth dongle and pass that through to make this work?

Error while setting up govee_ble_hci platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, 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 206, 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/linux_provider.py", line 10, in get_adapter
    adapter.open()
  File "/usr/local/lib/python3.8/site-packages/bleson/providers/linux/linux_adapter.py", line 32, in open
    self._socket.bind((self.device_id,))
OSError: [Errno 19] No such device

What type of VM? What host OS are you on?

KVM through virtual-manager. Host OS is Ubuntu 20.10

Funny enough I am struggling with the same issue at the moment. I am able to pass a bluetooth adapter in using a hostdev xml file as explained here. Using, lsusb and bluetoothctl show I can verify the adapter appears after adding it using virish, to double check I ran bluetoothctl scan on which displays finds surrounding bluetooth devices. Additionally, running gdbus introspect --system --dest org.bluez --object-path /org/bluez | fgrep -i hci shows the HCI device is hci0.

The error I am running into is OSError: [Errno 22] Invalid argument which I think is due to the VM not having enough permissions over the device.

Oh wow. Thanks for providing that link. I just got HassOS setup in a VM a couple of weeks ago which I struggled with initially because I didnā€™t know how to properly setup a network bridge and pass that through. Got that fixed and then I found this thread when trying to integrate my H5075 device.

Iā€™m saving that link because there is a lot of useful info in there besides attaching and updating a device with virsh. I kept Googling ā€œHow to pass on-board bluetooth to VMā€ with no success in finding that documentation lol. Iā€™ll keep checking this thread if you figure out the permissions issue or make another post myself if I manage to figure it out. Thanks for all the hard work you provide for this project!

I feel your pain, this is my first time using Libvirt KVM/QEMU. I have been fighting with NetworkManager, Firewalld and Libvirt KVM/QEMU to be able expose the VM through the host ethernet only to run into this. Iā€™m sure Iā€™ll waste another day trying to track it down only to find that all of the references I was reading were out of date, the error was unrelated to the issue or I have a typo somewhere.

EDIT: I think my issue appears to be with the Bluetooth dongle I am using but a patch has just been submitted.

Is the HDD connected via USB 3? Apparently, USB 3 is really bad for Bluetooth interference. Might be worth switching to a USB 2 port to see if it makes a difference.

I have an external HDD hooked up to my RPi 3B+ (USB 2.0 only) and the RPi still does a great job picking up the Bluetooth advertisements from all over the house. USB 2.0 still seems plenty fast enough for my workload.

1 Like

Interesting. I have an external M.2 SSD connected via USB 3 to my RPi 4 and do not notice any interference. Depending on the hard drive, maybe the amount of power drawn through USB3 creates interference?

Good morning/afternoon, all. Been running this quite well for the past month or so, no issues. However, for reasons unknown, and totally random, it lost its connection. Below is the log (note: that I tried rebooting HA, then rebooting Raspbian, itself).

Running Home Assistant 2021.1.5 Core, Python 3.7.3, Not docker.

Fingers crossed on this one. Thanks!

Logger: homeassistant.components.sensor
Source: custom_components/govee_ble_hci/sensor.py:206
Integration: Sensor (documentation, issues)
First occurred: 9:16:44 AM (1 occurrences)
Last logged: 9:16:44 AM

Error while setting up govee_ble_hci platform for sensor

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 199, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/govee_ble_hci/sensor.py", line 206, in setup_platform
    adapter = get_provider().get_adapter(int(config[CONF_HCI_DEVICE][-1]))
  File "/srv/homeassistant/lib/python3.7/site-packages/bleson/providers/linux/linux_provider.py", line 11, in get_adapter
    adapter.off()
  File "/srv/homeassistant/lib/python3.7/site-packages/bleson/providers/linux/linux_adapter.py", line 103, in off
    self.send_cmd_value(HCIDEVDOWN, self.device_id)
  File "/srv/homeassistant/lib/python3.7/site-packages/bleson/providers/linux/linux_adapter.py", line 47, in send_cmd_value
    fcntl.ioctl(self._socket.fileno(), cmd, value)
PermissionError: [Errno 1] Operation not permitted