Does anyone use the proximity component in automations? I am interested setting the heat up higher as I get closer to home and am looking for examples.
I haven’t seen it done so far.
Most likely what you would like to do is write an automation that checks your proximity and when it passes a trigger value it set your temperature to a preset value.
To have it change with more variation you would probally have to have a look at [AppDaemon
] (https://home-assistant.io/blog/2016/08/16/we-have-apps-now/).
Here’s what I came up with. It worked yesterday on the way home, but comes with NO WARRANTY, EXPRESS OR etc etc
- alias: 'Turn heat up as I get closer to home'
trigger:
platform: numeric_state
entity_id: proximity.home
# Trigger when becoming 1-5 miles away
below: 5
above: 1
condition:
condition: and
conditions:
# Heading home
- condition: template
value_template: '{{ states.proximity.home.attributes.dir_of_travel == "towards" }}'
# Not already set
- condition: template
# TODO figure out how to use a variable instead of hardcoding 62
# I'm using secrets (like below) where heat_target_mid is 62, but I
# don't see how to use it here
value_template: '{{ states.thermostat.stelpro_stzw402_electronic_thermostat_heating_1_11.attributes.temperature != 62 }}'
# Nobody home
- condition: state
entity_id: group.all_devices
state: 'not_home'
# Temp below target
# - condition: numeric_state
# entity_id: sensor.stelpro_stzw402_electronic_thermostat_temperature_11
# below: !secret heat_target_mid
# Automation enabled
- condition: state
entity_id: input_boolean.automation_override
state: 'off'
action:
service: thermostat.set_temperature
entity_id: thermostat.stelpro_stzw402_electronic_thermostat_heating_1_11
data:
temperature: !secret heat_target_mid
7 Likes
Nice!
Try that out for a few days and if i works post it in the automation examples.
If you need help or don’t have time to do it yourself just tell me and I’ll give you a hand.
For a more direct line of communication send me a msg on gitter.