- type: entity
entity: binary_sensor.4_in_1_sensor_home_security_motion_detection
content_info: last-changed
icon_color: |
{% if is_state("input_boolean.away_switch", "on") %}
grey
{% else %}
green
{% endif %}
icon: mdi:motion-sensor
tap_action:
action: call-service
service: input_boolean.toggle
data: {}
target:
entity_id: input_boolean.away_switch
- type: template
entity: |-
binary_sensor.4_in_1_sensor_home_security_motion_detection
{% endif %}
icon_color: |
{% if is_state("input_boolean.away_switch", "on") %}
grey
{% else %}
green
{% endif %}
icon: |
{% if is_state("input_boolean.away_switch", "on") %}
mdi:motion-sensor-off
{% else %}
mdi:motion-sensor
{% endif %}
tap_action:
action: call-service
service: input_boolean.toggle
data: {}
target:
entity_id: input_boolean.away_switch
As you can see, the first âChipâ shows the time since motion was detected, but I wanted the color to change based on the state of switch. I then tried to recreate the chip as a template, but I cannot get it to display the time since motion was detected. I then tried to create a âHistory Statâ sensor and that doesnt seem to work either. Seems like it should be fairly simple but I am doing something wrong. O.o
- platform: history_stats
name: Motion Detection Duration
entity_id: binary_sensor.4_in_1_sensor_home_security_motion_detection
state: off
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"
type: time