Home-Is-Where-You-Hang-Your-Hack / sensor.goveetemp_bt_hci

Govee Temperature/Humidity BLE Home Assistant Component
MIT License
161 stars 29 forks source link
ble govee h5051 h5072 h5074 h5075 h5101 h5102 h5177 h5179 hacs home-assistant home-assistant-component

Govee Temperature/Humidity BLE Home Assistant Component

NOTICE Jul, 15,2021:
Govee support has been added to Passive BLE Monitor integration as of version 4.1.0.

For any new users I would strongly suggest using that integration. BLE Monitor has better support Bluetooth support (including Intel NUC), more sensors and sensor discovery so there is no longer a need to list MAC addresses.

Existing users: I will continue to support this component for the foreseeable future but new development will likely only occur for Passive BLE Monitor integration. Sadly, you will not be able to use both components at the same time.

Thank you @Ernst79 for adding the Govee devices. Ultimately, it makes more sense for you, the end users, to have one component that does everything well and to pool development resources to ensure issues can be resolved quickly.

Govee Temperature/Humidity BLE Home Assistant Component

A custom component for Home Assistant that listens for the advertisement message broadcast by Govee Bluetooth Thermometer/Hygrometers.

hacs_badge hassfest_badge

Supported Devices

Installation

1. Install the custom component:

NOTE: the following instructions about setting device permissions are an edge case for a very specific set up. (If you do not understand it, do not worry about).

3. Add the platform to your configuration.yaml file (see below)

4. Restart Home Assistant:

5. If the entities are still not displaying data, a restart of the host device may be required.

Troubleshooting and help

Any questions or support should be asked on this component's Home Assistant community post.

Configuration Variables

Specify the sensor platform govee_ble_hci and a list of devices with unique MAC address.

NOTE: device name is optional. If not provided, devices will be labeled using the MAC address

sensor:
  - platform: govee_ble_hci
    govee_devices:
      - mac: "A4:C1:38:A1:A2:A3"
        name: Bedroom
      - mac: "A4:C1:38:B1:B2:B3"
      - mac: "A4:C1:38:C1:C2:C3"
        name: Kitchen
Additional component configuration options
Option Type Default Value Description
rounding Boolean True Enable/disable rounding of the average of all measurements taken within the number seconds specified with 'period'.
decimals positive integer 2 Number of decimal places to round if rounding is enabled. NOTE: the raw Celsius is rounded and setting decimals: 0 will still result in decimal values returned for Fahrenheit as well as temperatures being off by up to 1 degree F.
period positive integer 60 The period in seconds during which the sensor readings are collected and transmitted to Home Assistant after averaging. The Govee devices broadcast roughly once per second so this limits amount of mostly duplicate data stored in Home Assistant's database.
log_spikes Boolean False Puts information about each erroneous spike in the Home Assistant log.
use_median Boolean False Use median as sensor output instead of mean (helps with "spiky" sensors). Please note that both the median and the mean values in any case are present as the sensor state attributes.
hci_device string hci0 HCI device name used for scanning.
temp_range_min_celsius float -20.0 Set the lower bound of reasonable measurements, in Celsius. Temperature measurements lower than this will be discarded. Warning: temperatures returned by the Govee device that are outside of the specified range may not be accurate. It is not advised to change this value.
temp_range_max_celsius float 60.0 Set the upper bound of reasonable measurements, in Celsius. Temperature measurements higher than this will be discarded. Warning: temperatures returned by the Govee device that are outside of the specified range may not be accurate. It is not advised to change this value.

Example with all defaults:

sensor:
  - platform: govee_ble_hci
    rounding: True
    decimals: 2
    period: 60
    log_spikes: False
    hci_device: hci0
    govee_devices:
      - mac: "A4:C1:38:A1:A2:A3"
        name: Bedroom
      - mac: "A4:C1:38:B1:B2:B3"
      - mac: "A4:C1:38:C1:C2:C3"
        name: Kitchen

Credits

This was originally based on/shamelessly copied from custom-components/sensor.mitemp_bt. I want to thank @tsymbaliuk and @Magalex for providing a blueprint for developing my Home Assistant component.