Govee BLE Thermometer/Hygrometer sensor

Has anyone figured out a way to get negative temperature values (negative celsius)? The decoding method described in the original github proof of concept only works for positive celsius values. I wanted to put this in a freezer, and the H5075 is able to use lithium AAA’s.

The display on the unit reads down to -6F. So the sensor seems to be reading values correctly. The mystery seems to be how the encoding handles negatives.

There is an open issue under GoveeWatcher that provides a way to convert negative temperatures. However, according to Govee, the operating temperature range of the H5075 is 0°C - 50°C (32°F - 122°F). I never added this as the temperature is out of range and did not want to be responsible to displaying inaccurate values.

Not sure if you can find them any more, but I have the H5052 in both freezer and fridge, solid down to 3 F, six months now, battery at 76%. I tested the LYWSD03MMC down to same temps, but have not run it for near as long. And I don’t think the battery will come close.
// 1 = Xiaomi LYWSD03MMC-ATC
// 2 = Govee H5052

Hmm. It seems like the newer devices support negative temperatures.

@automationjunkie I’ll add the negative temperature support where I can for the next version.

EDIT: Is available in v0.8_beta_1

It is within the HA config of docker-compose

1 Like

I just added a comment on GitHub… the below seems to do well for negative numbers on my HT5075:

