Advertisement
energywave

Home Assistant - Lavatrice, asciugatrice, piscina

Feb 10th, 2021 (edited)
1,113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.42 KB | None | 0 0
  1. binary_sensor:
  2.   - platform: template
  3.     sensors:
  4.       asciugatrice_run:
  5.         friendly_name: 'Asciugatrice in funzione'
  6.         device_class: power
  7.         delay_on:
  8.           minutes: 10
  9.         delay_off:
  10.           minutes: 3
  11.         value_template: >-
  12.           {{ states('sensor.asciugatrice_power')|float(0) > 50 }}
  13.         icon_template: >
  14.          {% if is_state('binary_sensor.asciugatrice_run','on') %}
  15.             mdi:tumble-dryer
  16.           {% else %}
  17.             mdi:tumble-dryer-off
  18.           {% endif %}
  19.   - platform: template
  20.     sensors:
  21.       lavatrice_run:
  22.         friendly_name: 'Lavatrice in funzione'
  23.         device_class: power
  24.         delay_on:
  25.           seconds: 30
  26.         delay_off:
  27.           minutes: 8
  28.         value_template: >-
  29.           {{ states('sensor.lavatrice_power')|float(0) > 50 }}
  30.         icon_template: >
  31.          {% if is_state('binary_sensor.lavatrice_run','on') %}
  32.             mdi:washing-machine
  33.           {% else %}
  34.             mdi:washing-machine-off
  35.           {% endif %}
  36.      
  37. automation:
  38. # Pompa piscina consuma troppo
  39. - alias: Pompa piscina consuma troppo
  40.   description: Blocca e avvisa se la pompa della piscina consuma troppo
  41.   trigger:
  42.     - platform: numeric_state
  43.       entity_id: sensor.pompa_piscina_power
  44.       above: 190
  45.   action:
  46.     - service: switch.turn_off
  47.       entity_id: switch.pompa_piscina
  48.     - service: script.multinotify
  49.       data:
  50.         title: Sovraccarico pompa piscina
  51.         message: La pompa della piscina sta consumando {{trigger.to_state.state|round(default=0)}} watt, è stata disattivata per sicurezza. Verificare se necessario effettuare la pulizia del filtro a sabbia.
  52.         notify_app: notify.all_devices
  53.         channel: electricity
  54.         critical: true
  55.         alexa_target: media_player.ovunque
  56.  
  57. # Avviso asciugatrice ha finito (aggiungo 7 minuti al tempo rilevato perchè il sensore di run ha un tempo di attivazione di 10 minuti e uno di disattivazione di 3: differenza 7 minuti in meno del reale...)
  58. - alias: Fine asciugatrice
  59.   description: Avviso quando l'asciugatrice finisce
  60.   trigger:
  61.   - entity_id: binary_sensor.asciugatrice_run
  62.     from: 'on'
  63.     platform: state
  64.     to: 'off'
  65.   condition: []
  66.   action:
  67.     - service: script.multinotify
  68.       data:
  69.         title: Asciugatrice ha finito
  70.         message: >
  71.          {% set seconds = now().timestamp() - as_timestamp(trigger.from_state.last_changed) + 7*60 %}
  72.           {% set hours = (seconds / 3600) | int(0) %}
  73.           {% set minutes = (seconds % 3600 / 60) | int(0) %}
  74.           {% set hours_word = "ora" if hours==1 else "ore" %}
  75.           {% set minutes_word = "minuto" if minutes==1 else "minuti" %}
  76.           L'asciugatrice ha terminato il ciclo dopo {{hours}} {{hours_word}} e {{ minutes}} {{minutes_word}}
  77.         notify_app: notify.all_devices
  78.         channel: info
  79.         critical: true
  80.         alexa_target: media_player.ovunque
  81.  
  82. # Avviso lavatrice ha finito
  83. - alias: Fine lavatrice
  84.   description: Avviso quando la lavatrice finisce
  85.   trigger:
  86.   - entity_id: binary_sensor.lavatrice_run
  87.     from: 'on'
  88.     platform: state
  89.     to: 'off'
  90.   condition: []
  91.   action:
  92.     - service: script.multinotify
  93.       data:
  94.         title: Lavatrice ha finito
  95.         message: La lavatrice ha terminato il lavaggio!
  96.         notify_app: notify.all_devices
  97.         channel: info
  98.         critical: true
  99.         alexa_target: media_player.ovunque
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement