Advertisement
energywave

Automazione ventola Raspberry Pi

Feb 5th, 2021 (edited)
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.95 KB | None | 0 0
  1. # Automazione per accendere/spegnere la ventola del Raspberry alla soglia dei 50°
  2. # Dati i seguenti sensori:
  3. # - sensor.cpu_temp - Sensore temperatura Raspberry Pi
  4. # - switch.ventola_rpi - Switch ventola Raspberry Pi
  5. # Nota: la ventola si accenderà quando la temperatura supererà i gradi impostati dall'input_number
  6. #       temperatura_max_rpi per almeno 10 secondi. Si spegnerà poi quando tornerà sotto al valore
  7. #       configurato in temperatura_max_rpi per almeno 30 secondi.
  8. #       I tempi sono per creare un'isteresi che eviti di far continuare ad accendere e spegnere
  9. #       la ventola in rapida successione e possono essere ulteriormente affinati in base alle necessità.
  10. input_number:
  11.   temperatura_max_rpi:
  12.     name: Temperatura ventola RPI
  13.     min: 20
  14.     max: 85
  15.     mode: slider
  16.     step: 1
  17.  
  18. automation:
  19.   - alias: rpi_accendi_ventola
  20.     description: 'Accendi la ventola del Raspberry quando il sudore pervade la CPU...'
  21.     trigger:
  22.       - platform: numeric_state
  23.         entity_id: sensor.cpu_temp
  24.         above: input_number.temperatura_max_rpi
  25.         for: "00:00:10"
  26.       - platform: state
  27.         entity_id: input_number.temperatura_max_rpi
  28.     condition:
  29.       - condition: numeric_state
  30.         entity_id: sensor.cpu_temp
  31.         above: input_number.temperatura_max_rpi
  32.     action:
  33.       - service: switch.turn_on
  34.         entity_id: switch.ventola_rpi
  35.  
  36.   - alias: rpi_spegni_ventola
  37.     description: 'Spegni la ventola del Raspberry prima che prenda il raffreddore...'
  38.     trigger:
  39.       - platform: numeric_state
  40.         entity_id: sensor.cpu_temp
  41.         below: input_number.temperatura_max_rpi
  42.         for: "00:00:30"
  43.       - platform: state
  44.         entity_id: input_number.temperatura_max_rpi
  45.     condition:
  46.       - condition: numeric_state
  47.         entity_id: sensor.cpu_temp
  48.         below: input_number.temperatura_max_rpi
  49.     action:
  50.       - service: switch.turn_off
  51.         entity_id: switch.ventola_rpi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement