Govee BLE Thermometer/Hygrometer sensor

You are running HA on Raspbian but not in a Docker container? Any other recent changes to the system like adding another service or doing an apt-update? The only thing I can think of is that an update on the system changed the bluetooth permissions for the user that runs the HA service. You may also want to double check that bluetooth itself is working using bluetoothctl.

Correct, not in a Docker container.

No other changes whatsoever. bluetoothctl looks solid; I repeatedly see the beacon when I scan on. Also, validated the Thermometer, itself, is working as expectedā€“the Govee app is able to get temp/humidity updates.

That error is definitely related to bluetooth device on the Raspberry Pi. Home Assistant is installed directly on Raspbian? No KVM/QEMU VM? You have run apt update in the past week or so? If it is directly on Raspbian, reboot the device one more time and check the system logs journelctl -xb and look for possible causes. This is a permission issue on the device, something must have changed for this to no longer work. You may have automatic updates running as a service that made a change, maybe it only runs quarterly and updated overnight. It will come down to figuring out what changed.

Dang itā€¦this might be a project lol. HA is indeed installed directly on Raspbian. And, Iā€™m not familiar with KVM/QEMU VM, so Iā€™ll speculate that the answer to that question is a big olā€™ no. I checked the journal, and came across this:

Apr 01 11:00:24 raspberrypi systemd[684]: pam_unix(systemd-user:session): session opened for user pi
Apr 01 11:00:24 raspberrypi bluetoothd[662]: Failed to set privacy: Rejected (0x0b)
Apr 01 11:00:24 raspberrypi bthelper[667]: [CHG] Controller [XX:XX:XX:XX:XX:XX] UUIDs: 00001801-0000-1
Apr 01 11:00:24 raspberrypi bthelper[667]: [CHG] Controller [XX:XX:XX:XX:XX:XX] UUIDs: 0000110e-0000-1
Apr 01 11:00:24 raspberrypi bthelper[667]: [CHG] Controller [XX:XX:XX:XX:XX:XX] UUIDs: 00001200-0000-1
Apr 01 11:00:24 raspberrypi bthelper[667]: [CHG] Controller [XX:XX:XX:XX:XX:XX] UUIDs: 0000110c-0000-1
Apr 01 11:00:24 raspberrypi bthelper[667]: [CHG] Controller [XX:XX:XX:XX:XX:XX] UUIDs: 00001800-0000-1
Apr 01 11:00:24 raspberrypi bthelper[667]: [CHG] Controller [XX:XX:XX:XX:XX:XX] Alias: BlueZ 5.50
Apr 01 11:00:24 raspberrypi bthelper[667]: [CHG] Controller [XX:XX:XX:XX:XX:XX] Pairable: yes
Apr 01 11:00:24 raspberrypi bthelper[667]: Changing power off succeeded
Apr 01 11:00:24 raspberrypi dbus-daemon[346]: [system] Successfully activated service 'org.freedeskt
Apr 01 11:00:24 raspberrypi systemd[1]: Started Hostname Service.
-- Subject: A start job for unit systemd-hostnamed.service has finished successfully
-- Defined-By: systemd
-- Support: https://www.debian.org/support

So, I ran sudo systemctl restart bluetooth which fixed the above error:

ā— bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-04-01 11:16:37 EDT; 15min ago
     Docs: man:bluetoothd(8)
 Main PID: 2358 (bluetoothd)
   Status: "Running"
    Tasks: 1 (limit: 2062)
   CGroup: /system.slice/bluetooth.service
           ā””ā”€2358 /usr/lib/bluetooth/bluetoothd --noplugin=sap

