Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 36.0755
longitude: -79.0741
# C for Celsius, F for Fahrenheit
temperature_unit: F
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: America/New_York
customize:
script.timed_office:
hidden: true
script.timed_bedroom:
hidden: true
script.timed_office_off:
hidden: true
script.timed_bedroom_off:
hidden: true
sensor.find_location_sensor:
hidden: true
script.timed_living:
hidden: true
script.timed_living_off:
hidden: true
frontend:
history:
logbook:
sun:
#updater:
#weblink:
# entities:
# - name: Back to FIND information
# url: https://github.com/schollz/find
# Prediction of weather
sensor:
# - platform: yr
- platform: rest
resource: https://ml.internalpositioning.com/location?group=YOURGROUP&user=YOURUSER
value_template: '{{ value_json.users.YOURUSER[0].location }}{{ value_json.users.YOURUSER[0].time }}'
method: GET
name: FIND location sensor
scan_interval: 3
- platform: rest
resource: https://ml.internalpositioning.com/location?group=YOURGROUP&user=YOURUSER
value_template: '{{ value_json.users.YOURUSER[0].location }}'
method: GET
name: FIND location
scan_interval: 6
automation:
- alias: 'In office'
trigger:
- platform: state
entity_id: sensor.find_location_sensor
condition:
- platform: template
value_template: "{% if 'office' in states('sensor.find_location_sensor') %}true{% else %}false{% endif %}"
action:
service: homeassistant.turn_on
entity_id: script.timed_office
- alias: 'In bedroom'
trigger:
- platform: state
entity_id: sensor.find_location_sensor
condition:
- platform: template
value_template: "{% if 'bedroom' in states('sensor.find_location_sensor') %}true{% else %}false{% endif %}"
action:
service: homeassistant.turn_on
entity_id: script.timed_bedroom
- alias: 'In living'
trigger:
- platform: state
entity_id: sensor.find_location_sensor
condition:
- platform: template
value_template: "{% if 'living' in states('sensor.find_location_sensor') %}true{% else %}false{% endif %}"
action:
service: homeassistant.turn_on
entity_id: script.timed_living
group:
Lights:
- switch.office
- switch.bedroom
- switch.living
- switch.dining
- switch.kitchen
# Links:
# - weblink.back_to_find_information
switch:
- platform: command_switch
switches:
office:
oncmd: echo "rf g1 on"
offcmd: echo "rf g1 off"
initial: 'on'
bedroom:
oncmd: echo on
offcmd: echo off
initial: 'on'
living:
oncmd: echo on
offcmd: echo off
initial: 'on'
dining:
oncmd: echo on
offcmd: echo off
initial: 'on'
kitchen:
oncmd: echo on
offcmd: echo off
initial: 'on'
script:
timed_office:
alias: "Turn on office and set timer"
sequence:
- service: script.turn_off
data:
entity_id: script.timed_office_off
- service: switch.turn_on
data:
entity_id: switch.office
# Set new timer
- service: script.turn_on
data:
entity_id: script.timed_office_off
timed_office_off:
alias: "Turn off office after 3 minutes"
sequence:
- delay:
minutes: 3
- service: switch.turn_off
data:
entity_id: switch.office
timed_bedroom:
alias: "Turn on lamp and set timer"
sequence:
# Cancel ev. old timers
- service: script.turn_off
data:
entity_id: script.timed_bedroom_off
- service: switch.turn_on
data:
entity_id: switch.bedroom
# Set new timer
- service: script.turn_on
data:
entity_id: script.timed_bedroom_off
timed_bedroom_off:
alias: "Turn off office after 10 minutes"
sequence:
- delay:
minutes: 3
- service: switch.turn_off
data:
entity_id: switch.bedroom
timed_living:
alias: "Turn on living room"
sequence:
# Cancel ev. old timers
- service: script.turn_off
data:
entity_id: script.timed_living_off
- service: switch.turn_on
data:
entity_id: switch.living
# Set new timer
- service: script.turn_on
data:
entity_id: script.timed_living_off
timed_living_off:
alias: "Turn off living"
sequence:
- delay:
minutes: 3
- service: switch.turn_off
data:
entity_id: switch.living
@MarioHA

This comment has been minimized.

Copy link

MarioHA commented Oct 20, 2017

Thank you for the example :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.