From 8:14:59PM to 12:00:00AM, the automation will run every 30 minutes to update the entity binary_sensor.model_y_charge_cable.
This is to determine if my charge cable is connected.
If during the same time period, the automation determines the charge cable is connected it will disable the automation. It will stop polling the status of the entity binary_sensor.model_y_charge_cable
alias: Update Tesla Charge Cable Status
description: ""
triggers:
- trigger: time_pattern
minutes: /30
conditions:
- condition: time
after: "20:14:59"
before: "00:00:00"
actions:
- action: homeassistant.update_entity
data:
entity_id:
- binary_sensor.model_y_charge_cable
- if:
- condition: state
entity_id: binary_sensor.model_y_charge_cable
state: "on"
then:
- action: automation.turn_off
metadata: {}
data:
stop_actions: true
target:
entity_id: automation.update_tesla_charge_cable_status
mode: single
I want this automation only to run if my car is home. So I set up another automation where it will first poll to see if the car is home. Then if the car is home it will enable/disable the above automation.
alias: Enable Update Tesla Charge Cable Status Automation
description: ""
triggers:
- trigger: time
at: "20:14:57"
id: 8:14:57 PM
- trigger: time
at: "20:14:58"
id: 8:14:58 PM
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- 8:14:57 PM
sequence:
- action: homeassistant.update_entity
data:
entity_id:
- device_tracker.model_y_location
- conditions:
- condition: trigger
id:
- 8:14:58 PM
- condition: state
entity_id: device_tracker.model_y_location
state: home
sequence:
- action: automation.turn_on
metadata: {}
data: {}
target:
entity_id: automation.update_tesla_charge_cable_status
- conditions:
- condition: trigger
id:
- 8:14:58 PM
- condition: state
entity_id: device_tracker.model_y_location
state: not_home
sequence:
- action: automation.turn_off
metadata: {}
data:
stop_actions: true
target:
entity_id: automation.update_tesla_charge_cable_status
mode: single
If the cable is connected between those hours, the charger will turn on if it is after 8:15pm M-F, anytime the cable is connected on Sat or Sun
alias: Tesla Charger On
description: ""
triggers:
- trigger: time_pattern
minutes: /30
conditions:
- condition: time
after: "20:14:59"
before: "00:00:00"
actions:
- if:
- condition: state
entity_id: binary_sensor.model_y_charge_cable
state: "on"
then:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
after: "20:15:00"
- action: switch.turn_on
target:
entity_id: switch.tesla_charger
data: {}
- if:
- condition: state
entity_id: binary_sensor.model_y_charge_cable
state: "on"
then:
- condition: time
weekday:
- sun
- sat
- action: switch.turn_on
target:
entity_id: switch.tesla_charger
data: {}
mode: single