Apr 01 11:16:37 raspberrypi systemd[1]: Starting Bluetooth service...
Apr 01 11:16:37 raspberrypi bluetoothd[2358]: Bluetooth daemon 5.50
Apr 01 11:16:37 raspberrypi systemd[1]: Started Bluetooth service.
Apr 01 11:16:37 raspberrypi bluetoothd[2358]: Starting SDP server
Apr 01 11:16:37 raspberrypi bluetoothd[2358]: Excluding (cli) sap
Apr 01 11:16:37 raspberrypi bluetoothd[2358]: Bluetooth management interface 1.18 initialized
Apr 01 11:16:37 raspberrypi bluetoothd[2358]: Endpoint registered: sender=:1.34 path=/MediaEndpoint/A2DPSource
Apr 01 11:16:37 raspberrypi bluetoothd[2358]: Endpoint registered: sender=:1.34 path=/MediaEndpoint/A2DPSink

But, upon an HA restart, Iā€™m still getting the same issues.

Try stopping all Raspbian Bluetooth systemd services then restart HA. The library this component uses requires full control over the Bluetooth controller and likely is being blocked by another service. You may need to disable the other bluetooth services and reboot the device again to ensure nothing is still binding to the hardware.

I found this:


I think that we need to use the usb2 if we want conserver the bluetooth range
1 Like

Hello!

My name is Anthony and my english is poor, but i will try!

I have a problem with bluetooth connection in raspberry pi 4(all system updateā€¦ i believe)

I have installed GoveeBTTempLogger for connect H5075 in HA integrated in HACS Govee BLE HCI monitor sensor integration but dont work the connectionā€¦ and the data of the cards are unavaliable.

This is a screenshot of the manual connection:

pi@raspberrypi:~ $ bluetoothctl
Agent registered
[bluetooth]# devices
Device A4:--:--:--:--:CC GVH5075_38CC
[bluetooth]# info A4:--:--:--:--:CC
Device A4:--:--:--:--:CC (public)
	Name: GVH5075_38CC
	Alias: GVH5075_38CC
	Paired: no
	Trusted: yes
	Blocked: no
	Connected: no
	LegacyPairing: no
	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
	UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
	UUID: Vendor specific           (00010203-0405-0607-0809-0a0b0c0d1912)
	UUID: Vendor specific           (494e5445-4c4c-495f-524f-434b535f4857)
	Modalias: usb:v248Ap8266d0001
[bluetooth]# agent on
Agent is already registered
[bluetooth]# scan on
Discovery started
[CHG] Controller DC:--:--:--:--:21 Discovering: yes
[CHG] Device A4:--:--:--:--:CC RSSI: -31
[CHG] Device A4:--:--:--:--:CC ManufacturerData Key: 0xec88
[CHG] Device A4:--:--:--:--:CC ManufacturerData Value:
  00 03 23 4d 50 00                                ..#MP.          
[CHG] Device A4:--:--:--:--:CC ManufacturerData Key: 0x004c
[CHG] Device A4:--:--:--:--:CC ManufacturerData Value:
  02 15 49 4e 54 45 4c 4c 49 5f 52 4f 43 4b 53 5f  ..INTELLI_ROCKS_
  48 57 50 75 f2 ff c2                             HWPu...         
[bluetooth]# scan off
Discovery stopped
[CHG] Controller DC:--:--:--:--:21 Discovering: no
[CHG] Device A4:--:--:--:--:CC RSSI is nil
[bluetooth]# trust  A4:--:--:--:--:CC
Changing A4:--:--:--:--:CC trust succeeded
[bluetooth]# pair A4:--:--:--:--:CC
Attempting to pair with A4:--:--:--:--:CC
[CHG] Device A4:--:--:--:--:CC Connected: yes
Failed to pair: org.bluez.Error.AuthenticationFailed
[CHG] Device A4:--:--:--:--:CC Connected: no
[bluetooth]# connect A4:--:--:--:--:CC
Attempting to connect to A4:--:--:--:--:CC
[CHG] Device A4:--:--:--:--:CC Connected: yes
Connection successful
[NEW] Primary Service
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service0008
	00001801-0000-1000-8000-00805f9b34fb
	Generic Attribute Profile
[NEW] Characteristic
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service0008/char0009
	00002a05-0000-1000-8000-00805f9b34fb
	Service Changed
