GithubHelp home page GithubHelp logo

robmarkcole / hue-sensors-hass Goto Github PK

View Code? Open in Web Editor NEW
344.0 34.0 72.0 493 KB

Support for Hue motion sensors and device tracker

Home Page: https://home-assistant.io/

Python 100.00%
home-assistant hue-sensors hue hue-lights

hue-sensors-hass's Issues

Lux not shown anymore?

I have HA running a RPi3b. Just upgraded to 0.70.1. Downloaded and installed latest hue.py. I have this in my configuration.yaml as part of a template for the motion sensors:

  hall_lux:
    friendly_name: 'Hall Lux'
    value_template: "{{ states.sensor.hall_motion_sensor.attributes.lux}}"
    unit_of_measurement: 'lux'

As value for lux, i get 'lux' (while for temp i get the right temp). I also tried lx instead if lux for unit of measurement, but than i get 'lx' as value. Does this have to do with the lux/lx discussion or am i doing something wrong?

TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'

I've started seeing this error pop up in my logs; when it is happening the temperature aspect of the motion sensor does not update. A restart of Home Assistant fixes it until it happens again. Any thoughts?

2017-10-25 16:16:48 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.hue_motion_sensor_motion_1 fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 204, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 309, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sensor/hue.py", line 91, in update
    self._data.update()
  File "/usr/src/app/homeassistant/util/__init__.py", line 306, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/sensor/hue.py", line 51, in update
    self.data = self.parse_hue_api_response(response.json())
  File "/config/deps/lib/python3.6/site-packages/hue_sensors.py", line 52, in parse_hue_api_response
    data_dict[_key] = parse_sml(sensor)
  File "/config/deps/lib/python3.6/site-packages/hue_sensors.py", line 74, in parse_sml
    data = {'temperature': response['state']['temperature']/100.0}
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'

Device ID are not necessarily unique

As identified by this issue, device ID (_key in the code) of the form SML_2e-02 are not necessarily unique, and the chance that 2 sensors will have the same device ID goes up with the number of sensors a user owns.

Solution: come up with a true unique device ID

Currently:

_key = modelid + '_' + sensor['uniqueid'].split(':')[-1][0:5]

Cant get the plugin working HASSIO 0.60.1

Dear all,

I currently have HASSIO v 0.60.1 running on a Raspberry pi3. Hassio is already connected to my hue bridge and I can operate all lights. In fact I already set up the motion sensors via templating. However, it would be great to also have the dimmer-switches avaliabe in HASSIO.

Unfortunately, I can’t get this plugin to work. I did place both the hue_sensors and the hue_sensor.py in the custom_components/sensors. However, if I add

sensor:

  • platform: hue_sensor

To my config hassio does not reboot anymore. It would be great if someone could help me out to get this working.

Hassio error with HA 0.63.1

Hi.

I've updated to HA 0.63.1, am on hue.py d1d6081 (don't know where i can see what version apart from that GitHub-id) and get the following in my log:

" File "/config/custom_components/sensor/hue.py", line 7

^
SyntaxError: invalid syntax"

I've tried to create a JSON and parse it, but i'm not familiair with doing this. I found a setup.py and setup.cfg in the tar-file, as well as a hue_sensors.py. What command should i do on the prompt on my mac? "Python hue_sensors.py <file_name>"? When i do that, i get

"Traceback (most recent call last):
File "hue_sensors.py", line 6, in
import requests
ImportError: No module named requests"

Please find the JSON in txt format attached (GitHub doesn't allow uploading of JSON?).

hue_raoul.txt

Not loading if motion sensor is off

If I switch the motion sensor off in the HUE APP the component is not loading at home assistant startup.

Error Log:
2017-12-12 23:00:58 ERROR (MainThread) [homeassistant.components.sensor] Error on device update!
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 217, in async_add_entity
yield from entity.async_device_update(warning=False)
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 306, in async_device_update
yield from self.hass.async_add_job(self.update)
File "/usr/lib/python3.6/asyncio/futures.py", line 331, in iter
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
future.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 102, in update
self._hue_id]['lux']
KeyError: 'lux'