I see that there has bee some discussion about negative temperature… the below seems to work for me and reports pretty accurately in tests with my fridge & freezer… Magic number when it goes to negative Celcius is when the base starts reporting around 839. All numbers beyond 839 are negative C.

    - lambda: |-
        for (auto data : x.get_manufacturer_datas()) {
            if(data.data.size()==6) {
              const int basenum = (int16_t(data.data[1]) << 16) + (int16_t(data.data[2]) << 8) + int16_t(data.data[3]);
              float temperature = (basenum / 10000.0f);
              ESP_LOGD("custom", "Govee Two Reported Temp: %f", temperature);
              if(temperature>=839.0) {
                temperature = temperature-839;
                temperature = -temperature * 9.0/5.0 + 32.0;
              } else {
                temperature = temperature * 9.0/5.0 + 32.0;
              }
           }

I just got two H5075’s, they work very well. I was surprised by the range, they work anywhere in my 2035 sq-ft house. My Rpi 4 is in a closet on one side of the house but I still get enough signal for them to work on the far side of the house.

My question is, I want to try some Xiaomi LYWSD03MMC, can I run the Grovee component and the Xiaomi Mijia BLE Temperature and Humidity Sensor integration at the same time on by Rpi 4?

I honestly do not know if using the built in Bluetooth adapter. The library that this comment uses, bleson, requires active scanning and can take control of the Bluetooth adapter. There seem to be instances where other components do not work well with this component but no definitive proof of the cause (likely they are conflicting but work as intended until they try to sync at the same time; a runtime race condition) . The worst case scenario is they would conflict and would require an external Bluetooth adapter to use with this component. From other post in this thread, they seem to be $5-$10.

For anyone interested, I added a simple debugger to the GoveeWatcher repo that displays the information provided by the govee_advertisement.py. It can be found here. It is not intended to be used on the same system as this component if this component is active in Home Assistant as the bleson library would create a conflict in the scanning.

1 Like

This might help some as well with BLE sensors…
I wrote this program to collect BLE temperature and humidity data and publish to MQTT, it also allows you to dump the raw data from BLE type 0 and type 4 advertising packets. It is a c language program, so you will need to compile it on your Linux flavor. I have it running successfully on Raspberry Pi and Intel Ubuntu. The code has several temperature and humidity sensors decoded.

If you have multiple Bluetooth adapters in your machine, you can run multiple instances of the program. However, so other tools like hcitool will not run at same time.

1 Like

Hello, thanks for the work on this project. I just started and joined the community. I just started yesterday and have a prebuilt HA VM running with all the latest on Oracle Virtual Box. Thru the forum, I was able to find the MAC addresses of my pair of Govee H5101 using Windows Bluetooth LE Explorer. I think I have everything setup. I used your suggestion to execute a “core log” command and I am noticing an error: “OSError: [Errorno 19] No such device”. Screenshot with stack below. I’m trying to figure out next troubleshooting step. perhaps the Oracle Virtual Box vm cannot access the bluetooth? Any ideas on what to check? If I cannot use this vm, this is just a learning experience until the Rpi 4 shows up in the mail soon. That would have bluetooth support built into the HA VM I assume.

Thanks in advance.

I believe in VirtualBox, Bluetooth adapters are filtered by default. It may be considered a USB device depending on your system and would need to be whitelisted in the VM’s settings. On the HA command line, you should be able to see the device by running bluetoothctl list, if nothing is listed, then it is appearing in the VirtualBox.

1 Like

Okay, so I was using the onboard Intel bluetooth chip and that was having trouble loading drivers in hassos. I don’t think I can directly run “bluetoothctl list” on this image of HomeAssistant. I may be wrong, but I get an error. Today, I installed a USB Bluetooth and I disabled it on the host OS and whitelisted it in the Oracle VirtualBox settings and restarted. I believe I am past the hardware issues. I just ran a “core log” command again and now it seems to be in the python code to read the sensors, but I don’t get any readings from either of the Govee configured. Several screenshots below to show my configs:

If you could kindly recommend any additional troubleshooting steps to try next?

I seem to get an error “statistics.StatisticsError no median for empty data” in statistics.py

TIA

image

Have you rebooted the VM since doing this? Not just restarted HA. The kernel module may not load via hotplug. In the command line, can you run lsmod? You should see something that references bluetooth. Beyond that, I am not sure. This would be a better question for a HA Virtualbox thread. This one may be helpful

1 Like

I think my image is hass.os which makes it seem I don’t have full linux capability. The lsmod command errors (see screenshot). I did reboot the VM and it definitely seems to be “seeing” the USB Bluetooth device (Cambridge Silicon Radio)… I guess my question is I’m trying to determine how far it is getting. Is it possible for me to add some debug statements to the console? I’m trying to determine if it is even getting as far as scanning for bluetooth devices. I assume my configuration.yaml is simply whitelisting the bluetooth devices that I am interested in. I did read your post about govee_advertiesment.py. Since it seems with this OS, I cannot directly execute scripts, would it be possible to modify any of the scripts like sensor.py to add additional debug statements?

I noticed in sensor.py it has _Logger.debug on line 79. Can you help me figure out what log file may contain these statements? I’m not noticing any statements like on 79 _LOGGER.debug(“Starting Govee HCI Sensor”).

The original error OSError: [Errno 19] ]No such device indicates it cannot find the Bluetooth adapter. Try to move the thermometer closer and wait at least 15 minutes. The later errors mean it can collect enough information. What version of the component are you using? I thought I fixed that particular error.

1 Like

I apologize if I wasn’t clear. The original error was using the internal Intel bluetooth. Once I switched to the Cambridge Silicon Radio USB bluetooth, it seems it can hit the scripts.

I’m on version 0.7.1 and my temp sensors are H5101

image

In case it helps, with the unmodified version of your component, I was getting “statistics.StatisticsError no median for empty data” for my deep freezer since packets were getting processed but all the measurements were getting discarded as spikes (due to being below -20 C (-4 F). Should be easy to reproduce the issue if you temporarily change CONF_TMIN to something bogus that will make all your readings out-of-range.

1 Like

You were clear, I understood that. If Bluetooth wasn’t scanning it would give an OSError of some sort. Are you running any other Bluetooth HA components? Move the thermometer near the host machine to ensure that it isn’t out of range.

@SteveOnorato Thanks, I’ll try that but I was more surprised that the error still existed and thought I fixed it.

1 Like

I will try moving closer. Does this apply to BOTH temp sensors? one is outside.

The Integration that comes to mind may be the Alexa integration. I think it may use bluetooth?
image