[NEW] Descriptor
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service0008/char0009/desc000b
	00002902-0000-1000-8000-00805f9b34fb
	Client Characteristic Configuration
[NEW] Primary Service
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service000c
	0000180a-0000-1000-8000-00805f9b34fb
	Device Information
[NEW] Characteristic
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service000c/char000d
	00002a50-0000-1000-8000-00805f9b34fb
	PnP ID
[NEW] Primary Service
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service000f
	494e5445-4c4c-495f-524f-434b535f4857
	Vendor specific
[NEW] Characteristic
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service000f/char0010
	494e5445-4c4c-495f-524f-434b535f2011
	Vendor specific
[NEW] Descriptor
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service000f/char0010/desc0012
	00002902-0000-1000-8000-00805f9b34fb
	Client Characteristic Configuration
[NEW] Descriptor
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service000f/char0010/desc0013
	00002901-0000-1000-8000-00805f9b34fb
	Characteristic User Description
[NEW] Characteristic
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service000f/char0014
	494e5445-4c4c-495f-524f-434b535f2012
	Vendor specific
[NEW] Descriptor
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service000f/char0014/desc0016
	00002902-0000-1000-8000-00805f9b34fb
	Client Characteristic Configuration
[NEW] Descriptor
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service000f/char0014/desc0017
	00002901-0000-1000-8000-00805f9b34fb
	Characteristic User Description
[NEW] Characteristic
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service000f/char0018
	494e5445-4c4c-495f-524f-434b535f2013
	Vendor specific
[NEW] Descriptor
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service000f/char0018/desc001a
	00002902-0000-1000-8000-00805f9b34fb
	Client Characteristic Configuration
[NEW] Descriptor
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service000f/char0018/desc001b
	00002901-0000-1000-8000-00805f9b34fb
	Characteristic User Description
[NEW] Primary Service
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service001c
	00010203-0405-0607-0809-0a0b0c0d1912
	Vendor specific
[NEW] Characteristic
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service001c/char001d
	00010203-0405-0607-0809-0a0b0c0d2b12
	Vendor specific
[NEW] Descriptor
	/org/bluez/hci0/dev_A4_--_--_--_--_CC/service001c/char001d/desc001f
	00002901-0000-1000-8000-00805f9b34fb
	Characteristic User Description
[CHG] Device A4:--:--:--:--:CC ServicesResolved: yes
[CHG] Device A4:--:--:--:--:CC ServicesResolved: no
[CHG] Device A4:--:--:--:--:CC Connected: no
[bluetooth]# select A4:--:--:--:--:CC
Controller A4:--:--:--:--:CC not available
[bluetooth]# 

The system connectā€¦ and disconnect in secondsā€¦

Help please!
Thanks!

I think I understand your problem and will try to explain it as simple as possible. If you end up needing Google Translate, I am not sure how well the technical terms will convert.

By GoveeBTTempLogger, I assume you mean https://github.com/wcbonner/GoveeBTTempLogger. That is a separate project. If you installed GoveeBTTempLogger on your Home Assistant device, as it is a systemd, it will connect to the Bluetooth controller first and block this component, https://github.com/Home-Is-Where-You-Hang-Your-Hack/sensor.goveetemp_bt_hci. Both of these devices use active scanning and block usage of the Bluetooth controller. You can use one project or the other but not both. If you want to connect to the Govee H5075 to Home Assistant, I suggest using this component and uninstalling the GoveeBTTempLogger. Be sure to disable and stop the systemd service to prevent it starting when the Raspberry Pi is rebooted. After disabling GoveeBTTempLogger, reboot the Raspberry Pi to make sure a background process is not running.

As for the bluetoothctl output, this is normal. Both projects use Bluetooth scanning to capture the packets being broadcasted instead of connecting to the Govee H5075 directly. The connecting and disconnecting is the Bluetooth controller trying to pair (not exactly ā€œpairingā€, but close enough for this description). It will connect and after a moment where no commands are sent, the connection is dropped to save energy. The Govee App connects to the device this way but this component does not and simply listens for broadcasted messaged.