If I turn it back on, the component is loading at home assistant startup.

I think you should consider the "on" state at the config parameter:
....
"config": {
"on": true,
"battery": 100,
"reachable": true,
"alert": "none",
"ledindication": false,
"usertest": false,
"pending": []
},
....

Maybe "reachable" as well.

Hue Sensors can't see the Hue platform and won't activate

I upgraded from Home Assistant 0.65 under which the Hue Sensors were running fine.
I believe I followed the instructions for upgrading (see below).

Problem
In Home Assistant 0.66.1 and in 0.67.1, I get the following log message:
2018-04-22 12:31:37 WARNING (MainThread) [homeassistant.components.sensor] Setup of platform hue is taking over 10 seconds. 2018-04-22 12:32:27 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform hue is taking longer than 60 seconds. Startup will proceed without waiting any longer.

and I don't see any of the Hue sensors in http://myhaip:8123/dev-state

Extra info
My Hue lights are running fine and can be controlled from within Home Assistant, so the Hue platform seems to be running fine.

Here's what I did to upgrade

  1. Removed old custom_components folder
  2. Added custom_components/sensor/hue.py
  3. Edited hue.py to have URL = "http://HUEIP/api/HUEKEY/sensors" with HUEIP and HUEKEY taken from phue.conf in the main Home Assistant configuration directory.
  4. Edited configuration.yaml to contain

`
hue:
bridges:
- host: 192.168.1.100
sensor:

  • platform: hue
    `

KeyError: Presence

I keep getting this error when trying to setup hue with the custom component

[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 170, 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 27, in setup_platform
data.update()
File “/usr/lib/python3.6/site-packages/homeassistant/util/init.py”, line 306, in wrapper
result = method(*args, **kwargs)
File “/config/custom_components/sensor/hue.py”, line 51, in update
self.data = self.parse_hue_api_response(response.json())
File “/config/deps/lib/python3.6/site-packages/hue_sensors.py”, line 52, in parse_hue_api_response
data_dict[_key] = parse_sml(sensor)
File “/config/deps/lib/python3.6/site-packages/hue_sensors.py”, line 81, in parse_sml
hue_state = response[‘state’][‘presence’]
KeyError: ‘presence’

I hope this is the info you need. If you need something else just let me know.

Split out the hue hub from hub.py

I really think for "correctness" we should look at splitting out the hue configuration code a bit like how (nest)[https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/nest.py] does it.

Setup requires services.yaml ?

On this thread, it is reported in 'the dev-phue version, setup failed until I created a blank file called services.yaml in the custom_components directory, but now all seems to be running fine'

Button Release events

Is there any reason why you didn’t implement the release events? Would make click and hold easier to process wouldn’t it.... I’ll have a crack and PR if it works out unless you can save me the time if the idea is flawed.

Error loading

Hi,

I've been using this componet for a few weeks without issue.

Today I've added a motion sensor to my setup, and (totally by fluke timing) the hue software has updated on the bridge and a couple of the bulbs.

Restarting HA the hue component now won't start, this is the error:

Error while setting up platform hue
Traceback (most recent call last):
  File "/home/hass/srv/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 171, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 352, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/hass/.homeassistant/custom_components/sensor/hue.py", line 27, in setup_platform
    data.update()
  File "/home/hass/srv/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 306, in wrapper
    result = method(*args, **kwargs)
  File "/home/hass/.homeassistant/custom_components/sensor/hue.py", line 51, in update
    self.data = self.parse_hue_api_response(response.json())
  File "/home/hass/srv/lib/python3.6/site-packages/hue_sensors.py", line 49, in parse_hue_api_response
    data_dict[_key] = parse_zpg(sensor)
  File "/home/hass/srv/lib/python3.6/site-packages/hue_sensors.py", line 99, in parse_zpg
    button = TAP_BUTTONS[press]
KeyError: None

I can't say whether it was adding the motion sensor or the update that killed it. I've waited a few hours before reporting this as an issue in case it was because it was still updating the devices in the background, but they've all been showing as up-to-date for quite a while now.

Any ideas?

Misleading title?

Hello and good morning from Norway.

Just a small thing I noticed when updating my hue.py. The title of this repo is "Custom component for Hue sensors in Home-Assistant <=0.68.0". You might want to remove the "<= 0.68.0" or update it to "<= 0.68.1" since it works just fine in 0.68.1 👍 :-)

