Advertisement
Guest User

Time Home/Away

a guest
Nov 15th, 2018
3,135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.29 KB | None | 0 0
  1. ###### CUSTOMIZE ----------------------------------------
  2.  
  3.  
  4. homeassistant:
  5.   customize:
  6.     sensor.time_at_home_today:
  7.       icon: mdi:clock-outline
  8.     sensor.time_away_today:
  9.       icon: mdi:clock-outline
  10.  
  11.  
  12. ###### GROUPS ----------------------------------------
  13.  
  14.  
  15. group:
  16.   status:
  17.     control: hidden
  18.     entities:
  19.      - sensor.time_at_home_today
  20.       - sensor.time_away_today
  21.  
  22.  
  23. ###### SENSORS ------------------------------------------
  24.  
  25. sensor:
  26.   - platform: history_stats
  27.     name: Time Home
  28.     entity_id: binary_sensor.sean_presence
  29.     state: 'on'
  30.     type: time
  31.     start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  32.     end: '{{ now() }}'
  33.  
  34.   - platform: history_stats
  35.     name: Time Away
  36.     entity_id: binary_sensor.sean_presence
  37.     state: 'off'
  38.     type: time
  39.     start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  40.     end: '{{ now() }}'
  41.  
  42.      
  43.   - platform: template
  44.     sensors:
  45.       time_at_home_today:
  46.         friendly_name: 'Time Home Today'
  47.         value_template: '{{states.sensor.time_home.attributes.value}}'    
  48.  
  49.   - platform: template
  50.     sensors:
  51.       time_away_today:
  52.         friendly_name: 'Time Away Today'
  53.         value_template: '{{states.sensor.time_away.attributes.value}}'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement