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

Template dependent on other template

$
0
0

@jonassam wrote:

Hi!
I have two templated Binary Sensors to track two persons presence (person1_home_sensor and person2_home_sensor), and a third one (away_mode) depending on the state of the two first. Like this:

binary_sensor:
  - platform: template
    sensors:
      person1_home_sensor:
        friendly_name: Person1 Home
        device_class: occupancy
        value_template: '{{ is_state("device_tracker.person1_iphone", "home") }}'
      person2_home_sensor:
        friendly_name: Person2 Home
        device_class: occupancy
        value_template: '{{ is_state("device_tracker.person2_iphone", "home") }}'
      away_mode:
        friendly_name: Away Mode
        device_class: occupancy
        value_template: >-
          '{{ "on" if (is_state("binary_sensor.person1_home_sensor", "off") and 
          is_state("binary_sensor.person2_home_sensor", "off")) else "off" }}'

The two first works just like they should, but the away_mode sensor does not update correctly. Testing the templates in the Developer Tools, everything works as I would like, but not with the actual sensors.

Is it not possbile to have a template sensor dependent on other template sensors like this? It would of course be possible with an automation, but this would be much more elegant…

Best regards,
Jonas

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95437

Trending Articles



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