Hue motion sensors + remotes: custom component


#1

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:


Tutorial adding HUE Motion sensor (Lux,Temp and Motion)
Support for Hue switches (tab/ dimmer)
Tutorial adding HUE Motion sensor (Lux,Temp and Motion)
Is Hue Component Broken in Hass.io 59.2?
Tutorial adding HUE Motion sensor (Lux,Temp and Motion)
Howto create battery alert without creating a template for every device
Official Hue sensors component
Hue dimmer to actually dim a light
#2

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


#3

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:


#4

Works without a problem for me.

Maybe you can add the battery status too.


#5

Was also thinking of putting the light intensity in %


#6

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


#7

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


#8

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:


#9

Temperature is an attribute of the sensors :+1:


#10

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?


#11

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.


#12

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


#13

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) }}


#14

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.


#15

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


#16

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


#17

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

#18

Any errors? You have phue.conf?


#19

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

Yes I have phue


#20

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’