Hue motion sensors + remotes: custom component


#751

The other thing that I’m seeing is an error saying that ‘token’ & ‘ip_address’ are not supported:

Your configuration contains extra keys that the platform does not support.
Please remove [token].  (See /config/sensor.yaml, line 56)

Here is my current code sat in my sensor.yaml:

- platform: hue
  ip_address: 192.168.1.18
  token: !secret hue_token

#752

about the latter, this should work with the latest component:

binary_sensor:
  - platform: hue
device_tracker:
  - platform: hue
sensor:
  - platform: hue

—edit: updated earlier post and added the dashes. missed that before, sorry. Talking HA 87.1


#753

Thanks for that!
Do I just add that code within my sensor.yaml file? my installation is split out into files.


#754

no, these should be each (anywhere) under their respective components in your config.

Ive put these together in a package just like shown above.

but you can also do it in configuration.yaml


#755

gotcha - sorted - many thanks!


#756

Hey!

I don’t get it after Update to 0.88.1 with the latest custom component 1.0.4.
I get the following “warning”:

Your configuration contains extra keys that the platform does not support (but were silently accepted before 0.88). Please find and remove the following.This
will become a breaking change.
[hosts]. (See /config/INC/device_tracker.yaml, line 7).
[name]. (See /config/INC/sensor.yaml, line 0).

I get (I splitted my configuration) and this the structure I use:

Configuration.yaml

hue:
  bridges:
    - host: xxx

sensor:
  - platform: hue

device_tracker
  - platform: hue

binary_sensor:
  - platform: hue

Folder structure:

custom_components
  hue
    binary_sensor.py
    device_tracker.py
    sensor.py

Has anyone an idea how to solve this?

Regards!


#757

— cancel-- post


#758

Yeah I dug into this a little more - it looks like a limitation with the reporting of the sensor itself.

Based off response here: https://developers.meethue.com/forum/t/how-often-does-api-data-from-motion-detectors-update/5144

The motion sensor uses standard ZigBee attribute reporting to inform the bridge of the values:

  • The presence value is reported every 5 minutes, and when the motion sensor value changes (from motion to no motion or from no motion to motion);
  • The lightlevel value is updated every 5 minutes, and when the motion sensor value changes by 2000 or more;
  • The temperature value is reported every 5 minutes, or when the motion sensor value changes by 20 (0.2 degrees) or more.

So @Mariusthvdb when you say you are getting immediate feedback, you must be triggering the motion sensor.


#759

might very well be the case. Still, it is remarkable, because it does so even when the sensors are switched Off. Which I can do in Ha via a command_line switch, and is confirmed in the Hue app.


#760

@kiromatis
And what about renaming sensor.py to __init__.py with two underscore ie _ as prefix and postfix to init ?


#761

Thanks! But, unfortunately I don’t know how to do it(?) :roll_eyes:

I also tried:


I changed everything from plattform: hue --> platform: hue_custom and rennamed the hue folder to hue_custom within custom_components folder

… but, the result is the same…

Your configuration contains extra keys that the platform does not support (but were silently accepted before 0.88). Please find and remove the following.This
will become a breaking change.
[hosts]. (See /config/INC/device_tracker.yaml, line 7).
[name]. (See /config/INC/sensor.yaml, line 0).

I think I have to wait for a more “native” solution within HASSIO.


#763

my config looks exactly like yours (and no more keys).

for example:

device_tracker:
  - platform: hue_custom
  - platform: bluetooth_tracker

My complete log says:

2019-02-23 17:07:29 WARNING (MainThread) [homeassistant.loader] You are using a custom component for hue_custom.device_tracker which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-02-23 17:07:29 WARNING (MainThread) [homeassistant.helpers.config_validation] Your configuration contains extra keys that the platform does not support.
Please remove [hosts].  (See /config/INC/device_tracker.yaml, line 6). 
2019-02-23 17:07:54 WARNING (MainThread) [homeassistant.loader] You are using a custom component for hue_custom.binary_sensor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-02-23 17:07:56 WARNING (MainThread) [homeassistant.loader] You are using a custom component for hue_custom.sensor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-02-23 17:07:56 WARNING (MainThread) [homeassistant.helpers.config_validation] Your configuration contains extra keys that the platform does not support.
Please remove [name].  (See /config/INC/sensor.yaml, line 10). 

Just for clarification:
It doesn’t make any difference if I use “hue” folder or “hue-custom” folder within custom_components folder (https://github.com/robmarkcole/Hue-sensors-HASS/issues/117). The result is the same.

and to complete my configuration details:

hue:
  bridges:
    - host: !secret hue_ip
      allow_unreachable: true
      allow_hue_groups: true

#764

yeah, I deleted my post after I reread yours. Also went back and looked closer at mine and my hue remotes are missing. So, I’m in the same boat as you. :slight_smile:


#765

good to know that I’m not alone :sweat_smile:


#766

Trying to get the lux and temp, to work from the Hue motion detector. Have added the

  - platform: rest
    resource: http://192.168.1.2/api/MINEAPI/sensors/7
    value_template: '{{ value_json.state.lightlevel }}'
    unit_of_measurement: Lux
    name: 'Bedroom Lux'
    scan_interval: 20
  - platform: rest
    resource: http://192.168.1.2/api/MINEAPI/sensors/5
    value_template: '{{ value_json.state.temperature | float / 100 }}'
    unit_of_measurement: °C
    name: 'Bedroom Temperature'
    scan_interval: 20

but when I put it on a glance card, all I get is a switch or a text saying “off” and if i push the switch to on, nothing happens.


#767

Couple things…Are you not using this custom component? If you are, there’s no reason to connect to the motion sensor through the API, just create a template sensor to pull the attribute out of the binary_sensor that’s automatically created. If you’re not using this component; you didn’t post your full configuration.yaml - are those platforms created as a rest sensor or a rest switch?


#768

Yupp, you lost me:)
I am fairly new… been banging on hassio for little over a week now. Gotten most things to work, but not experienced enough to understand you fully.

I installed my Philips hue with the addon, did the whole “press the button on the bridge” thingy
After setting up that, I set up the lights in hassio and it worked. I can now see if they are on or off, and also adjust the brightness of them.
Other than that I have not done any changes other than the hue settings i listed in previous post.


#769

Okay well basically, to start the easiest thing is to follow the steps here to get the custom components files installed. The component extends the built-in Hue component to add switches and sensors. Once you do that you should automatically get a binary sensor for each motion sensor, which should get you started.

Note, however, that due to some recent platform changes the configuration of this component may likely change soon. For now though you can setup everything following the instructions and although Home Assistant will display warnings it will still work properly.


#770

Ok, so copying the custom components folder and its contents into the config folder, and then adding the:

binary_sensor:
  - platform: hue
device_tracker:
  - platform: hue
sensor:
  - platform: hue

To my configuration.yaml file along with the :

- platform: template
  sensors:

    living_room_temperature:
      friendly_name: 'Living room temperature'
      value_template: '{{state_attr("binary_sensor.living_room_motion_sensor", "temperature")}}'
      unit_of_measurement: °C

    living_room_light_level:
      friendly_name: 'Living room light level'
      value_template: '{{state_attr("binary_sensor.living_room_motion_sensor", "lx")}}'
      unit_of_measurement: lux

should do the trick then ? … i did that and just ran the test config, but aborted it as it did produce error messages. But as you say it will work, i have to try that now :slightly_smiling_face:


#771

At first glance that all looks right, but the warnings I was referring to would be in the Home Assistant log, not in the check config. What errors did you get?