Support multiple hue bridges

Hi.

I currently use two hue bridges in two houses each having their config files named differently, phue_1.conf and phue_2.conf. In this configuration the sensors are not detected, however, if any of the files is renamed to phue.conf, everything works fine (for the corresponding hub).

Is there a way you could implement support for multiple bridges? I suppose you'd have to iterate them and get the config file for each.

Regards
Matt

Hue Dimmer Switch firing events every 5 minutes

I added my Hue accessories (motion sensors, dimmer switches) to hass.io and used node-red to setup some automations with the Hue (4-button) dimmer switch using the events-state node. In detail I want to make use of it as a toggle:

  • 1_click --> Kitchen light toggle
  • 4_click --> Hallway light toggle
  • the 2nd and 3rd button will be used for some other fixtures later.

My problem is that apparently the Hue switch seems to keep sending the last button pressed every 5 minutes as an event and thereby toggling the light every 5 minutes.

Are there any workarounds for this or do I need to change my setup to have separate buttons for on and off? Is this a bug of the implementation?

Thanks!

lx key not always present

Need to look into this, but occasionally no lx key was present in data object and this was causing an exception. For now am wrapping the parsing in a try statement

ModuleNotFoundError: No module named 'hue_sensors'

Just installed Home Assistant 0.60.0 as a Docker container and that's what I see in log when I activate the plugin

Log Details (ERROR)
Sun Dec 17 2017 21:12:05 GMT-0500 (EST)

Error while setting up platform hue
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_component.py", line 171, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sensor/hue.py", line 24, in setup_platform
    import hue_sensors as hs
ModuleNotFoundError: No module named 'hue_sensors'

0.62 changes to hub

There are changes to the hub component in 0.62 which break the component. I am aware of this and am looking into a solution.

Potential configuration change in 0.62

Hey,

So, I copied everything over before upgrading to 0.62 and when I upgraded and restarted I lost all my groups (display was just default_view). I use custom_ui so initially I thought it was that, but after all sorts of digging I couldn't find anything. Whilst doing this digging I found an entry in the log saying something like "could not set up sensor.hue" (wish I'd jotted the error down, but I still didn't think it was anything to do with this). So I quickly commented out the lines:

sensor:
  - platform: hue

...just so that I could grep for errors on the next restart.

Anyway, next restart all my groups came back. Thinking I'd fixed the problem elsewhere I re-enabled the sensor, and promptly lost all my groups again. I've now commented that out, and I have my groups back, but the sensors are still working (even with it commented out).

I also cannot recreate the error message when I re-include the sensor line, but basically I don't seem to need the sensor in my config for the sensors to appear and work, and actually including the lines has the bizarre side effect of preventing all my groups from loading (with no obvious errors that I can find).

Any thoughts?

iPhone??

Hi Rob,

Please don't laugh at me for this, but I never seem to understand what your iPhone is doing in the group....
Surely it doesn't get its place there from your sensor..?

Sorry,
Marius

Automatic integration

Currently this component requires you to manually insert the ip address and api_key in to the code. Presumably this means that it can only be used with one bridge (which is fine for me, but maybe not so good for expansive setups).

I've just been poking around the main homeassistant config and there's now a .config_entries.json (I think it will also cover other domains at some point).

Anywho, here's @CCOSTAN 's one (has two bridges so better example than mine)

https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/config/.config_entries.json

I'm guessing that 'username' is the api_key (it certainly is in mine), and obviously it also contains the ips for each bridge.

Soooooooooooooo...

How easy would it be to cycle through this json and auto generate the url(s) without end users having to manually change the code?

Aaaaaannnnnnndddddd....

