Advertisement
GrzegorzM

Zapalanie światła po otwarciu drzwi

Feb 21st, 2022 (edited)
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.34 KB | None | 0 0
  1. alias: Taras Światło
  2. description: ''
  3. trigger:
  4. #wywołaj gdy drzwi się otworzą
  5.   - platform: state
  6.     entity_id: binary_sensor.drzwi_tarasowe_contact
  7.     to: 'on'
  8.     id: taras_zapalamy
  9. #wywołaj gdy timer się wyzeruje
  10.   - platform: event
  11.     event_type: timer.finished
  12.     event_data:
  13.       entity_id: timer.taras_gaszenie_swiatla
  14.     id: taras_gasimy
  15. condition: []
  16. action:
  17. #wyłącz światło jeśli automatyzację wywołał timer (trigger taras_gasimy)
  18.   - choose:
  19.     - conditions:
  20.         - condition: trigger
  21.           id: taras_gasimy
  22.       sequence:
  23.         - service: switch.turn_off
  24.           target:
  25.             entity_id: switch.taras_l2
  26. #w przeciwnym razie
  27.     default:
  28. #kontyuuj jeśli natężenie świała poniżej
  29.       - condition: numeric_state
  30.         entity_id: sensor.swiatlo_front_illuminance_lux
  31.         below: 12
  32. #wystartuj/restartuj timer gaszący światło
  33.       - service: timer.start
  34.         target:
  35.           entity_id: timer.taras_gaszenie_swiatla
  36. #włącz światło jeśli było wyłączone
  37.       - choose:
  38.         - conditions:
  39.             - condition: state
  40.               entity_id: switch.taras_l2
  41.               state: 'off'
  42.           sequence:
  43.             - service: switch.turn_on
  44.               target:
  45.                 entity_id: switch.taras_l2
  46.         default: []
  47. mode: queued
  48. max: 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement