py-smart-gardena / hass-gardena-smart-system

Home Assistant custom component integration for Gardena Smart System
Apache License 2.0
208 stars 53 forks source link

Discussion: Examples for irrigation automations with this integration #30

Closed northpower25 closed 4 years ago

northpower25 commented 4 years ago

I think it helps all (specialy new users) if we collect and discus automations (here for irrigation controll) and rerequisits for those. For mowing we discuss this here -> #32

northpower25 commented 4 years ago

Target: Watering the lawn based on the current soil moisture and time of day. With the aim that the lawn is watered sufficiently but is not too wet.

Why not with the Gardena App: The problem of Gardena automation for lawn irrigation is that this ...

  1. not flexible enough for soil moisture
  2. not dynamic enough
  3. Lawn gets too wet
  4. Water consumption is too high

Requirements

Automation example:

  alias: Bewässerung Garten
  trigger:
    platform: time_pattern
    minutes: '/15'
    seconds: 0
  condition:
    condition: and
    conditions:
     - condition: state
       entity_id: timer.gartenbewaesserung
       state: 'idle'
     - condition: numeric_state
       entity_id: sensor.garten_sensor_light_intensity
       below: 10
     - condition: numeric_state
       entity_id: sensor.beet_sensor_light_intensity
       below: 10
     - condition: numeric_state
       entity_id: sensor.garten_sensor_ambient_temperature
       above: 5
     - condition: numeric_state
       entity_id: sensor.garten_sensor_soil_humidity
       below: 10
  action:
    - service: timer.start
      entity_id: timer.gartenbewaesserung
    - service: switch.turn_on
      entity_id: switch.garten_water_control
    - delay: 0:12:00 
    - service: switch.turn_off
      entity_id: switch.garten_water_control
    - delay: 0:60:00 
    - service: switch.turn_on
      entity_id: switch.garten_water_control
    - delay: 0:24:00
    - service: switch.turn_off
      entity_id: switch.garten_water_control
    - delay: 0:60:00
    - service: switch.turn_on
      entity_id: switch.garten_water_control
    - delay: 0:24:00
    - service: switch.turn_off 
northpower25 commented 4 years ago

Target: Notification over HomeAssistant Companion App or as Telegram Messenger message or over Amazon Alexa with the help of Alexa Media Player Integration

Why not with the Gardena App: It is not possible to get Messages from the status of the smart water or the sensor devices.

It is not possible to get this notifications over Amazon Alexa from the App

Requirements

  1. Installed hass-gardena-smart-system integration
  2. Home Assistant Compagnion iOS or Android App
  3. Gardena smart control
  4. Gardena Smart Sensor or other sensors for depending values
  5. Gardena Pipeline System
  6. (optional) Telegram Messenger Integration
  7. (optional) Alexa Media Player Integration you can find and install this Integration over HACS

Configuration: only needed for Telegram