Presuming that's achievable, plans to integrate this into the official hue component maybe? Be it still as a separate sensor platform entry, or be it as an opt-in/out key for the Hue entry, or be it just automatically on?

Rambling thoughts of a very tired but very curious MF.

Fix lux

Raised on the forum:

Hue API the sensor value return is "Light level in 10000 log10 (lux) +1 measured by sensor. ".. to have the right value in lux, it should be convert with {{ float(10**((sensor.lightlevel-1)/10000)) | round(2) }}

doesn't work with 69.1

I'm not sure what the problem is, but it's very clear that it doesn't work with 69.1.
had to remove the hue.py script from custom_components to be able to get any hue lamps to show up in HA again. tried fixing the URL in the script, but that didn't change the results. So for now i'm not getting the hue sensors to show anything.

honor "unit_system" setting for temperature

Currently the temperature sensor is providing only Celsius readings (understanding that's probably straight from the sensor). Ideally the "unit_system" setting would be honored so that when that is set to "imperial", the right temperature is displayed without every sensor having to be wrapped in templates.

KeyError:'lux'

I'm getting this error when HASS boots

2018-01-21 09:39:45 ERROR (MainThread) [homeassistant.components.sensor] Error on device update!
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 217, in async_add_entity
    yield from entity.async_device_update(warning=False)
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 306, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sensor/hue.py", line 214, in update
    self._hue_id]['lux']
KeyError: 'lux'

