Husqvarna Lawn Mower - openweathermap

Hi everybody, I would like to share with you my project that will stop my robot to cut when the weather is not good. I used openweather codes so that I could use different codes for different statuses.

The triggers are 2:

  • 30 minutes (so that every 30 minutes it will perform the action, also if the weather does not change)
  • when the state of sensor.openweathermap_weather_code changes.

I used the different weather conditions codes (Weather Conditions - OpenWeatherMap) to create different groups that will generate different outputs.
If there is snow the robot must be parked for 1 week (so that I have the time to remember that it’s the case to take it home and wait for the spring…). If there is rain or wind speed over 60 parking for 35 minutes (but every 30 it will send another command, the +5 minutes it’s just for not having the robot go out and come back). Suppose there is a thunderstorm for 60 minutes. Smoke, sand, squalls, tornado 120 minutes (but I don’t think in my area I’ll ever see that).

There is also an “input_boolean.controllo_robottino” that if it’s on the weather check will not be performed, it’s just a failsafe.

I don’t use the weather forecasts because in my area the forecast it’s always “rainy” even on the most beautiful of days.

I hope that can be of inspiration to somebody. If you have any suggestions I’m happy the hear them.

Have a nice day :wink:

alias: Controllo meteo per il robottino
description: >-
  Controlla le condizioni meteo e mette in pausa il robottino in caso di
  maltempo
trigger:
  - platform: time_pattern
    minutes: /30
  - platform: state
    entity_id: sensor.openweathermap_weather_code
condition:
  - condition: state
    entity_id: input_boolean.controllo_robottino
    state: "off"
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: husqvarna_automower.custom_command
            data:
              command_type: actions
              json_string: |-
                {
                 "data": {"type": "Park", "attributes": {"duration": 10080}}
                }
            target:
              entity_id: vacuum.am405x
          - service: input_text.set_value
            data:
              value: Neve. Parcheggiato per una settimana.
            target:
              entity_id: input_text.weather_status
      - conditions:
          - condition: template
            value_template: >-
              {{ states('sensor.openweathermap_weather_code')|int in [200, 201,
              202, 210, 211, 212, 221, 230, 231, 232] }}
        sequence:
          - service: husqvarna_automower.custom_command
            data:
              command_type: actions
              json_string: |-
                {
                 "data": {"type": "Park", "attributes": {"duration": 60}}
                }
            target:
              entity_id: vacuum.am405x
          - service: input_text.set_value
            data:
              value: Temporale. Parcheggiato per 60 minuti.
            target:
              entity_id: input_text.weather_status
      - conditions:
          - condition: template
            value_template: >-
              {{ states('sensor.openweathermap_weather_code')|int in [731, 751,
              761, 762, 771, 781] }}
        sequence:
          - service: husqvarna_automower.custom_command
            data:
              command_type: actions
              json_string: |-
                {
                 "data": {"type": "Park", "attributes": {"duration": 120}}
                }
            target:
              entity_id: vacuum.am405x
          - service: input_text.set_value
            data:
              value: Condizioni atmosferiche avverse. 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] or 
              states('sensor.openweathermap_wind_speed')|float > 60 }}
        sequence:
          - service: husqvarna_automower.custom_command
            data:
              command_type: actions
              json_string: |-
                {
                 "data": {"type": "Park", "attributes": {"duration": 35}}
                }
            target:
              entity_id: vacuum.am405x
          - service: input_text.set_value
            data:
              value: Piove o vento forte. Parcheggiato per 35 minuti.
            target:
              entity_id: input_text.weather_status
    default:
      - service: input_text.set_value
        data:
          value: Tutto ok, robottino taglierĂ .
        target:
          entity_id: input_text.weather_status
mode: restart
1 Like

Very helpful. Thanks so much.

1 Like