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

Newbie: "if + and" - action with switch and sensor

$
0
0

Hello, could you please advise me how to do? I just started with Home Assistant and I am not used at all to yaml but I will give my best. :wink:

The part which is marked with #, I don’t know how to code.

alias: Ladeeinheit 1
trigger:
  - platform: time_pattern
    minutes: /1
condition:
  - condition: time
    after: '05:00:00'
    before: '22:00:00'
    weekday:
      - mon
      - tue
      - wed
      - fri
      - sat
      - thu
      - sun
action:
  - service: |
      {% if states('sensor.differenzverbrauch')|int < -80 %} 
          switch.turn_on
      {% elif states('sensor.differenzverbrauch')|int > 80%} 
          switch.turn_off {% endif %} 
    entity_id: switch.plug_1_switch
  - delay: '00:00:03'
#  - service: |
#      {% if (states('sensor.differenzverbrauch')|int < -80) and (is_state('switch.plug_1_switch', 'on') %} 
#          switch.turn_on
#      {% elif (states('sensor.differenzverbrauch')|int > 80%) and (is_state('switch.plug_1_switch', 'off') } 
#          switch.turn_off {% endif %} 
#    entity_id: switch.plug_2_switch
mode: single

The Idea:

1. if sensor.differenzverbrauch < -80 then switch on Plug1

1. if sensor.differenzverbrauch < -80 and Plug 1 = on then switch on Plug2

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 111206

Trending Articles



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