And here is the response from Philips Hue:
{"1":{"state":{"daylight":true,"lastupdated":"2018-01-21T08:05:00"},"config":{"on":true,"configured":true,"sunriseoffset":30,"sunsetoffset":-30},"name":"Daylight","type":"Daylight","modelid":"PHDL00","manufacturername":"Philips","swversion":"1.0"},"2":{"state":{"temperature":1725,"lastupdated":"2018-01-21T08:43:39"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":true,"battery":100,"reachable":true,"alert":"none","ledindication":false,"usertest":false,"pending":[]},"name":"Hue temperature sensor 1","type":"ZLLTemperature","modelid":"SML001","manufacturername":"Philips","swversion":"6.1.0.18912","uniqueid":"00:17:88:01:02:12:dc:d0-02-0402"},"3":{"state":{"presence":false,"lastupdated":"2018-01-21T08:44:02"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":true,"battery":100,"reachable":true,"alert":"none","ledindication":false,"usertest":false,"sensitivity":0,"sensitivitymax":2,"pending":[]},"name":"Kitchen Sensor","type":"ZLLPresence","modelid":"SML001","manufacturername":"Philips","swversion":"6.1.0.18912","uniqueid":"00:17:88:01:02:12:dc:d0-02-0406"},"4":{"state":{"lightlevel":16455,"dark":false,"daylight":false,"lastupdated":"2018-01-21T08:44:07"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":true,"battery":100,"reachable":true,"alert":"none","tholddark":13331,"tholdoffset":7000,"ledindication":false,"usertest":false,"pending":[]},"name":"Hue ambient light sensor 1","type":"ZLLLightLevel","modelid":"SML001","manufacturername":"Philips","swversion":"6.1.0.18912","uniqueid":"00:17:88:01:02:12:dc:d0-02-0400"},"9":{"state":{"buttonevent":1002,"lastupdated":"2018-01-21T07:52:07"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":true,"battery":100,"reachable":true,"pending":[]},"name":"Kitchen switch","type":"ZLLSwitch","modelid":"RWL021","manufacturername":"Philips","swversion":"5.45.1.17846","uniqueid":"00:17:88:01:10:5e:e1:eb-02-fc00"},"14":{"state":{"buttonevent":1002,"lastupdated":"2018-01-21T08:10:23"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":true,"battery":100,"reachable":true,"pending":[]},"name":"Living room switch","type":"ZLLSwitch","modelid":"RWL021","manufacturername":"Philips","swversion":"5.45.1.17846","uniqueid":"00:17:88:01:10:6f:1b:10-02-fc00"},"15":{"state":{"status":0,"lastupdated":"2018-01-21T08:10:33"},"config":{"on":true,"reachable":true},"name":"Dimmer Switch 14 SceneCycle","type":"CLIPGenericStatus","modelid":"PHWA01","manufacturername":"Philips","swversion":"1.0","uniqueid":"WA0001","recycle":true},"16":{"state":{"temperature":1905,"lastupdated":"2018-01-21T08:44:21"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":true,"battery":100,"reachable":true,"alert":"none","ledindication":false,"usertest":false,"pending":[]},"name":"Hue temperature sensor 2","type":"ZLLTemperature","modelid":"SML001","manufacturername":"Philips","swversion":"6.1.0.18912","uniqueid":"00:17:88:01:02:12:f7:ad-02-0402"},"17":{"state":{"presence":false,"lastupdated":"2018-01-21T08:31:31"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":true,"battery":100,"reachable":true,"alert":"none","ledindication":false,"usertest":false,"sensitivity":1,"sensitivitymax":2,"pending":[]},"name":"Corridor","type":"ZLLPresence","modelid":"SML001","manufacturername":"Philips","swversion":"6.1.0.18912","uniqueid":"00:17:88:01:02:12:f7:ad-02-0406"},"18":{"state":{"lightlevel":8874,"dark":true,"daylight":false,"lastupdated":"2018-01-21T08:41:30"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":true,"battery":100,"reachable":true,"alert":"none","tholddark":11228,"tholdoffset":7000,"ledindication":false,"usertest":false,"pending":[]},"name":"Hue ambient light sensor 2","type":"ZLLLightLevel","modelid":"SML001","manufacturername":"Philips","swversion":"6.1.0.18912","uniqueid":"00:17:88:01:02:12:f7:ad-02-0400"},"19":{"state":{"status":0,"lastupdated":"2018-01-21T08:32:16"},"config":{"on":true,"reachable":true},"name":"MotionSensor 17.Companion","type":"CLIPGenericStatus","modelid":"PHA_STATE","manufacturername":"Philips","swversion":"1.0","uniqueid":"MotionSensor 17.Companion","recycle":true},"27":{"state":{"temperature":1927,"lastupdated":"2018-01-21T08:44:39"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":true,"battery":100,"reachable":true,"alert":"none","ledindication":false,"usertest":false,"pending":[]},"name":"Hue temperature sensor 3","type":"ZLLTemperature","modelid":"SML001","manufacturername":"Philips","swversion":"6.1.0.18912","uniqueid":"00:17:88:01:02:12:d9:97-02-0402"},"28":{"state":{"presence":false,"lastupdated":"2018-01-20T22:26:12"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":true,"battery":100,"reachable":true,"alert":"none","ledindication":false,"usertest":false,"sensitivity":2,"sensitivitymax":2,"pending":[]},"name":"Dining Room sensor","type":"ZLLPresence","modelid":"SML001","manufacturername":"Philips","swversion":"6.1.0.18912","uniqueid":"00:17:88:01:02:12:d9:97-02-0406"},"29":{"state":{"lightlevel":0,"dark":true,"daylight":false,"lastupdated":"2018-01-21T08:45:00"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":true,"battery":100,"reachable":true,"alert":"none","tholddark":13665,"tholdoffset":7000,"ledindication":false,"usertest":false,"pending":[]},"name":"Hue ambient light sensor 3","type":"ZLLLightLevel","modelid":"SML001","manufacturername":"Philips","swversion":"6.1.0.18912","uniqueid":"00:17:88:01:02:12:d9:97-02-0400"},"30":{"state":{"temperature":null,"lastupdated":"none"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":false,"battery":null,"reachable":false,"alert":"none","ledindication":false,"usertest":false,"pending":[]},"name":"Hue temperature sensor 4","type":"ZLLTemperature","modelid":"SML001","manufacturername":"Philips","swversion":"6.1.0.18912","uniqueid":"00:17:88:01:02:12:d6:74-02-0402"},"31":{"state":{"presence":null,"lastupdated":"none"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":false,"battery":null,"reachable":false,"alert":"none","ledindication":false,"usertest":false,"sensitivity":1,"sensitivitymax":2,"pending":[]},"name":"Hue motion sensor 1","type":"ZLLPresence","modelid":"SML001","manufacturername":"Philips","swversion":"6.1.0.18912","uniqueid":"00:17:88:01:02:12:d6:74-02-0406"},"32":{"state":{"lightlevel":null,"dark":null,"daylight":null,"lastupdated":"none"},"swupdate":{"state":"noupdates","lastinstall":null},"config":{"on":false,"battery":null,"reachable":false,"alert":"none","tholddark":16000,"tholdoffset":7000,"ledindication":false,"usertest":false,"pending":[]},"name":"Hue ambient light sensor 4","type":"ZLLLightLevel","modelid":"SML001","manufacturername":"Philips","swversion":"6.1.0.18912","uniqueid":"00:17:88:01:02:12:d6:74-02-0400"},"33":{"state":{"status":0,"lastupdated":"2018-01-21T07:52:17"},"config":{"on":true,"reachable":true},"name":"Dimmer Switch 9 SceneCycle","type":"CLIPGenericStatus","modelid":"PHWA01","manufacturername":"Philips","swversion":"1.0","uniqueid":"WA0001","recycle":true}}

What am i doing wrong?

Doing as instructed this is what i get.

2018-01-09 23:36:57 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/discovery.py", line 164, in async_load_platform
hass, component, hass_config)
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 49, in async_setup_component
return (yield from setup_tasks[domain])
File "/usr/lib/python3.6/asyncio/futures.py", line 334, in iter
return self.result() # May raise too.
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/discovery.py", line 164, in async_load_platform
hass, component, hass_config)
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 49, in async_setup_component
return (yield from setup_tasks[domain])
File "/usr/lib/python3.6/asyncio/futures.py", line 334, in iter
return self.result() # May raise too.
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/asyncio/tasks.py", line 182, in _step
result = coro.throw(exc)
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 60, in async_setup_component
return (yield from task)
File "/usr/lib/python3.6/asyncio/futures.py", line 332, in iter
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
future.result()
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 159, in _async_setup_component
conf_util.async_process_component_config(hass, config, domain)
File "/usr/lib/python3.6/site-packages/homeassistant/config.py", line 622, in async_process_component_config
platform = get_platform(domain, p_name)
File "/usr/lib/python3.6/site-packages/homeassistant/loader.py", line 104, in get_platform
return get_component(PLATFORM_FORMAT.format(domain, platform))
File "/usr/lib/python3.6/site-packages/homeassistant/loader.py", line 142, in get_component
module = importlib.import_module(path)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 674, in exec_module
File "", line 781, in get_code
File "", line 741, in source_to_code
File "", line 219, in _call_with_frames_removed
File "/config/custom_components/sensor/hue.py", line 249
return self.bridge.set_group(light_id, command)
^
SyntaxError: 'return' outside function
2018-01-09 23:36:57 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/discovery.py", line 164, in async_load_platform
hass, component, hass_config)
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 49, in async_setup_component
return (yield from setup_tasks[domain])
File "/usr/lib/python3.6/asyncio/futures.py", line 334, in iter
return self.result() # May raise too.
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/discovery.py", line 164, in async_load_platform
hass, component, hass_config)
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 49, in async_setup_component
return (yield from setup_tasks[domain])
File "/usr/lib/python3.6/asyncio/futures.py", line 334, in iter
return self.result() # May raise too.
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/asyncio/tasks.py", line 182, in _step
result = coro.throw(exc)
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 60, in async_setup_component
return (yield from task)
File "/usr/lib/python3.6/asyncio/futures.py", line 332, in iter
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
future.result()
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 159, in _async_setup_component
conf_util.async_process_component_config(hass, config, domain)
File "/usr/lib/python3.6/site-packages/homeassistant/config.py", line 622, in async_process_component_config
platform = get_platform(domain, p_name)
File "/usr/lib/python3.6/site-packages/homeassistant/loader.py", line 104, in get_platform
return get_component(PLATFORM_FORMAT.format(domain, platform))
File "/usr/lib/python3.6/site-packages/homeassistant/loader.py", line 142, in get_component
module = importlib.import_module(path)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 674, in exec_module
File "", line 781, in get_code
File "", line 741, in source_to_code
File "", line 219, in _call_with_frames_removed
File "/config/custom_components/sensor/hue.py", line 249
return self.bridge.set_group(light_id, command)
^
SyntaxError: 'return' outside function
2018-01-09 23:36:57 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/discovery.py", line 164, in async_load_platform
hass, component, hass_config)
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 49, in async_setup_component
return (yield from setup_tasks[domain])
File "/usr/lib/python3.6/asyncio/futures.py", line 334, in iter
return self.result() # May raise too.
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/discovery.py", line 164, in async_load_platform
hass, component, hass_config)
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 49, in async_setup_component
return (yield from setup_tasks[domain])
File "/usr/lib/python3.6/asyncio/futures.py", line 334, in iter
return self.result() # May raise too.
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/asyncio/tasks.py", line 182, in _step
result = coro.throw(exc)
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 60, in async_setup_component
return (yield from task)
File "/usr/lib/python3.6/asyncio/futures.py", line 332, in iter
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
future.result()
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 159, in _async_setup_component
conf_util.async_process_component_config(hass, config, domain)
File "/usr/lib/python3.6/site-packages/homeassistant/config.py", line 622, in async_process_component_config
platform = get_platform(domain, p_name)
File "/usr/lib/python3.6/site-packages/homeassistant/loader.py", line 104, in get_platform
return get_component(PLATFORM_FORMAT.format(domain, platform))
File "/usr/lib/python3.6/site-packages/homeassistant/loader.py", line 142, in get_component
module = importlib.import_module(path)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 674, in exec_module
File "", line 781, in get_code
File "", line 741, in source_to_code
File "", line 219, in _call_with_frames_removed
File "/config/custom_components/sensor/hue.py", line 249
return self.bridge.set_group(light_id, command)
^
SyntaxError: 'return' outside function

Hope thats enough info

Warning on update time

Getting the following warning, to investigate.

2018-01-16 07:22:53 WARNING (MainThread) [homeassistant.components.sensor] Updating hue sensor took longer than the scheduled update interval 0:00:00.100000

Convert Celsius to Fahrenheit?

I've got this "working" but I am struggling to turn it into an more usable value...

Here's what I added:

 elif response['type'] == "ZLLTemperature":
       if response['state']['temperature'] is not None:
           data = {'temperature': response['state']['temperature']/100.0 * 1.8 + 32}
         else:
           data = {'temperature': 'No temperature data'}

Its printing out 11.111111111111 depending on the value, so pretty much I would just like to know how to convert "data" to an int that I can round?

Thank you!

No sensors after PR#71

I'm a new user and I installed the latest version from the master branch. I kept getting Cannot setup Hue sensors, check your config errors.

After adding lots of logging, I discovered that the code in #71 was the issue. Rolling that back made all the sensors appear.

Sensors not working

I have hassio v0.60 and upgraded to the latest files. Sensors file as below:

 - platform: hue_sensor
  
  - platform: template
    sensors:
      living_room_temperature:
        friendly_name: 'Living Room Temperature'
        entity_id: sensor.living_room_motion_sensor
        value_template: "{{ states.sensor.living_room_motion_sensor.attributes.temperature }}"
        unit_of_measurement: '°C'
      living_room_lux:
        friendly_name: 'Living Room Lux'
        entity_id: sensor.living_room_lux
        value_template: "{{ states.sensor.living_room_motion_sensor.attributes.lux }}"
        unit_of_measurement: 'lux'
      kitchen_temperature:
        friendly_name: 'Kitchen Temperature'
        entity_id: sensor.kitchen_motion_sensor
        value_template: "{{ states.sensor.kitchen_motion_sensor.attributes.temperature }}"
        unit_of_measurement: '°C'
      kitchen_lux:
        friendly_name: 'Kitchen Lux'
        entity_id: sensor.kitchen_motion_sensor
        value_template: "{{ states.sensor.kitchen_motion_sensor.attributes.lux }}"
        unit_of_measurement: 'lux'

