You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

667 lines
25 KiB

######################################################################
# @CCOSTAN - Follow Me on X
# For more info visit https://www.vcloudinfo.com/click-here
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# -------------------------------------------------------------------
# Tesla Model Y - Reminders and durable vehicle telemetry
# Related Issue: 1953
# Garage prompts, tire alerts, and last-valid dashboard snapshots.
# -------------------------------------------------------------------
# Related Issue: 1279
# Related Issue: 1666
# Related Issue: 1944
# Notes: Expects Tesla Fleet UI entities `sensor.spaceship_battery_level`
# and `switch.spaceship_charge`.
# Notes: Uses `cover.large_garage_door` closing as the arrival proxy so
# Tesla location drift does not suppress reminders.
# Notes: The nightly parents reminder starts at 8 PM or after a post-8 PM
# garage close, then loops every 30 minutes via a custom event while the
# latest garage-arrival signal is recent and the car still is not charging.
# Notes: Parents push reminders include a 24-hour snooze action.
# Notes: Plug-in reminders only fire when both `person.carlo` and
# `person.stacey` are home.
# Notes: Tire alerts use the four Tesla Fleet PSI sensors, trigger below
# 38.5 PSI, and share a 1-day/3-day snooze with Joanna's morning briefing.
# Notes: Trigger-based snapshot sensors reject unknown/unavailable updates
# and restore useful battery, odometer, location, tire, and JuiceBox values.
# Notes: `event_car_telemetry_snapshot_seed` accepts verified source snapshots;
# live Tesla Fleet and JuiceBox reports remain the normal update path.
# Notes: Snapshot sensors intentionally omit state_class; TeslaMate remains the
# long-term vehicle source while raw JuiceBox energy owns charge statistics.
# Notes: Home charging is intentionally limited to 16 A in the Tesla; this
# package observes JuiceBox current but never changes the vehicle or EVSE limit.
# Notes: The 30 A home EVSE circuit's EEPROM-backed offline wire rating was set
# to 24 A during unplugged commissioning. JuicePassProxy is a passive sensor-only
# monitor that sends no charger or former-cloud UDP traffic and exposes no
# limit controls. Transient online/offline max-current fields are ignored.
# Notes: Persisted JuiceBox current reaching 20 A sends one critical parents
# push plus an exact garage announcement; a restoring latch prevents repeats.
# Notes: JuicePassProxy must remain running and healthy. Five continuous minutes
# degraded creates a Systems problem and tells the garage and parents not to charge.
# Tire-pressure video: https://youtu.be/hDNyZfTfTtE
# Tire-pressure post: https://www.vcloudinfo.com/2026/09/home-assistant-tesla-tire-pressure-alerts.html
# Related garage video: https://youtu.be/wFO0H5zgnzk
# Related garage post: https://www.vcloudinfo.com/2026/05/home-assistant-garage-automations-arrival-alerts-tesla.html
######################################################################
input_boolean:
tesla_high_charge_rate_alert_active:
name: Tesla High Charge Rate Alert Active
icon: mdi:car-electric-alert
input_datetime:
tesla_model_y_last_garage_close:
name: Tesla Model Y Last Garage Close
has_date: true
has_time: true
tesla_model_y_plug_in_snooze_until:
name: Tesla Model Y Plug In Snooze Until
has_date: true
has_time: true
tesla_tire_pressure_snooze_until:
name: Tesla Tire Pressure Snooze Until
has_date: true
has_time: true
template:
- binary_sensor:
- name: "JuicePassProxy Monitoring Degraded"
unique_id: juicepassproxy_monitoring_degraded
device_class: problem
delay_on: "00:05:00"
state: >-
{{ states('sensor.juicepassproxy_state') != 'running' or
states('sensor.juicepassproxy_health') != 'healthy' }}
attributes:
source_state: "{{ states('sensor.juicepassproxy_state') }}"
source_health: "{{ states('sensor.juicepassproxy_health') }}"
guidance: "Do not charge until JuicePassProxy is running and healthy."
- triggers:
- trigger: state
entity_id:
- sensor.spaceship_battery_level
- sensor.odometer
- device_tracker.spaceship_location
- sensor.spaceship_charging
- binary_sensor.spaceship_charge_cable
- sensor.tire_pressure_front_left
- sensor.tire_pressure_front_right
- sensor.tire_pressure_rear_left
- sensor.tire_pressure_rear_right
- sensor.juicebox_status
- sensor.juicebox_current
- sensor.juicebox_current_rating
- sensor.juicebox_frequency
- sensor.juicebox_energy_lifetime
- sensor.juicebox_energy_session
- sensor.juicebox_temperature
- sensor.juicebox_voltage
- sensor.juicebox_power
- sensor.juicebox_power_factor
not_to:
- "unknown"
- "unavailable"
- trigger: event
event_type: event_car_telemetry_snapshot_seed
variables:
snapshot_source_entity: >-
{% if trigger.platform == 'event' %}
{{ trigger.event.data.entity_id | default('', true) }}
{% else %}
{{ trigger.entity_id }}
{% endif %}
snapshot_state: >-
{% if trigger.platform == 'event' %}
{{ trigger.event.data.state | default(none) }}
{% else %}
{{ trigger.to_state.state }}
{% endif %}
sensor:
- name: "Car Battery Last Known"
unique_id: car_battery_last_known
device_class: battery
unit_of_measurement: "%"
conditions:
- "{{ snapshot_source_entity == 'sensor.spaceship_battery_level' }}"
state: "{{ snapshot_state }}"
- name: "Car Odometer Last Known"
unique_id: car_odometer_last_known
device_class: distance
unit_of_measurement: "mi"
conditions:
- "{{ snapshot_source_entity == 'sensor.odometer' }}"
state: "{{ snapshot_state }}"
- name: "Car Location Last Known"
unique_id: car_location_last_known
conditions:
- "{{ snapshot_source_entity == 'device_tracker.spaceship_location' }}"
state: "{{ snapshot_state }}"
- name: "Car Charging Last Known"
unique_id: car_charging_last_known
conditions:
- "{{ snapshot_source_entity == 'sensor.spaceship_charging' }}"
state: "{{ snapshot_state }}"
- name: "Car Charge Cable Last Known"
unique_id: car_charge_cable_last_known
conditions:
- "{{ snapshot_source_entity == 'binary_sensor.spaceship_charge_cable' }}"
state: "{{ snapshot_state }}"
- name: "Car Tire Pressure Front Left Last Known"
unique_id: car_tire_pressure_front_left_last_known
device_class: pressure
unit_of_measurement: "psi"
conditions:
- "{{ snapshot_source_entity == 'sensor.tire_pressure_front_left' }}"
state: "{{ snapshot_state }}"
- name: "Car Tire Pressure Front Right Last Known"
unique_id: car_tire_pressure_front_right_last_known
device_class: pressure
unit_of_measurement: "psi"
conditions:
- "{{ snapshot_source_entity == 'sensor.tire_pressure_front_right' }}"
state: "{{ snapshot_state }}"
- name: "Car Tire Pressure Rear Left Last Known"
unique_id: car_tire_pressure_rear_left_last_known
device_class: pressure
unit_of_measurement: "psi"
conditions:
- "{{ snapshot_source_entity == 'sensor.tire_pressure_rear_left' }}"
state: "{{ snapshot_state }}"
- name: "Car Tire Pressure Rear Right Last Known"
unique_id: car_tire_pressure_rear_right_last_known
device_class: pressure
unit_of_measurement: "psi"
conditions:
- "{{ snapshot_source_entity == 'sensor.tire_pressure_rear_right' }}"
state: "{{ snapshot_state }}"
- name: "JuiceBox Status Last Known"
unique_id: juicebox_status_last_known
conditions:
- "{{ snapshot_source_entity == 'sensor.juicebox_status' }}"
state: "{{ snapshot_state }}"
- name: "JuiceBox Current Last Known"
unique_id: juicebox_current_last_known
device_class: current
unit_of_measurement: "A"
conditions:
- "{{ snapshot_source_entity == 'sensor.juicebox_current' }}"
state: "{{ snapshot_state }}"
- name: "JuiceBox Current Rating Last Known"
unique_id: juicebox_current_rating_last_known
device_class: current
unit_of_measurement: "A"
conditions:
- "{{ snapshot_source_entity == 'sensor.juicebox_current_rating' }}"
state: "{{ snapshot_state }}"
- name: "JuiceBox Frequency Last Known"
unique_id: juicebox_frequency_last_known
device_class: frequency
unit_of_measurement: "Hz"
conditions:
- "{{ snapshot_source_entity == 'sensor.juicebox_frequency' }}"
state: "{{ snapshot_state }}"
- name: "JuiceBox Lifetime Energy Last Known"
unique_id: juicebox_lifetime_energy_last_known
device_class: energy
unit_of_measurement: "Wh"
conditions:
- "{{ snapshot_source_entity == 'sensor.juicebox_energy_lifetime' }}"
state: "{{ snapshot_state }}"
- name: "JuiceBox Session Energy Last Known"
unique_id: juicebox_session_energy_last_known
device_class: energy
unit_of_measurement: "Wh"
conditions:
- "{{ snapshot_source_entity == 'sensor.juicebox_energy_session' }}"
state: "{{ snapshot_state }}"
- name: "JuiceBox Temperature Last Known"
unique_id: juicebox_temperature_last_known
device_class: temperature
unit_of_measurement: "\u00b0F"
conditions:
- "{{ snapshot_source_entity == 'sensor.juicebox_temperature' }}"
state: "{{ snapshot_state }}"
- name: "JuiceBox Voltage Last Known"
unique_id: juicebox_voltage_last_known
device_class: voltage
unit_of_measurement: "V"
conditions:
- "{{ snapshot_source_entity == 'sensor.juicebox_voltage' }}"
state: "{{ snapshot_state }}"
- name: "JuiceBox Power Last Known"
unique_id: juicebox_power_last_known
device_class: power
unit_of_measurement: "W"
conditions:
- "{{ snapshot_source_entity == 'sensor.juicebox_power' }}"
state: "{{ snapshot_state }}"
- name: "JuiceBox Power Factor Last Known"
unique_id: juicebox_power_factor_last_known
device_class: power_factor
conditions:
- "{{ snapshot_source_entity == 'sensor.juicebox_power_factor' }}"
state: "{{ snapshot_state }}"
automation:
- alias: "Tesla Model Y - High Home Charge Rate Alert"
id: f4f013f9-74e7-492e-8400-ae84897086ef
mode: single
max_exceeded: silent
trigger:
- platform: numeric_state
entity_id: sensor.juicebox_current_last_known
above: 19.99
id: juicebox_current
- platform: homeassistant
event: start
id: startup
condition:
- condition: state
entity_id: input_boolean.tesla_high_charge_rate_alert_active
state: 'off'
- condition: numeric_state
entity_id: sensor.juicebox_current_last_known
above: 19.99
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.tesla_high_charge_rate_alert_active
- variables:
observed_current: >-
{{ states('sensor.juicebox_current_last_known') | float(0) | round(1) }}
- parallel:
- service: notify.alexa_media_garage
continue_on_error: true
data:
message: >-
Warning. The JuiceBox reports the Tesla charging at
{{ observed_current }} amps, at or above the twenty amp safety
threshold. Unplug the Tesla now.
data:
type: announce
- service: script.notify_engine
continue_on_error: true
data:
title: "URGENT: Unplug Tesla"
value1: >-
The JuiceBox reports {{ observed_current }} A, at or above the
20 A safety threshold. Unplug the Tesla now.
who: 'parents'
group: 'Tesla_Charge_Rate_Alarm'
level: 'critical'
- service: script.send_to_logbook
data:
topic: "JUICEBOX"
message: >-
High charge-rate alarm sent at {{ observed_current }} A; garage and
parents were told to unplug the Tesla.
- alias: "Tesla Model Y - Reset High Charge Rate Alert"
id: ccb67406-4ac1-41de-8f47-a3a76e6d8762
mode: single
trigger:
- platform: state
entity_id: sensor.juicebox_current_last_known
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.tesla_high_charge_rate_alert_active
state: 'on'
- condition: numeric_state
entity_id: sensor.juicebox_current_last_known
below: 20
action:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.tesla_high_charge_rate_alert_active
- service: script.send_to_logbook
data:
topic: "JUICEBOX"
message: >-
High charge-rate alarm reset; JuiceBox current is below 20 A.
- alias: "Tesla Model Y - JuicePassProxy Monitoring Alert"
id: e4b6bf07-4760-4e7c-b2da-6db234a46df8
mode: single
trigger:
- platform: state
entity_id: binary_sensor.juicepassproxy_monitoring_degraded
to: 'on'
id: offline
- platform: state
entity_id: binary_sensor.juicepassproxy_monitoring_degraded
from: 'on'
to: 'off'
id: restored
action:
- choose:
- conditions:
- condition: trigger
id: offline
sequence:
- parallel:
- service: notify.alexa_media_garage
continue_on_error: true
data:
message: >-
Warning. JuiceBox monitoring has been offline for five
minutes. Do not charge. If the Tesla is connected or
charging, check it and unplug it until monitoring returns.
data:
type: announce
- service: script.notify_engine
continue_on_error: true
data:
title: "URGENT: JuiceBox Monitor Offline"
value1: >-
JuicePassProxy has been offline for five minutes. Do not
charge. If the Tesla is connected or charging, check it
and unplug it until JuiceBox monitoring returns.
who: 'parents'
group: 'JuiceBox_Proxy_Offline'
level: 'critical'
- service: script.send_to_logbook
data:
topic: "JUICEBOX"
message: >-
JuicePassProxy remained offline for five minutes; garage and
parents were told not to charge and to check or unplug the Tesla.
- conditions:
- condition: trigger
id: restored
sequence:
- service: script.notify_engine
continue_on_error: true
data:
title: "JuiceBox Monitor Restored"
value1: >-
JuicePassProxy is running and healthy again. JuiceBox charging
telemetry and the 20 A safety alert are available.
who: 'parents'
group: 'JuiceBox_Proxy_Offline'
- service: script.send_to_logbook
data:
topic: "JUICEBOX"
message: "JuicePassProxy monitoring returned to running and healthy."
- alias: "Tesla Model Y - Plug In Reminder"
id: 6a873341-c823-4d5d-9d42-fc2df52b93db
mode: restart
trigger:
- platform: time
at: '20:00:00'
id: nightly
- platform: event
event_type: event_tesla_model_y_nightly_loop
id: loop
- platform: time
at: input_datetime.tesla_model_y_plug_in_snooze_until
id: snooze_expired
- platform: state
entity_id: cover.large_garage_door
from: 'open'
to: 'closed'
for: '00:03:20'
id: garage_closed
action:
- choose:
- conditions:
- condition: trigger
id: garage_closed
sequence:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.tesla_model_y_last_garage_close
data:
datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
- condition: or
conditions:
- condition: trigger
id: garage_closed
- condition: template
value_template: >-
{% set last_close_ts = as_timestamp(states('input_datetime.tesla_model_y_last_garage_close'), 0) %}
{{ last_close_ts > 0 and (as_timestamp(now()) - last_close_ts) < 43200 }}
- condition: numeric_state
entity_id: sensor.spaceship_battery_level
below: 50
- condition: state
entity_id: person.carlo
state: 'home'
- condition: state
entity_id: person.stacey
state: 'home'
- condition: state
entity_id: switch.spaceship_charge
state: 'off'
- condition: template
value_template: >-
{% set snooze_until = as_timestamp(states('input_datetime.tesla_model_y_plug_in_snooze_until'), 0) %}
{{ snooze_until <= as_timestamp(now()) }}
- choose:
- conditions:
- condition: trigger
id: garage_closed
sequence:
- service: notify.alexa_media_garage
data:
message: >-
Reminder: the Tesla battery is at
{{ states('sensor.spaceship_battery_level') | float(0) | round(0) }} percent.
Please plug in the Model Y.
data:
type: announce
- service: script.send_to_logbook
data:
topic: "TESLA"
message: >-
Garage reminder announced to plug in the Model Y at
{{ states('sensor.spaceship_battery_level') | float(0) | round(0) }} percent.
- condition: or
conditions:
- condition: not
conditions:
- condition: trigger
id: garage_closed
- condition: time
after: '20:00:00'
before: '05:00:00'
- service: script.notify_engine_two_button
data:
title: "Tesla Plug In Reminder"
value1: >-
The Model Y recently came in through the garage, is below 50 percent,
and is not plugged in.
Current battery:
{{ states('sensor.spaceship_battery_level') | float(0) | round(0) }} percent.
who: 'parents'
group: 'Tesla_Model_Y'
title1: "Snooze 24h"
action1: "SNOOZE_TESLA_PLUG_IN_24H"
icon1: "sfsymbols:clock"
- service: script.send_to_logbook
data:
topic: "TESLA"
message: >-
Nightly plug-in reminder sent because the Model Y recently came in through the garage below 50 percent and is not charging.
- delay: '00:30:00'
- event: event_tesla_model_y_nightly_loop
- alias: "Tesla Model Y - Plug In Reminder Snooze"
id: 5b7b9b93-1f12-4c5e-9bc4-95c8cb1a104f
mode: queued
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: SNOOZE_TESLA_PLUG_IN_24H
variables:
snooze_until: "{{ (now() + timedelta(hours=24)).strftime('%Y-%m-%d %H:%M:%S') }}"
action:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.tesla_model_y_plug_in_snooze_until
data:
datetime: "{{ snooze_until }}"
- service: script.send_to_logbook
data:
topic: "TESLA"
message: "Tesla plug-in reminders snoozed for 24 hours (until {{ snooze_until }})."
- alias: "Tesla Model Y - Low Tire Pressure Alert"
id: 99e546aa-a6c0-4154-9c30-f901f81d1b40
mode: restart
trigger:
- platform: numeric_state
entity_id:
- sensor.tire_pressure_front_left
- sensor.tire_pressure_front_right
- sensor.tire_pressure_rear_left
- sensor.tire_pressure_rear_right
below: 38.5
id: pressure_low
- platform: time
at: input_datetime.tesla_tire_pressure_snooze_until
id: snooze_expired
action:
- delay: '00:00:10'
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.tire_pressure_front_left
below: 38.5
- condition: numeric_state
entity_id: sensor.tire_pressure_front_right
below: 38.5
- condition: numeric_state
entity_id: sensor.tire_pressure_rear_left
below: 38.5
- condition: numeric_state
entity_id: sensor.tire_pressure_rear_right
below: 38.5
- condition: template
value_template: >-
{% set snooze_until = as_timestamp(states('input_datetime.tesla_tire_pressure_snooze_until'), 0) %}
{{ snooze_until <= as_timestamp(now()) }}
- variables:
low_tires: >-
{% set tire_names = {
'sensor.tire_pressure_front_left': 'front left',
'sensor.tire_pressure_front_right': 'front right',
'sensor.tire_pressure_rear_left': 'rear left',
'sensor.tire_pressure_rear_right': 'rear right'
} %}
{% set ns = namespace(items=[]) %}
{% for entity_id, tire_name in tire_names.items() %}
{% set pressure = states(entity_id) %}
{% if has_value(entity_id) and (pressure | float(100)) < 38.5 %}
{% set ns.items = ns.items + [tire_name ~ ' ' ~ (pressure | float(0) | round(1)) ~ ' PSI'] %}
{% endif %}
{% endfor %}
{{ ns.items | join('; ') }}
- service: script.notify_engine_two_button
data:
title: "Tesla Tire Pressure"
value1: >-
{{ low_tires }}. Fill any Tesla tire below 38.5 PSI.
who: 'parents'
group: 'Tesla_Tire_Pressure'
title1: "Snooze 1d"
action1: "SNOOZE_TESLA_TIRE_PRESSURE_1D"
icon1: "sfsymbols:clock"
title2: "Snooze 3d"
action2: "SNOOZE_TESLA_TIRE_PRESSURE_3D"
icon2: "sfsymbols:calendar"
- service: script.send_to_logbook
data:
topic: "TESLA"
message: "Low tire pressure alert sent: {{ low_tires }}."
- alias: "Tesla Model Y - Tire Pressure Snooze"
id: 59da708d-be6f-422a-9478-090cb5087524
mode: queued
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: SNOOZE_TESLA_TIRE_PRESSURE_1D
id: one_day
- platform: event
event_type: mobile_app_notification_action
event_data:
action: SNOOZE_TESLA_TIRE_PRESSURE_3D
id: three_days
variables:
snooze_days: "{{ 1 if trigger.id == 'one_day' else 3 }}"
snooze_until: "{{ (now() + timedelta(days=snooze_days | int)).strftime('%Y-%m-%d %H:%M:%S') }}"
snooze_label: "{{ '1 day' if trigger.id == 'one_day' else '3 days' }}"
action:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.tesla_tire_pressure_snooze_until
data:
datetime: "{{ snooze_until }}"
- service: script.send_to_logbook
data:
topic: "TESLA"
message: "Tesla tire pressure alert snoozed for {{ snooze_label }} (until {{ snooze_until }})."
- alias: "Tesla Model Y - Clear Tire Pressure Snooze"
id: 5c4c6362-0123-4360-ade1-beae49241165
mode: single
trigger:
- platform: numeric_state
entity_id:
- sensor.tire_pressure_front_left
- sensor.tire_pressure_front_right
- sensor.tire_pressure_rear_left
- sensor.tire_pressure_rear_right
above: 38.499
condition:
- condition: numeric_state
entity_id: sensor.tire_pressure_front_left
above: 38.499
- condition: numeric_state
entity_id: sensor.tire_pressure_front_right
above: 38.499
- condition: numeric_state
entity_id: sensor.tire_pressure_rear_left
above: 38.499
- condition: numeric_state
entity_id: sensor.tire_pressure_rear_right
above: 38.499
- condition: template
value_template: >-
{% set snooze_until = as_timestamp(states('input_datetime.tesla_tire_pressure_snooze_until'), 0) %}
{{ snooze_until > as_timestamp(now()) }}
action:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.tesla_tire_pressure_snooze_until
data:
datetime: "2000-01-01 00:00:00"
- service: script.send_to_logbook
data:
topic: "TESLA"
message: "Tesla tire pressure returned to 38.5 PSI or higher; the tire alert snooze was cleared."

Powered by TurnKey Linux.