44# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
55# -------------------------------------------------------------------
66# Stats - Historical metrics and AI notifications.
7+ # Related Issue: 1279
78# Build historical stats for AI/alerting.
89# -------------------------------------------------------------------
9- # Contact: @CCOSTAN
1010# Notes: Numeric repo and home counters expose state_class for long-term trend rollups.
11+ # Notes: Tesla charging time now normalizes Tesla Fleet charging state instead of the retired JuiceBox API.
1112# #####################################################################
1213
1314# ## Building out some Historical stats for AI. #####################
@@ -69,8 +70,8 @@ sensor:
6970
7071 - platform : history_stats
7172 name : Tesla Charging time
72- entity_id : sensor.carlojuice_charging_status
73- state : ' charging '
73+ entity_id : binary_sensor.tesla_charging_active
74+ state : ' on '
7475 type : time
7576 end : ' {{ now() }}'
7677 duration :
@@ -79,6 +80,17 @@ sensor:
7980# ## Building some interesting stats for tweeting. ###
8081
8182template :
83+ - binary_sensor :
84+ - name : " Tesla Charging Active"
85+ unique_id : stats_tesla_charging_active
86+ icon : mdi:ev-station
87+ availability : >-
88+ {{ states('sensor.spaceship_charging') not in ['unknown', 'unavailable', 'none', ''] or
89+ states('switch.spaceship_charge') not in ['unknown', 'unavailable', 'none', ''] }}
90+ state : >-
91+ {{ states('sensor.spaceship_charging') | lower == 'charging' or
92+ is_state('switch.spaceship_charge', 'on') }}
93+
8294 - sensor :
8395 - name : " Number of Sensors"
8496 unique_id : stats_number_of_sensors
0 commit comments