Once rebooted all sensors fail and error log generated
home-assistant.log

Implement phue sensors

Currently phue is only used for auth and requests, and this component parses all of the sensor data manually. Proposal is to switch to using phue for parsing but issue is that phue makes requests for individual sensors, leading to performance issues. By contrast my approach queries all sensors in a single request.

Update for 0.66

In 0.66 the hue library changes. Need to modify this custom component so that it hanles auth without relyin on phue.conf. Can have the user configure the url as was done in early release of this component.

Not getting the hue window up?

Hello.

I've added "hue:" on root and " - platform: hue" under sensor. but i dont get the window on HassIO? Does it not work with HassIO?

Invalid config for [sensor.hue]: required key not provided @ data['ip_address']

Hey Rob, thanks for your awesome Program.

I got one problem,

2018-07-19 05:45:06 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/

I have this entry in the configuration file
hue:
bridges:
- host: 192.168.178.21
allow_unreachable: true
allow_hue_groups: true
filename: phue.conf

and this in the sensor.yaml

  • platform: hue
    ip_adress: 192.168.178.21
    token: omS422jryLFEHgOrF85Uune11Db7Ir0wMYtYYF-n

i checked the hole internet ;) but i can´t get that figure out :(

thanks for your support

Sensor Naming Convention

The sensor naming convention in parse_sml() in the file /custom_components/sensor/hue.py works well for the default naming convention of Hue sensors (e.g., Office sensor, Living room sensor) by inserting "motion" into the penultimate position in the name, e.g.:

  • "Office sensor" -> "Office motion sensor"
  • "Living room sensor" -> "Living room motion sensor"

However, user-defined sensor names can lead to inconsistent and awkward entity_id's in Home Assistant. For example, I had Hue sensors with the following custom names:

  • "Living room 1"
  • "Living room 2"
  • "Office"
  • "Dining room"

These Hue sensor names led to following entity_id's with the current Hue-sensors-HASS naming convention:

  • "Living room motion 1"
  • "Living room motion 2"
  • "Motion office"
  • "Dining motion room"

The simplest solution may be just to recommend in README.md to use the default Hue naming convention for sensors. A second possible approach is to drop the insertion of "motion" into the Hue sensor name. A third possible approach could involve parsing the current sensor names and cleverly naming them (e.g., does the name contain "sensor" or "motion" already, if so..), though this would be difficult to define to cover all possible names well.

add multiple hue gateways

unfortunately it does not work. I see 4_click in dev-states but it wont change when i push a button. And i have second hue platforn (deconz) with two remotes. would like to use both. Is that possible?

Last Motion Sensor

Please add a sensor for last motion or add an explanation how to do it in the README.

Thanks.

Automation not firing

I have automations for my Hue Dimmer Switch, for example:
- alias: hue_dimmer_switch_1_click trigger: - entity_id: sensor.hue_dimmer_switch platform: state to: '1_click' action: - service: light.turn_on entity_id: light.hall
but this doesn't really work as I expect. The problem is that if the sensor has state 1_click and I press the first button again it won't fire the automation. HA recognizes that there has been an update because I can see the timestamp is updated.

I've tried debugging and can see that HA updates its state when I press the button again but no automation is fired.

Is this the expected behavior? Because it kind of breaks the functionality if you use other means of turning off your lights than the Hue Dimmer Switch.

It's a error?

Hi,

I have this error in Logs file,

2017-11-02` 15:14:45 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform hue
Traceback (most recent call last):
File "/usr/src/app/homeassistant/helpers/entity_component.py", line 170, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/local/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/sensor/hue.py", line 24, in setup_platform
import hue_sensors as hs
ModuleNotFoundError: No module named 'hue_sensors'

I have copy your files in my "./custom_components/" folder..
After restart HA I can see a new folder named "./deps/..." and inside I have some new files and folders and a file named "./hue_sensors.py" with another files... it's correct?

Thank you,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.