**Automation example:**
```- alias: "Benachrichtigung Bewässerung Garten an"
  trigger:
    platform: state
    entity_id: switch.garten_water_control
    to: 'on'
  action:
    - service: notify.notify
      data:
        title: "Bewässerung Garten"
        message: "Bewässerung im Garten wurde gestartet"
    - service: notify.alexa_media
      data:
        data:
          type: announce
        target: 
          - media_player.radio_wohnzimmer
        message: "Die Bewässerung im Garten wurde gestartet. Die Feuchtigkeit beträgt aktuell {{ states.sensor.garten_sensor_humidity.state }}% die Temperatur liegt bei {{ states.sensor.garten_sensor_temperature.state }}°C"
    - service: notify.telegram_[you Telegram channel]
      data_template:
        title: '*Bewässerung Garten gestartet!*'
        message: "Die Bewässerung im Garten wurde gestartet. Die Feuchtigkeit beträgt aktuell {{ states.sensor.garten_sensor_humidity.state }}% die Temperatur liegt bei {{ states.sensor.garten_sensor_temperature.state }}°C -> https://[public HA URL]/lovelace/terrasse"
        data:
            inline_keyboard:
            - 'Bewässerung beenden:/stopbewaesserunggarten'
            - ' Für 3 Stunden stoppen:/stopbewaesserunggarten3h, Für 24 Stunden stoppen:/stopbewaesserunggarten24h'

- id: 'telegram_stop_bewaesserung_garten'
  alias: 'Telegram Bewässerung Garten stoppen'

  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: '/stopbewaesserunggarten'
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: 'OK, ich beende die Bewässerung im Garten'
  - service: switch.turn_off
    entity_id: switch.garten_water_control
  - service: notify.telegram_[you Telegram channel]
    data_template:
      title: '*Bewässerung Garten!*'
      message: "Bewässerung im Garten gestoppt https://[public HA URL]/lovelace/terrasse"

- id: 'telegram_stop_bewaesserung_garten_3h'
  alias: 'Telegram Bewässerung 3h stoppen'
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: '/stopbewaesserunggarten3h'
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: 'OK, unterbreche die Bewässerung für 3 Stunden'
  - service: automation.turn_off
    entity_id: automation.bewasserung_garten
  - service: notify.telegram_[you Telegram channel]
    data_template:
      title: '*Bewässerung Garten!*'
      message: "Bewässerung im Garten für 3 Stunden unterbrochen https://[public HA URL]/lovelace/terrasse"
  - delay: '03:00:00'
  - service: automation.turn_on
    entity_id: automation.bewasserung_garten
  - service: notify.telegram_[you Telegram channel]
    data_template:
      title: '*Bewässerung Garten!*'
      message: "Automatisierung für Bewässerung im Garten wurde nach 3 Stunden wieder gestartet https://[public HA URL]/lovelace/terrasse"

- id: 'telegram_stop_bewaesserung_garten_24h'
  alias: 'Telegram Bewässerung 24h stoppen'
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: '/stopbewaesserunggarten24h'
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: 'OK, unterbreche die Bewässerung für 24 Stunden'
  - service: automation.turn_off
    entity_id: automation.bewasserung_garten
  - service: notify.telegram_[you Telegram channel]
    data_template:
      title: '*Bewässerung Garten!*'
      message: "Bewässerung im Garten für 24 Stunden unterbrochen https://[public HA URL]/lovelace/terrasse"
  - delay: '24:00:00'
  - service: automation.turn_on
    entity_id: automation.bewasserung_garten
  - service: notify.telegram_[you Telegram channel]
    data_template:
      title: '*Bewässerung Garten!*'
      message: "Automatisierung für Bewässerung im Garten wurde nach 24 Stunden wieder gestartet https://[public HA URL]/lovelace/terrasse"

- alias: "Benachrichtigung Bewässerung Garten aus"
  trigger:
    platform: state
    entity_id: switch.garten_water_control
    to: 'off'
  action:
    - service: notify.notify
      data:
        title: "Bewässerung Garten"
        message: "Bewässerung im Garten wurde beendet"      
   - service: notify.alexa_media
      data:
        data:
          type: announce
        target: 
          - media_player.radio_wohnzimmer
        message: ""Die Bewässerung im Garten wurde beendet. Die Feuchtigkeit beträgt jetzt {{ states.sensor.garten_sensor_humidity.state }}%"
    - service: notify.telegram_[you Telegram channel]
      data_template:
        title: '*Bewässerung Garten beendet!*'
        message: "Die Bewässerung im Garten wurde beendet. Die Feuchtigkeit beträgt jetzt {{ states.sensor.garten_sensor_humidity.state }}% -> https://[public HA URL]/lovelace/terrasse"
grm commented 4 years ago

Hello Northpower,

Thx, this is a very good initiative ! I think it deserves a RECIPE.md. Would you mind to create a PR with them ?

And also, sorry for that, but I don't speak german at all, would you mind translate them in english at the same time so most of the people can take advantage of it ?

Thx again, Jérémie

northpower25 commented 4 years ago

Thx for the compliment! Yes i will do this both tomorow!

northpower25 commented 4 years ago

@grm see here -> #31 i hope i make no typos on the the translation 🙈

grm commented 4 years ago

This has been added to a RECIPE.md

Thanks @northpower25