Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95370

Quick question about template sensor

$
0
0

@mefistofelis wrote:

If I enter the following in developers tools template i get the minutes that have passed since the door was closed. When I use it as a template sensor i get 0.

This works:
{{ ((as_timestamp(now())-as_timestamp(states.binary_sensor.sensor.last_changed))/60) | round | int }}

This doesnt:

- platform: template
  sensors:
    door_closed_since:
      entity_id: binary_sensor.sensor
      value_template: "{{ ((as_timestamp(now())-as_timestamp(states.binary_sensor.sensor.last_changed))/60) | round | int }}"
      friendly_name: "Time since Door was closed"

Any help?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95370

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>