You can see the manual scan did pick up one device. The ManufacturerData Value ā€œ00 03 23 4d 50 00ā€ breaks down into:

# hex (base 16) converted to decimal (base 10)
# Encoded data
0x03234d = 205645
205645/10000 = 20.5645 # temperature in Celsius, 20.5C
(205645%1000)/10 = 64.5 # humidity, 64.5%

0x50 = 80 # this is the battery level, 80%

So if you remove GoveeBTTempLogger, reboot the Raspberry Pi and wait a few minutes, assuming the device is configured correctly, the values should appear in Home Assistant.

I apologize for poaching on this conversation a bit, but I was wondering if a couple of users wouldnā€™t mind trying out a HACS component I built based on some of the information from this and a couple of other resources. It uses a different bluetooth library underneath, but it auto discovers devices after setting up rather than requiring adding data to the configuration.yaml file. I only have a couple of Govee sensors (H5074,H5174) myself, so those with other types that could try it out and see if it works would be awesome!

If you can, you can add it from https://github.com/natekspencer/hacs-govee_ble

Thank you!

3 Likes

Hot damn and a long list of expletivesā€¦this looks amazing. At the moment, the caffeine has yet to kick in and my brain is the equivalent of an under powered flickering light bulb and yet to dive through the ins and outs of this. At first glance, it looks like the Bleak library is non-blocking and/or passively scanning. The auto discovery looks impressive too. These are features I wanted to add in at some point. I need to set up a VM and will try this out.

1 Like

Hi, Thankyou so much, installed like a dream and picked the temp sensor striaght away :slight_smile:

1 Like

Curious, which sensor do you have?

Hi, the govee h5075, Ā£10.99 on sale, back to Ā£14.99 for one or Ā£25 for a two pack :+1:

1 Like

FYI, I found the number of readings I was able to get and the accuracy of the H5075 to be among the worst of the BLE sensors I have tried. You can get 3 of the Xiaomi LYWSD03MMC units for the price of one H5075.

just had a look on Amazon, will give them a whirl. :slight_smile:

Additionally, there is also open source hardware for them Exploring Custom Firmware On Xiaomi Thermometers | Hackaday I already own a handful of Govee devices so Iā€™m just going to stick with those.

Understood. I am using a mix of Goveeā€™s and Xiaomiā€™s with good success. I just wish Govee still sold the H5074 as it is the GOAT!

As you may know I use my own ble collector software, so have been able to modify it as needed for different sensors. It is solid. That said, when I have some time, I plan of giving this guyā€™s ESP32 project a look in some detail. Itā€™s ability to do more than just BLE advertising packets offers some interesting possibilitiesā€¦ combined with the possibility to deploy multiple ESP32ā€™s for ble coverage issues.

Let me clarify, I want to replace most of the Govee devices with something that has open source firmware but cannot justify it. I have as TODO to try to dump the Govee Firmware and try to reverse engineer it but that is not something I will have time for anytime soon.

I looked at using ESP32 when planning to migrate my HA instance from an RPi to a VM in my home server. Then got distracted with also using ESP32 to maybe create a mesh wifi network and had to stop as I really do not need any more projects.

Yes, many to many interesting thingsā€¦ I poked around the esp8266 and esp32 platforms since they came out. But in the last three months or so, I have to say I have really fallen down the esp32 rabbit hole. They have really solidified the software stack. FreeRTOS is a powerful base in combo with the wealth of Arduino libraries. And then you have the micropython stuff expanding as well. With HA bringing ESPhome on board, the combo of production products with hacked ESP ability via tasmota/esphome and a USD2 price for bare ESP32 bare boards, it is a set of tools to have in your quiver.

Hope you are following the work of atc1441, he is the master of reversing engineering. His recent work to reverse engineer the store e-ink price displays is ā€˜pricelessā€™ :wink:

They do still sell the H5074 on Amazon: