Advertisement
Guest User

plantegramming_better

a guest
May 25th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.86 KB | None | 0 0
  1. - alias: Notify when a plant needs attention
  2.   trigger:
  3.     platform: state
  4.     entity_id: binary_sensor.peter_in_bedroom
  5.     from: 'off'
  6.     to: 'on'
  7.   condition:
  8.     condition: and
  9.     conditions:
  10.     - condition: time
  11.       after: '08:30:00'
  12.       before: '22:00:00'
  13.     - condition: or
  14.       conditions:
  15.         - condition: state
  16.           entity_id: plant.zamiculcas
  17.           state: 'problem'
  18.         - condition: state
  19.           entity_id: plant.dracaena
  20.           state: 'problem'
  21.   action:
  22.     - service: tts.google_say
  23.       data_template:
  24.         entity_id: "media_player.peter_ghome"
  25.         message: >
  26.          {% if not is_state_attr('plant.zamiculcas', 'problem', 'none') and not is_state_attr('plant.zamiculcas', 'problem', 'brightness low') and is_state_attr('plant.dracaena', 'problem', 'none') and is_state_attr('plant.dracaena', 'problem', 'brightness low')%}
  27.           "The Zamiculcas plant needs attention. The problem is {{ state_attr('plant.zamiculcas', 'problem') }}"
  28.           {% elif not is_state_attr('plant.dracaena', 'problem', 'none') and not is_state_attr('plant.dracaena', 'problem', 'brightness low') and is_state_attr('plant.zamiculcas', 'problem', 'none') and is_state_attr('plant.zamiculcas', 'problem', 'brightness low') %}
  29.           "The Dracaena plant needs attention. The problem is {{ state_attr('plant.dracaena', 'problem') }}"
  30.           {% elif not is_state_attr('plant.dracaena', 'problem', 'none') and not is_state_attr('plant.dracaena', 'problem', 'brightness low') and not is_state_attr('plant.zamiculcas', 'problem', 'none') and not is_state_attr('plant.zamiculcas', 'problem', 'brightness low') %}
  31.           "Both of your plants needs attention. The problem with the Dracaena is {{ state_attr('plant.dracaena', 'problem') }} and the Zamiculcas is {{ state_attr('plant.zamiculcas', 'problem') }}"
  32.           {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement