/GoveeWatcher_bleak

Fork of original GoveeWatcher with Bleak and new sensor model decode

Primary LanguagePythonMIT LicenseMIT

Govee Watcher with Bleak (Python)

The original code by Thrilleratplay used Bleson, which doesn't work well for me, so I changed it to Bleak

Also added support for Govee H5104, so it works with both Govee H5075 and H5104

NOTE: Tested on Linux and Windows 11

Requirements

  • Python 3.7+
  • sudo privileges
  • Bleak library

Install

Clone or download this repo.

  sudo pip3 install bleak

or on win 11 terminal

  python -m pip install bleak

Usage

In a terminal:

  sudo python bleak_scan_all.py

or on win 11 terminal

  python bleak_scan_all.py

This will list all your device, find yours and add them to watcher_with_bleak.py

  sudo python watcher_with_bleak.py

or on win 11 terminal

  python watcher_with_bleak.py

Below are tutorial from original implementation

The work done here was continued as a Home Assistant Component and ble_monitor

Multiple Govee device Thermometer Hygrometer

Orinignal proof of concept Bluetooth broadcast decoder from Govee H5075 Thermometer Hygrometer Versions:

How does it work

The Govee H5075 Thermometer Hygrometer broadcasts the current temperature and humidity through Bluetooth low energy (BLE) advertisement data.

Packets

From the socket data provided by python-bleason debug logging and advlib's decoding information

Base

Octets Value if static Description
1-3 Header?
4 - 9 ZZ YY XX 38 c1 a4 MAC Address in reverse order. Example a4:c1:38:XX:YY:ZZ
10 1f ?
11 0d Length of local name
12 09 Complete Local Name
13 - 20 47 56 48 35 30 37 35 5f First part of device name "GVH5075_"
21 - 24 Last four hex values (last two octets) of the MAC address spell out in ASCII.

Example of temperature/humidity advertisement

Octets Value if static Description
25 03 Length of payload
26 03 flag for "Complete List of 16-bit UUIDs"
27 -28 88 ec Manufacturer Key
29 -31 02 01 05 GAP list of 32-bit UUIDs but it is empty(?)
32 Length of payload. For this instance it is 09
33 ff Manufacture data flag
34 -35 88 ec Manufacturer Key
36 00 padding?
37 - 39 Encoded temperature and humidity
40 Battery remaining percentage
41 00 padding ?

Decoding Data

The three octets are concatenated together and parsed into an integer Example: 03 21 5d -> 03215d --parse integer--> 205149

For positive temperature values (above 0°C/32°F):

Once we have this integer, for the temperature in Celsius, divide by 10000

205149 / 10000 = 20.5149°C

Humidity is modulus 1000 divided by 10

205149 % 1000 = 149
149 / 10 = 14.9% humidity

For negative temperature values (below 0°C/32°F):

See issue #2

Received Signal Strength Indicator (RSSI)

There is a second advertisement signal contains the ManufacturerData Key 0x004c and payload data INTELLI_ROCKS, (Govee is the brand name, the manufacture is "Shenzhen Intellirocks Tech. Co., Ltd."). Based on the finding in neilsheps/GoveeTemperatureAndHumidity, this relevant to the Apple iOS application. This however provides the RSSI for the device.

Historical data?

This is only a proof of concept for decoding BLE advertisements and do not plan on continuing on to load historical data. Thes are done through commands sent to GATT services.

Additional data

  • [Datasheet for Telink BLE SoC TLSR8253F512](DS_TLSR8253-E_Datasheet for Telink BLE SoC TLSR8253.pdf)
  • FCC.io public device data