Hue motion sensors + remotes: custom component

I ask because the issue could be general issue related to the custom_component functionality of Home-Assistant, rather than specific to this CC. I don’t have any other advice other than to see if anyone else has this issue

I cannot say for sure if I am having a similar issue or not but probably maybe lol. I’m new to hass (hassbian 0.73.1) and thought this was an important/well documented custom component that would be the first custom component I would try. I get Unable to find component sensor.hue July 11, 2018, 11:58 PM loader.py (ERROR) after following the readme and placing the py file in a custom component folder and adding the lines to my configuration file. I sort of thought it may be related to the way the hue bridge was being implement now so tried numerous times to set it up manually with a phue.conf file but I just cant make it work and have been at it for 6 hours+. All I have been able to achieve is to remove all my hue lights from home assistant. I noticed the token for the hue bridge is now stored in a core_config_entries file now so things seem different than they once were and I think I am getting a little lost. Thanks for any guidance you may have. Looks great when it works though from what I can see of peoples set ups. I think this is definitely important enough to be brought in as a official component . If I can provide any more info pls let me know

with 73.1 doesn’t work?

Hi,

I am getting the following error in the home-assistant.log when hassio starts:-

‘You are using a custom component for sensor.hue which has not been tested by Home Assistant.’

I am using Home Assistant 0.73.1. Any ideas what the problem is please.

not necessarily a problem, more sort of a disclaimer by the Hassio dev’s. CC’s are not Hassio code, so no responsabilty can be taken by the Hassio developers when things do go wrong.

Hi, i got this error on Home Assistant 0.69.1

2018-07-18 12:39:27 ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.hue]: required key not provided @ data[‘ip_address’]. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.hue/

maybe i have to create a new key.

yes, after the update to 73.1 the component doesn’t work

it does actually…

but i got 0.69.01 :slight_smile:

you’re HUE Motion works with 73.01?

Yep, .73.2 even…:wink:

… ok. i found my fault.

…i thanks DHCP. change the IP from the HUE :sweat_smile:

and yes it’s work :smiley:

1 Like

hi
where do you place this code?


It goes under sensor. So:
sensor:
  office_motion:
  friendly_name: "Movement"
  …
1 Like

Oh so it’s a sensor template
(I’ve not used that before)

Great work, I’ve got the sensor up and running (and can use it with pure automations), but I just can’t seem to get a python script working. Not even with the exact script posted in the hackster post (using my entity_id’s).

hue_remote_1.py:

button_obj = hass.states.get('sensor.hue_dimmer_1_status') 
button = button_obj.state 
if button == '1': 
   hass.services.call('light', 'turn_on', { "entity_id" : 'light.living_room_lightstrip', 'color_name': 'green' }) 
elif button == '2': 
  hass.services.call('light', 'turn_on', { "entity_id" : 'light.living_room_lightstrip', 'color_name': 'red' }) 
elif button == '3': 
  hass.services.call('light', 'turn_on', { "entity_id" : 'light.living_room_lightstrip', 'color_name': 'purple' }) 
elif button == '4': 
  hass.services.call('light', 'turn_on', { "entity_id" : 'light.living_room_lightstrip', 'color_name': 'yellow' }) 

I though it should be (and I also tried):

button_obj = hass.states.get('sensor.hue_dimmer_1').state
button = button_obj.state

And tried without the 'color_name' option, and tried '1_click' and '1_click_up' instead of just 1, 2, 3, 4. It is executable, and I can run other python scripts from the same folder.

My working automation (with no python):

- alias: Dimmer 1 Button 1 Clicked
  trigger:
    - platform: state
      entity_id: sensor.hue_dimmer_1
      to: '1_click_up' # sometimes it doesn't register very fast clicks. But it does register "click_up".
  action:
    - service: light.turn_on
      data:
        entity_id: light.living_room_lightstrip

etc…

1 Like

@Aephir It appears my Hackster article is out of date, possible states (as your working automation show) are made up from:

    responsecodes = {
        '0' : "_click",
        '1' : "_hold",
        '2' : "_click_up",
        '3' : "_hold_up"
    }

You should just be able to parse the first character from the state using button = button_obj.state[0]

Is there any progress on turning this into an official component?

well there was, but it has been stopped, since the developer seems to have stopped developing it…
https://github.com/home-assistant/home-assistant/pull/15121#event-1780324242

too bad indeed, we were all looking forward to this anxiously.

Maybe @robmarkcole sees possibilities ? Are you still looking i to the asyncio side of things ?

#fingerscrossed.

we could all come in there and offer assistance how to get this going again?

thx,
Marius

Hmm, still not sure I get it. Fair warning, I’m extremely new to python…

I did try using 1_click in the python script:

button_obj = hass.states.get('sensor.hue_dimmer_1_status') 
button = button_obj.state 
if button == '1_click': 
   hass.services.call('light', 'turn_on', { "entity_id" : 'light.living_room_lightstrip' }) 
etc.

if that’s what you mean?