2 15:12:51 ERROR (MainThread) [homeassistant.components.light] 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 “/usr/lib/python3.6/site-packages/homeassistant/components/light/hue.py”, line 138, in setup_platform
allow_in_emulated_hue, allow_hue_groups)
File “/usr/lib/python3.6/site-packages/homeassistant/components/light/hue.py”, line 149, in setup_bridge
config_file_path=hass.config.path(filename))
File “/usr/lib/python3.6/site-packages/phue.py”, line 629, in init
self.connect()
File “/usr/lib/python3.6/site-packages/phue.py”, line 752, in connect
self.register_app()
File “/usr/lib/python3.6/site-packages/phue.py”, line 706, in register_app
response = self.request(‘POST’, ‘/api’, registration_request)
File “/usr/lib/python3.6/site-packages/phue.py”, line 667, in request
return json.loads(response.decode(‘utf-8’))
File “/usr/lib/python3.6/json/init.py”, line 354, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3.6/json/decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python3.6/json/decoder.py”, line 357, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
You also need hue: in the config for the hub
The second error log is referencing the hue lights component which is separate
I have that, under light:
- platform: hue
host: 192.168.1.80
allow_unreachable: true
scan_interval: 10
Hue: should not be under light, the hub is a separate component
so you mean I need this 3?
sensor:
- platform: hue
light:
- platform: hue # this is the hue bridge
hue:
I put
hue:
in configuration
2017-10-12 16:09:23 ERROR (MainThread) [homeassistant.loader] Unable to find component hue
2017-10-12 16:09:23 ERROR (MainThread) [homeassistant.setup] Setup failed for hue: Component not found.
OK I identified the problem. I am developing this as a full component (in a separate repo) and was trying to maintain this as a custom component but made some errors trying to keep things in sync. I’ve now mirrored both, so the instructions have changed slightly. Cheers
is the above correct?
2017-10-12 20:17:20 ERROR (MainThread) [homeassistant.loader] Unable to find component hue
2017-10-12 20:17:20 ERROR (MainThread) [homeassistant.setup] Setup failed for hue: Component not found.
2017-10-12 20:17:23 ERROR (MainThread) [homeassistant.loader] Unable to find component sensor.hue
2017-10-12 20:17:23 INFO (MainThread) [homeassistant.loader] Loaded sensor.history_stats from homeassistant.components.sensor.history_stats
I don’t have the light in there, I think that’s not actually required
what do you mean? Tha’t my Hue (original) component
light:
- platform: hue
host: DEVICE_IP_ADDRESS
Ok, correct is to put under custom_components … not under components
Now I have my 2 HUE remote as sensors.
But can I program it from HASS?
One shows as state 1_click
The other has state 4_click
?
Files in custom components take precedence over the default components.
Remotes have short and long presses
Ok, is it possible to assign HASS events? Or is just to show last press?
You mean services? These are just sensors so use automations
Ahh yes I see.
Can you give me a very simple automation example (which are the 8 states, I guess each button short and long press, so 4x2=8 states, yes?)
Like this?
- alias: 'Long Press ON Corridor switch'
trigger:
- platform: state
entity_id: sensor.corridor_switch
to: '1_long'
action:
- service: light.turn_on
entity_id: light.bedroom_floor_lamp
data_template:
brightness: 100
Generated the following using the automations editor:
alias: remote_long_press_on_automation
condition: []
id: '123'
trigger:
- entity_id: sensor.living_room_remote
platform: state
to: 1_hold
- action:
- data:
entity_id: switch.tv
service: switch.turn_off
This is awesome! Hopefully this will be in official component soon.
Just one question, now that hue sensors show up in HomeKit, is there new API to do push instead of poll? I assume that’s how HomeKit gets sensor data?
Hi @snjoetwyou might be interested in the Hue developers page. From what I can see the API has not changed with the addition of the sensors to Homekit. I assume that Homekit uses its own API that is not accessible to regular developers. Perhaps someone else can shed light on this.
Cheers