Hue motion sensors + remotes: custom component


#325

Yes, using both single and double quotes solved it.

binary_sensor: 
- platform:                    template
  sensors:
    kitchen_motion:
      friendly_name:           Kitchen Motion
      device_class:            motion
      value_template:          '{{ states("sensor.kitchen_motion_sensor") == "on" }}'

    kitchen_sensor_reachable:
      friendly_name:           Kitchen Sensor Reachable
      device_class:            connectivity
      value_template:          '{{ states.sensor.kitchen_motion_sensor.attributes.reachable }}'

Thanks!


#326

I have a strange issue (strange since nobody reported the same it looks). Since I deployed this custom components I can nicely see (and use) my hue remotes in HA but I lost the ability to have my Hue lights reporting correctly their status (meaning the allow_unreachable does not work properly anymore …). When non powered (because the physical switch is off) lights do show are “unavailable” now instead of “off”. Did I miss something while deploying the components ? Thanks !


#327

This component performs read only of the sensor data, so I think your issue is unrelated. If you can dig up any error messages that would help diagnose the possible cause.
Cheers


#328

I can only see in the logs this
2018-03-15T17:07:44.908039281Z [32m2018-03-15 18:07:44 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=light.couloir, old_s
tate=None, new_state=<state light.couloir=unavailable; friendly_name=Couloir, supported_features=43 @ 2018-03-15T18:07:44.907683+01:00>>


#329

To validate my assumption I went ahead and deleted your custom components and indeed I still have the same issue so it seems not to be related … Thanks a lot and sorry for my stupid question then …


#330

Been bugging me for a while. Inset this up and then added in some other scenes so it appears to have changed the virtual sensor or links to the real sensor. Anyone know the best way to relink to correct one so it shows in front end?

Not even sure it’s an issue with sensors actually as I can still see when last motion occured by clicking on the sensor but doesn’t show ‘0’ ‘1’ ‘Off’ or ‘on’


#331

Does anyone know why my other discovered devices do not appear on the dashboard anymore after doing this?


#332

actually when i changed default view in groups.yaml to “no” it’s showing as expected.


#333

@robmarkcole HI Robin,

Maybe something worth considering:
Since you added the ‘on’ attribute on the motion sensor that word has gotten 2 meanings. It is either on/off, as in active or not, or On means it went off, or was triggered…

I have this neat little switch with which i can set the sensor on and off (very handy in specific circumstances) and the visual feedback is a bit confusing now.

motion_sensor_switch:
  friendly_name: "Motion sensor switch"
  command_on: >-
    curl -X PUT -d '{"on":true}' "ip/api/key/sensors/5/config"
  command_off: >-
    curl -X PUT -d '{"on":false}' "ip/api/key/sensors/5/config"
#     command_state: curl ip/api/key/sensors/5/
#     value_template: '{{value_json.config.on}}'
  value_template: >-
     "{{ is_state('sensor.corridor_motion_sensor', 'on') }}"

57

See above: sensor is On (active) but also Off (not triggered)…

Could you change the On, as in went off (was triggered) into just that?

Cheers,
Marius


#334

Does this actually turn the motion sensor off as you would normally do in the hue app? Been looking for something like this when watching a movie or having friends over


#335

Yes, works fine.
And you can use it in automations :+1:

The state command didn’t work here, threw many many errors and kept trying… hence I use the template switch to be able to use the sensor for State


#336

Thanksssss. Will test out soon while trying to relink the motion sensor


#337

Been trying to get the motion sensor.last_updated attribute to display in local time, but my Python Fu is not strong enough. :roll_eyes:

If I try to use some of the code I have seen it returns “Unknown” as the value.

Looking at the States I noticed though that the date format is different from all of the other date/times reurned. For example the sunrise is set to “next_dawn: 2018-03-25T18:03:29+00:00”, but the motion sensor last_updated is “last_updated: 2018-03-25,04:34:50”.

Does the date/time value need to be in the same format as the sunrise for the timestamp or strftime functions to work in templates?? Is there a way to manipulate the string value to achieve this??


#338

First try to correct the timezone in your Hue app. If that isn’t possible, then some string formatting should get you what you want. Cheers


#339

How do i get the sensor for phone?


#340

I recall there’s a setting in the Hue app for that. There’s a post somewhere in this thread on that topic


#341

look for Geofence in your api/key/sensors. Which is set when you allow your app to see when your home or not and use routines on that.

its needed for the script to see it:

elif self._model == 'Geofence':
    self._icon = 'mdi:cellphone'

btw @robmarkcole did you ever check why no mdi: cellphone icon was displayed, or how i could realize that it would…


#342

Please use the customize tool in HA. I won’t be making any further changes to the custom component as Hue is being upgraded.
Cheers


#343

ok i will, i was just wondering why this would be the only sensor that isn’t created with the icon you have set in the custom component. No way to trace maybe?


#344

I glanced at the code and don’t see anything obviously wrong