# Govee H5075 BLE Thermometer/Hygrometer
# Copyright 2026 Pigs Can Fly Labs LLC
# SPDX-License-Identifier: Apache-2.0

device:
  name: "Govee H5075 Thermometer/Hygrometer"
  manufacturer: "Govee (Shenzhen Intellirocks Tech Co., Ltd.)"
  manufacturer_status: "active"
  protocol: "ble"
  notes: >
    BLE thermometer and hygrometer that broadcasts temperature and humidity
    via manufacturer-specific advertisement data — no connection required
    for live readings. $10-15. Also covers H5072, H5074, H5100, H5101,
    H5104, H5105, H5110, H5111, H5174, H5177, H5179 variants with similar
    advertisement formats.

    ADVERTISEMENT DECODING (H5075, manufacturer ID 0xEC88, 6-byte data):
      bytes 1-3: 24-bit value encoding temperature + humidity
        Bit 23 = sign (1 = negative)
        Bits 22-0 = temp*1000 + humidity*10 (combined integer)
        temp = (value & 0x7FFFFF) / 10000.0  (apply sign if bit 23 set)
        humidity = (value % 1000) / 10.0
      byte 4: battery percentage (0-100)

    H5074 (manufacturer 0xEC88, 7-byte data):
      bytes 1-2: temperature (int16 BE) / 100.0
      bytes 3-4: humidity (uint16 BE) / 100.0
      byte 5: battery percentage

    H5177/H5174/H5100 (manufacturer 0x0001, 6-byte data):
      bytes 2-4: same 24-bit temp/humidity encoding as H5075
      byte 5: battery percentage

    H5179 (manufacturer 0xEC88, 9-byte data):
      bytes 4-5: temperature (int16 BE) / 100.0
      bytes 6-7: humidity (uint16 BE) / 100.0
      byte 8: battery percentage

    All models also advertise a custom 128-bit service UUID:
      494e5445-4c4c-495f-524f-434b535f4857
    which spells "INTELLI_ROCKS_HW" in ASCII (little-endian encoding).

    HISTORY DOWNLOAD: available for H5177 (1 month storage). Connect over
    GATT, write to characteristic ...2012 to request data, read
    notifications from ...2013. Write char: 494e5445-4c4c-495f-524f-434b535f2012,
    notify char: 494e5445-4c4c-495f-524f-434b535f2013.

    ADDRESS TYPE: most models use public address. H5100/H5105 require
    LE_RANDOM_ADDRESS.

    CONFIDENCE: HIGH for advertisement decoding formats, manufacturer IDs,
    custom UUIDs, and history download characteristics — sourced from
    github.com/wcbonner/GoveeBTTempLogger, a production C++ logger used
    in Home Assistant and other integrations. Advertised name patterns
    ("GVH5075_XXXX", "Govee_H5074_XXXX", "GVH5174_XXXX") are confirmed
    across all implementations.

  identification:
    local_name_prefix: "GVH5075"
    service_uuids:
      - "000088ec-0000-1000-8000-00805f9b34fb"

  discovery:
    methods:
      - type: "ble_scan"
        ble:
          local_name:
            match: "prefix"
            value: "GVH"
          manufacturer_data:
            company_id: 60552
            description: "Manufacturer ID 0xEC88 (Govee H5074/H5075/H5179). H5177 uses 0x0001."
    identity:
      stable_keys: ["address"]
      display: "local_name"
    static_ip_required: false

  setup:
    required: false
    confidence: "high"
    notes: >
      No provisioning or connection needed for live readings — device
      broadcasts temperature and humidity via BLE advertisements.
      Connection only needed for history download (H5177 and similar).
      No pairing or bonding required.
    methods:
      - type: "ble_direct"
        verified: true
        description: >
          Passive scan for manufacturer data with company ID 0xEC88 or 0x0001.
          Parse temperature, humidity, and battery from advertisement payload.
          For history download: connect, subscribe to ...2013 notify char,
          write request to ...2012 write char.
        ble:
          pairing_required: false
        steps:
          - action: "Scan for Govee BLE advertisements (company ID 0xEC88 or 0x0001)."
            actor: "client"
            request:
              protocol: "ble_gatt"
          - action: "Parse temperature and humidity from manufacturer data."
            actor: "client"
    factory_reset:
      confidence: "medium"
      effect: "Removes battery. No stored credentials — device is broadcast-only."
      procedures:
        - name: "Remove battery"
          steps:
            - action: "Remove batteries for 10+ seconds, then reinsert."
              actor: "user"
              expect: "Device resumes broadcasting advertisements."
    rejoin:
      in_place_supported: true
      requires_factory_reset: false
      notes: "No persistent connection. Just scan for new advertisements."
    credentials:
      wifi_passphrase_protection: "not_applicable"
      stored_on_device: []
      issued_to_client: []
      notes: "BLE advertisement broadcast. No auth or pairing."

  variants:
    - model: "H5072"
      identification:
        local_name_prefix: "GVH5072"
    - model: "H5074"
      identification:
        local_name_prefix: "Govee_H5074"
      notes: "7-byte manufacturer data format (int16 temp, uint16 humidity)."
    - model: "H5075"
      identification:
        local_name_prefix: "GVH5075"
      notes: "6-byte manufacturer data format with combined 24-bit temp/humidity encoding."
    - model: "H5100"
      identification:
        local_name_prefix: "GVH5100"
      notes: "Uses LE_RANDOM_ADDRESS. 6-byte format (manufacturer 0x0001)."
    - model: "H5101"
      identification:
        local_name_prefix: "GVH5101"
    - model: "H5104"
      identification:
        local_name_prefix: "GVH5104"
    - model: "H5105"
      identification:
        local_name_prefix: "GVH5105"
      notes: "Uses LE_RANDOM_ADDRESS."
    - model: "H5110"
      identification:
        local_name_prefix: "GVH5110"
    - model: "H5111"
      identification:
        local_name_prefix: "GVH5111"
      notes: "8-byte format (manufacturer 0x0001)."
    - model: "H5174"
      identification:
        local_name_prefix: "GVH5174"
      notes: "6-byte format (manufacturer 0x0001)."
    - model: "H5177"
      identification:
        local_name_prefix: "GVH5177"
      notes: "6-byte format (manufacturer 0x0001). Supports history download (~1 month)."
    - model: "H5179"
      identification:
        local_name_prefix: "Govee_H5179"
      notes: "9-byte format (manufacturer 0xEC88)."

  payload_formats:
    H5075_Advertisement:
      description: "6-byte manufacturer data for H5075 (company ID 0xEC88)."
      fields:
        - index: 0
          name: "unknown"
          description: "Always 0x00 in observed captures."
        - index: 1
          name: "temp_humi_combined"
          description: >
            24-bit combined value (bytes 1-3). Bit 23 = sign flag, bits 22-0 =
            (temperature * 10000) + (humidity * 10). Decode: temp = (value & 0x7FFFFF) / 10000.0,
            humidity = (value % 1000) / 10.0. Apply negative if sign bit set.
        - index: 4
          name: "battery"
          description: "Battery percentage (0-100)."
      example: "00 04 18 87 61 00"
      parse_rules:
        - "Bytes 1-3 form a 24-bit big-endian integer."
        - "Bit 23 (MSB of byte 1) is the sign flag; mask it off before decoding."
        - "temp = (masked_value / 10000.0); humidity = (masked_value % 1000) / 10.0."
        - "Byte 4 is battery percent directly."

services:
  - uuid: "494e5445-4c4c-495f-524f-434b535f4857"
    name: "Govee INTELLI_ROCKS_HW Service"
    notes: >
      Custom 128-bit service UUID spelling "INTELLI_ROCKS_HW" in ASCII
      (little-endian: 0x57 0x48 0x5f 0x53 0x4b 0x43 0x4f 0x52 0x5f...
      reversed). Advertised by all Govee thermometer models. Connection
      is only needed for history download; live readings come from
      passive advertisement scanning.
    characteristics:
      - uuid: "494e5445-4c4c-495f-524f-434b535f2012"
        name: "History Download Request"
        properties: ["write", "write_without_response"]
        notes: >
          Write requests to download historical data (H5177, ~1 month).
          Protocol details TBD from additional capture.

      - uuid: "494e5445-4c4c-495f-524f-434b535f2013"
        name: "History Download Response"
        properties: ["notify"]
        notes: >
          Notification channel for history data responses. Subscribe
          before writing to 0x2012.

  - uuid: "0000180f-0000-1000-8000-00805f9b34fb"
    name: "Battery Service"
    characteristics:
      - uuid: "00002a19-0000-1000-8000-00805f9b34fb"
        name: "Battery Level"
        properties: ["read"]
        notes: "Standard BLE battery level. Also available in advertisements."

entities:
  - platform: "sensor"
    name: "Temperature"
    device_class: "temperature"
    unit: "°C"
  - platform: "sensor"
    name: "Humidity"
    device_class: "humidity"
    unit: "%"
  - platform: "sensor"
    name: "Battery"
    device_class: "battery"
    unit: "%"
    state_characteristic: "00002a19-0000-1000-8000-00805f9b34fb"
