Hue Motion Sensor Device class

Hi,

I try to get my hue motion sensors to the right device class (motion)

my code is

and customize

 sensor.gang_boven_motion:
    icon: mdi:account-alert
    device_class: motion

anyone got a idea?

HI this is in my sensors.yaml:

  - platform: rest
    resource: http://x.x.x.x/api/xxxxxxxxxxxxxxxx/sensors/22
    value_template: '{{ value_json.state.presence}}'
    name: 'Office Motion'
    scan_interval: 10

I have the same result - is it the word ‘True’ you are trying to change?

Yes, i want them both to be clear or the other one :stuck_out_tongue:

Try to put the device_class under the REST sensor, my config and it act like clear/detected:

- platform: rest
  resource: http://_IP_/api/_key_/sensors/12
  value_template: '{{ value_json.state.status }}'
  name: 'Beweging woonkamer achter'
  device_class: motion
  scan_interval: 2

Nope, no diferance

Mine all have clear as well (mixture of Hue and Xiaomi), so the one with true seems to be the odd one. Can you post code of both? How do they look in the “Current entities” list?

Enity

sensor.gang_beneden_motion False
friendly_name: Gang Beneden Motion
icon: mdi:account-alert
device_class: motion

code

I think i see the difference,

value_template: ‘{{ value_json.state.status }}’

and

value_template: ‘{{ value_json.state.presence }}’

When i use

value_template: ‘{{ value_json.state.status }}’

i’m getting nu state at all.

Try using a binary_sensor instead of a sensor. This should allow you to use the device_class configuration variable.

I think you are using a virtual sensor for one and not for to the other sensor. That’s the reason you get no state info when changing from ‘state’ to ‘presence’. Set them both to the corresponding sensor ID (look for presence) as given in the CLIP API Debugger.