Need help for a template sensor with few conditions

Hi everyone,

can someone please help me to put all these conditions into a template sensor?
I am totally lost and don’t know where or how to start. :frowning:

I am very grateful for any help.

condition: and
conditions:
  - condition: state
    entity_id: binary_sensor.verschattung_markise
    state: "on"
  - condition: numeric_state
    entity_id: sensor.memmingen_windgeschwindigkeit
    below: 24
  - condition: numeric_state
    entity_id: sensor.memmingen_bewolkungsgrad
    below: 60
  - type: is_not_moist
    condition: device
    device_id: 2eda8077e5237cf6d6ae1a66474e33c6
    entity_id: a77a4b0b6efa9f57b3afa12ebb18e8e8
    domain: binary_sensor
  - condition: numeric_state
    entity_id: weather.memmingen
    attribute: temperature
    above: 20
  - condition: numeric_state
    entity_id: sensor.temperatursensor_terrasse_temperatur
    above: 22
  - condition: device
    device_id: a391cd42102efb7b62109cfe2f56b391
    domain: cover
    entity_id: 7036aa674311c7b5ce97826d4fa11675
    type: is_position
    above: 99

I assume you intend to use the template in a Template Binary Sensor.

{{ is_state('binary_sensor.verschattung_markise', 'on')
  and states('sensor.memmingen_windgeschwindigkeit') | float(0) < 24
  and states('sensor.memmingen_bewolkungsgrad') | float(0) < 60
  and is_state('binary_sensor.your_moisture_sensor', 'off')
  and state_attr('weather.memmingen', 'temperature') | float(0) > 20
  and states('sensor.temperatursensor_terrasse_temperatur') | float(0) > 22
  and state_attr('cover.your_cover', 'current_position') | int(0) > 99 }}

Replace binary_sensor.your_moisture_sensor and cover.your_cover with your actual entity_ids.

1 Like

You are amazing, thats it.

To explain why I find this useful, I don’t want my awning to constantly extend or retract when something changes within a few minutes, this binary sensor makes it possible for me to really have all the conditions together over e.g. 15 minutes for the awning to extend or retract.

Thanks so much!

{{ is_state('binary_sensor.verschattung_markise', 'on')
  and states('sensor.memmingen_windgeschwindigkeit') | float(0) < 24
  and states('sensor.memmingen_bewolkungsgrad') | float(0) < 60
  and is_state('binary_sensor.regensensor', 'off')
  and state_attr('weather.memmingen', 'temperature') | float(0) > 20
  and states('sensor.temperatursensor_terrasse_temperatur') | float(0) > 22
  and state_attr('cover.rolladen_shelly_wohnzimmer_fenster', 'current_position') | int(0) > 99 }}
1 Like