Tutorial adding HUE Motion sensor (Lux,Temp and Motion)

@ robmarkcole . I believe I’m experiencing some Network congestion using the rest call setup at the beginning of this thread. Is your component perhaps more efficient in some way? Does it possible make one call and parse out the info instead of each sensor querying the bridge with a rest call?

HI, yes 1 rest call for all sensors

I did this a few months ago but can’t get it to show light/lux no matter what I try.

@ robmarkcole . Thanks have the component up and running well (i believe anyway) on Home Assistant 0.79.1 . Going thru your extensive CC thread and wondering if the default polling time was still 0.1 seconds for the version in your repo. Also I see that your method of polling which I was interested in may have been a barrier to this component being implemented as an official component. I keep checking the blog hoping to see it included. Anyways dont want to pester but certainly I will keep an eye out for this official component I would consider to be in the top 5 value in home assistant right now

@dasbooter you can experiment with the scan_interval. Re official component, just requires time and effort, both of which are in limited supply right now

I’m using the rest platform to get the brightness level from my Hue Motion sensor.

- platform: rest
  resource: http://<IP>/api/XXXX/sensors/7
  value_template: '{{ (10 ** (float(value_json.state.lightlevel) / 10000) -1) | round (1)}}'
  unit_of_measurement: 'lx'
  scan_interval: 300
  name: 'mysensor brightness'

I would like to use the new service homeassistant.update_entity to request an update but it does not seem to update the value.

- service: homeassistant.update_entity
  entity_id: sensor.mysensor_brightness

Anyone had any success with this new service ?

EDIT: In case someone has the same issue: you need to add data: before the entity_id

    - service: homeassistant.update_entity
      data:
        entity_id: sensor.mysensor_brightness

Hello,

I keep getting this message in mij log. I’ve seen other people had the same problem, but could nog clearly see a sollutuion. I’m a bit of a newbee. :grinning:

Error parsing value: ‘list object’ has no attribute ‘state’ (value: [{“error”:{“type”:3,“address”:"/sensors/00:17:88:01:02:01:e5:5b-02-0402",“description”:“resource, /sensors/00:17:88:01:02:01:e5:5b-02-0402, not available”}}], template: {{ value_json.state.temperature | float / 100 }}

The sensor is showing but nog messurement is collected/showing

So this guide was a thoroughly great walkthrough and worked like a charm 1st time.
Thanks alot for the intro into the HUE Api + much more :+1:

As a fairly newb in HA, RB+, etc. (< 1 month)…
I haven’t quite found how to setup actions like sending e-mail or other push notification so that I can use the HUE Motion Sensor as an Alarm for our home.

Need to setup something along the lines of:

  1. Activate/Deactivate: “Alarm” state via remote/app/webpage button or whatever.

  2. Notifications: E-mail (preferred), SMS gateway or whatever avail push notifications.

  3. Turning on Sonos playing the “home alone sound” real loud :wink: or something along those lines, flashing HUE etc.

  4. Stop/Start Alarm state (for test and turning the Alarm state off…)

Edit: got an email script up and running, still need to get the motion detection to trigger the script.

Again thanks a lot! (Ohh and Happy New Year!)

You’re welcome :slight_smile:

I activate/deactivate alarm by enabling an input_boolean. Then I have triggers on certain changes like a door/window sensor that opens.
If the alarm is turned on (boolean enabled) and no one is home, I run the alarm script. In the script you can put whatever you want like your email notification, telegram notification, turn on sonos etc.

As an example:

- alias: 'Alarm Raam achter Open Not Home'
  trigger:
  - platform: state
    entity_id: sensor.overloop
    from: "0"
    to: "1"
  condition: 
    condition: and
    conditions: 
      - condition: state
        entity_id: input_boolean.alarm
        state: 'on'
      - condition: state
        entity_id: input_boolean.guests
        state: 'off'
      - condition: state
        entity_id: binary_sensor.anyone_presence
        state: 'off'
  action:
    - service: homeassistant.turn_on
      entity_id: script.alarmtrigger3
1 Like

can anyone confirm this approach works also for the new outdoor motion sensor?

I wouldn’t know why not. It’s a matter of finding the device in the API.
By the way you can also use Zigbee2mqtt. It has much much faster responses!
Because the motion sensor sends it directly to the zigbee2mqtt usbstick so there is no polling happening by the Philips hue hub.
I have the motion sensors now linked to zigbee2mqtt and only the lights are linked to the Hue hub.

2 Likes

I’ve had the same issue. I did fix this by comparing with a more precise thermometer in the room and found the error factor. The factor I then multiplied to the value in the customization to fix the value.

would be interested in your findings, please share what the factor could be? Ive simply added 1.5 degrees, knowing of course that isn’t very exact either…

So I tried to put this code in my config (of course with my sensors credentials), but when I press “Check configuration” I get:

Error loading /config/configuration.yaml: while parsing a block mapping
in "/config/configuration.yaml", line 3, column 1
expected <block end>, but found '-'
in "/config/configuration.yaml", line 62, column 1

What am I missing here?

Are you sure you put it in the sensor section?
This works for me:

sensor:
  - platform: rest
    resource: http://x.xx.xxx.xxx/api/IorpxxxxxxxxxxxxxxxHMdR6cJB0LoR/sensors/11
    value_template: '{{ value_json.state.lightlevel }}'
    unit_of_measurement: Lux
    name: 'Woonkamer 3'
    scan_interval: 60

And make sure all indentatations are correct.
Let me know if you succeed.

If someone would have mentioned that I need to write the word “sensor:” before the code, I would have known. There are newbies here also.
Many thanks, it now works. Much appreciated.

I can imagine for newbies not everything is always clear :). I can’t edit the starting post anymore though.
Glad it’s working!

I just purchased a Hue Motion Sensor, and while reading thru this very informatitve post, I was hoping these steps were no longer required since the post was originally from 2016, but since there is a current reply in this February, I am assuming the steps are still required to get the unit working correctly with HA?

i wish someone would make a video about this process and put on YouTube

The steps described in these instructions have not been needed for a long time. It is enough to simply set up the Hue integration in Home Assistant, and the motion sensor will be detected automatically.

Maybe a moderator should move this thread to the archive once to avoid confusion?