Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.35 KB | None | 0 0
  1. homeassistant:
  2.   customize:
  3.     sensor.downstairs_litter_box_visits:
  4.       icon: mdi:poop
  5.     binary_sensor.motion_sensor_158d0001a24ef1:
  6.       friendly_name: Downstairs Litter Box
  7. #-------------------------------------------
  8.  
  9. sensor:
  10.   - platform: mqtt
  11.     state_topic: "dummy/downstairslitterbox/count"
  12.     name: Downstairs Litter Box Visits
  13.     unit_of_measurement: "visits"
  14.  
  15. #-------------------------------------------
  16.  
  17. automation:
  18.   - alias: Set Downstairs Litter Box Sensor To Zero On Start
  19.     trigger:
  20.       platform: homeassistant
  21.       event: start
  22.     action:
  23.       - service: python_script.dlitter_reset
  24.    
  25.    
  26.   - alias: Count visits to downstairs litter box
  27.     trigger:
  28.       - platform: state
  29.         entity_id: binary_sensor.motion_sensor_158d0001a24ef1
  30.         to: 'on'
  31.     condition:
  32.     - condition: template
  33.       value_template: >
  34.        {% if states.automation.count_visits_to_downstairs_litter_box.last_triggered is not none %}
  35.           {% if as_timestamp(now()) | int   -  as_timestamp(states.automation.count_visits_to_downstairs_litter_box.attributes.last_triggered) | int > 300 %} true {% else %} false
  36.           {% endif %}
  37.         {% else %}
  38.         false
  39.         {% endif %}
  40.     action:
  41.       - service: python_script.dlitter_counter
  42.  
  43.   - alias: Send notification when downstairs litter box is used more than three times
  44.     trigger:
  45.       - platform: numeric_state
  46.         entity_id: sensor.downstairs_litter_box_visits
  47.         above: '2'
  48.       - platform: state
  49.         entity_id: device_tracker.isabellas_iphone_6s
  50.         to: 'home'
  51.         for:
  52.           minutes: 10
  53.     condition:
  54.       condition: and
  55.       conditions:
  56.         - condition: time
  57.           after: '07:00:00'
  58.           before: '23:00:00'
  59.         - condition: state
  60.           entity_id: device_tracker.isabellas_iphone_6s
  61.           state: 'home'
  62.         - condition: numeric_state
  63.           entity_id: sensor.downstairs_litter_box_visits
  64.           above: '2'
  65.     action:
  66.       - service: notify.ios_isabellas_iphone_6s
  67.         data:
  68.           title: 'Time to clean!'
  69.           message: 'More than three visits to downstairs litter box'
  70.  
  71.   - alias: Reset downstairs litter box visit counter
  72.     trigger:
  73.       - platform: state
  74.         entity_id: binary_sensor.white2
  75.     action:
  76.       - service: python_script.dlitter_reset
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement