Skip to content
This repository has been archived by the owner on Jul 23, 2021. It is now read-only.

Latest commit

 

History

History
82 lines (60 loc) · 4.74 KB

README.md

File metadata and controls

82 lines (60 loc) · 4.74 KB

Code style: black

Hue-sensors-HASS

FOR COMMUNITY SUPPORT PLEASE USE THIS THREAD

For Hue & Friends of Hue remotes checkout Hue-remotes-HASS

PLEASE BE ADVISED: you are strongly encouraged to use the official Hue sensor integration, and cease using this custom integration.

Longer explanation: sensor support in the official hue integration is more feature-complete than this custom integration, and if you're already using Hue-remotes-HASS, then the refresh rate for sensors in the official integration will be automatically the fastest possible. Since we want to migrate users to the official integration, please do not open feature request issues or create PR adding new functionality to this custom integration, as they will not be considered. This custom integration will remain available until the next breaking change with Home Assistant, at which point this repo will be archived.

Overview

This custom integration provides support for the official Hue motion sensors and the Hue device tracker (allows tracking the mobile with the Hue app installed). Note that these sensors are officially integrated with Home Assistant, but a different approach is taken in this custom integration. In the official integration the Hue motion sensors are treated as three separate entities per device: one each for motion, light level, and temperature. The approach in this custom integration is to expose the light level and temperature values as attributes of a single binary_sensor entity. Also in this custom integration the device data is updated every second, whilst in the official integration data is only every 5 seconds updated.

Be advised that the increased update of this custom integration may cause connectivity problems which can result in errors in the official hue integration, please do not create any issue for this. If you can't live with these errors, do not use this custom integration.

Installation

Place the custom_components folder in your configuration directory (or add its contents to an existing custom_components folder). You need to set up your Hue bridge first. Alternatively install via HACS.

Configuration

Once installed add to your configuration:

binary_sensor:
  - platform: huesensor
device_tracker:
  - platform: huesensor

As per this issue it is recommended to use the default naming options in the Hue app in order to ensure sensible sensor names in HA.

Front end display

To add the following group to your HA frontend, add the following to groups.yaml (obviously editing to use your sensors):

default_view:
  view: yes
  entities:
    - group.Hue

Hue:
  entities:
    - binary_sensor.bedroom_motion_sensor
    - binary_sensor.hall_motion_sensor
    - binary_sensor.living_room_motion_sensor

Temperature, light level and other data in the sensor attributes can be broken out into their own sensor using a template sensor, for example:

- platform: template
  sensors:

    living_room_temperature:
      friendly_name: 'Living room temperature'
      value_template: '{{state_attr("binary_sensor.living_room_motion_sensor", "temperature")}}'
      unit_of_measurement: °C

    living_room_light_level:
      friendly_name: 'Living room light level'
      value_template: '{{state_attr("binary_sensor.living_room_motion_sensor", "lx")}}'
      unit_of_measurement: lux

Developers

  • Create venv -> $ python3 -m venv venv
  • Use venv -> $ source venv/bin/activate
  • Install requirements -> $ pip install -r requirements.txt & $ pip install -r requirements-dev.txt
  • Run tests -> $ venv/bin/py.test --cov=custom_components tests/ -vv -p no:warnings
  • Black format -> $ venv/bin/black custom_components/* (or setup VScode for format on save)

About GitHub Actions

This repo has GitHub Actions. It tests HACS, Hassfest, and flake8. It automatically pushes formatting with isort and black. See a bit more info here.

Contributors

Please format code usign Black before opening a pull request.

A big thanks to Atsuko Ito and Eugenio Panadero for their many contributions to this work!