Hue motion sensors + remotes: custom component

Finally got around to creating a custom component for the Hue motion sensors and 4 button remotes.
Please note that I don’t think reducing the SCAN_INTERVAL will make much practical difference.
Please let me know any config or usage issues here, technical issues (i.e. related to the actual .py file) please submit on Github.
Cheers

See:

18 Likes

Testing this now with motion sensor - very cool, no problems to report so far!

2 Likes

I’e update the icons displayed on the front end, should be more appropriate now.

I am loving these 4 button remotes which can have 2 states: I have short presses toggling a lamp on/off and long press of the same button toggling the tv on/off :slight_smile:

3 Likes

Works without a problem for me.

Maybe you can add the battery status too.

2 Likes

Was also thinking of putting the light intensity in %

2 Likes

Very nice.

I got the motion sensors working in HA by setting up custom rules using WinHue3 (https://hyrules.github.io/WinHue3/) and then grabbing the states via REST.

This looks far easier so i’ll give it a go with my motion sensors :slight_smile:

Cheers

Alex

1 Like

Spent all night doing this myself… should have searched first.

I took a slight different approach in that I’ve added them as binary sensors. Take a peek if you want: https://github.com/rossdargan/hue_binarysensor_hass

1 Like

working quite good for me, and compared to rest-sensors even with more than three sensors reaction times are really good (around 1-2s)

what about also integrate the temperature of the motion sensors? :slight_smile:

Temperature is an attribute of the sensors :+1:

I don’t see the sensor in http://localhost:8123/api/states get request.

phue.conf exists and switch works on hue bridge. Any tips?

Make sure to checkout the modelid of your hue switch folks! Just ordered mine off amazon, its a RWL020 not RWL021. Change parse_hue_api_response() accordingly.

2 Likes

Must be an updated model, will need to modify the code, this info is useful to know.
Cheers

the lux value is too high, according to Hue API the sensor value return is "Light level in 10000 log10 (lux) +1 measured by sensor. "

So to have the right value in lux, it should be convert with {{ float(10**((sensor.lightlevel-1)/10000)) | round(2) }}

2 Likes

I have been using this component for a couple of days now, and it is very nice!
But today i had a issue with a Tap:

.hue_sensors] {‘state’: {‘buttonevent’: None, ‘lastupdated’: ‘none’},

TypeError: ‘NoneType’ object is not subscriptable

I guess the Bridge forgot about the last state, because it was unused for many hours.
After pressing a button and restarted Homeassistant it was working again.

Did you update the hue bridge firmware (to support the hue sensors in home kit :slight_smile: )? I just updated and saw that behaviour

I am still using v1 bridge, so no. (just brought the v2.1 and will transfer to it this week)

Hi, I do have 2 HUE remotes, so I have installed your custom_components but upon reboot I do not see them in devices …

I did

Place the custom_components folder in your hass config director,
place the contents of components in your components directory

put in configuration

sensor:
 - platform: hue

Any errors? You have phue.conf?

How to look for errors (if I search hue I have hundreds)?

Yes I have phue

found @robmarkcole

2017-10-12 15:11:34 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform hue
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py”, line 164, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File “/usr/lib/python3.6/asyncio/tasks.py”, line 352, in wait_for
return fut.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 244, in result
raise self._exception
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/sensor/hue.py”, line 25, in setup_platform
url = hass.data[DOMAIN] + ‘/sensors’
KeyError: ‘hue’