Motion sensor does not change color when active

I have also added motion sensors but they never change color.

    - type: state-icon
      icon: mdi:google-home
      entity: sensor.kitchen_motion_sensor
      style:
        top: 43%
        left: 34%
      "--paper-item-icon-color": rgb(89, 89, 89)
      "--paper-item-icon-active-color": yellow brightness(130%) saturate(1.5) drop-shadow(0px 0px 10px black)

Feels like i have tried everything now…
(probably not :P)

Try this;
I’ve been playing with a small form of icon colour depending upon state. I use it with icons to show movement and door opening state being returned from my alarm system. Each alarm sensor as you know returns a value ‘T’ for triggered state and ‘-’ when in a non-triggered state.

I have defined binary_sensors, like this;

- platform: template
  sensors:
  office_movement:
    device_class: motion
    value_template: "{{ is_state('sensor.visonic_z07', 'T') }}"
  front_door:
    device_class: door
    value_template: "{{ is_state('sensor.visonic_z01', 'T') }}"

which means that I can then place sensors on picture-elements cards to show the entity icon only, using

      - type: state-icon
        tap_action: more-info
        entity: binary_sensor.office_movement
        style:
          top: 89%
          left: 53%

image

vs

image
or onto entity cards for the full status

  - type: entities
    entities:
      - entity: binary_sensor.hallway_movement
        name: Hallway Movement
        secondary_info: last-changed
      - entity: binary_sensor.kitchen_movement
        name: Kitchen Movement
        secondary_info: last-changed
      - entity: binary_sensor.office_movement
        name: Office Movement
        secondary_info: last-changed

image

vs
image

1 Like

I agree with @isablend, the paper-item-icon-active-color seems to only work with binary_sensor, try convert kitchen_motion_sensor into binary_sensor.

1 Like

It’s worth stating that with a binary_sensor you can set the ‘un-triggered’ state icon colour,

      - type: state-icon
        tap_action: more-info
        entity: binary_sensor.office_movement
        style:
          top: 89%
          left: 53%
          "--paper-item-icon-color": green

but that the ‘triggered’ state is ‘yellow’.

1 Like

Thank you guys it worked.

  - platform: template
    sensors:
      kitchen_movement:
        device_class: motion
        value_template: "{{ is_state('sensor.hallway_presence', 'True') }}"
      hallway_movement:
        device_class: motion
        value_template: "{{ is_state('sensor.kitchen_presence', 'True') }}"

    - type: state-icon
      icon: mdi:google-home
      entity: binary_sensor.hallway_movement
      style:
        top: 30%
        left: 55%
      "--paper-item-icon-color": rgb(89, 89, 89)
      "--paper-item-icon-active-color": yellow brightness(130%) saturate(1.5) drop-shadow(0px 0px 10px black)
    - type: state-icon
      icon: mdi:google-home
      entity: binary_sensor.kitchen_movement
      style:
        top: 43%
        left: 34%
      "--paper-item-icon-color": rgb(89, 89, 89)
      "--paper-item-icon-active-color": yellow brightness(130%) saturate(1.5) drop-shadow(0px 0px 10px black)