Untitled

mail@pastecode.io avatar
unknown
plain_text
22 days ago
4.4 kB
1
Indexable
Never
alias: Controllo meteo per il robottino
description: >-
  Controlla le condizioni meteo e gestisce il parcheggio e i timer del robottino
  in caso di maltempo.
trigger:
  - platform: state
    entity_id: sensor.openweathermap_weather_code
  - platform: time_pattern
    minutes: "29"
  - platform: time_pattern
    minutes: "59"
condition:
  - condition: state
    entity_id: input_boolean.controllo_robottino
    state: "on"
action:
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {{ states('sensor.openweathermap_weather_code')|int in [600, 601,
              602, 611, 612, 613, 615, 616, 620, 621, 622] }}
        sequence:
          - service: switch.turn_off
            target:
              entity_id: switch.erbinator2_enable_schedule
            data: {}
          - service: timer.start
            target:
              entity_id: timer.meteo_robottino
            data:
              duration: "168:00:00"
          - service: input_text.set_value
            data:
              value: Neve. Parcheggiato per una settimana.
            target:
              entity_id: input_text.weather_status
          - service: telegram_bot.send_message
            data:
              chat_id: chat_talpa_id
              message: Attenzione!!! Porta dentro il robottino che nevica.
      - conditions:
          - condition: template
            value_template: >-
              {{ states('sensor.openweathermap_weather_code')|int not in [600,
              601, 602, 611, 612, 613, 615, 616, 620, 621, 622] }}
          - condition: template
            value_template: "{{ 'neve' not in states('input_text.weather_status')|lower }}"
        sequence:
          - choose:
              - conditions:
                  - condition: template
                    value_template: >-
                      {{ states('sensor.openweathermap_weather_code')|int in
                      [200, 201, 202, 210, 211, 212, 221, 230, 231, 232] }}
                sequence:
                  - service: switch.turn_off
                    target:
                      entity_id: switch.erbinator2_enable_schedule
                    data: {}
                  - service: timer.start
                    target:
                      entity_id: timer.meteo_robottino
                    data:
                      duration: "02:00:00"
                  - service: input_text.set_value
                    data:
                      value: Temporale. Parcheggiato per 120 minuti.
                    target:
                      entity_id: input_text.weather_status
              - conditions:
                  - condition: template
                    value_template: >-
                      {{ states('sensor.openweathermap_weather_code')|int in
                      [300, 301, 302, 310, 311, 312, 313, 314, 321, 500, 501,
                      502, 503, 504, 511, 520, 521, 522, 531] }}
                sequence:
                  - service: switch.turn_off
                    target:
                      entity_id: switch.erbinator2_enable_schedule
                    data: {}
                  - service: timer.start
                    target:
                      entity_id: timer.meteo_robottino
                    data:
                      duration: "01:00:00"
                  - service: input_text.set_value
                    data:
                      value: Piove. Parcheggiato per 60 minuti.
                    target:
                      entity_id: input_text.weather_status
              - conditions:
                  - condition: template
                    value_template: >-
                      {{ states('sensor.openweathermap_wind_speed')|float > 60
                      }}
                sequence:
                  - service: switch.turn_off
                    target:
                      entity_id: switch.erbinator2_enable_schedule
                    data: {}
                  - service: timer.start
                    target:
                      entity_id: timer.meteo_robottino
                    data:
                      duration: "00:30:00"
                  - service: input_text.set_value
                    data:
                      value: Vento forte. Parcheggiato per 30 minuti.
                    target:
                      entity_id: input_text.weather_status
mode: restart
Leave a Comment