diff --git a/custom_components/teslemetry/sensor.py b/custom_components/teslemetry/sensor.py index b91a88a..d521179 100644 --- a/custom_components/teslemetry/sensor.py +++ b/custom_components/teslemetry/sensor.py @@ -1002,6 +1002,97 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription): streaming_key=Signal.EFFICIENCY_PACKAGE, entity_registry_enabled_default=False, ), + TeslemetrySensorEntityDescription( + key="estimated_hours_to_charge_termination", + streaming_key=Signal.ESTIMATED_HOURS_TO_CHARGE_TERMINATION, + device_class=SensorDeviceClass.DURATION, + native_unit_of_measurement=UnitOfTime.HOURS, + entity_category=EntityCategory.DIAGNOSTIC, + entity_registry_enabled_default=False, + ), + TeslemetrySensorEntityDescription( + key="drive_state_expected_energy_percent_at_trip_arrival", + streaming_key=Signal.EXPECTED_ENERGY_PERCENT_AT_TRIP_ARRIVAL, + state_class=SensorStateClass.MEASUREMENT, + native_unit_of_measurement=PERCENTAGE, + device_class=SensorDeviceClass.BATTERY, + entity_category=EntityCategory.DIAGNOSTIC, + entity_registry_enabled_default=False, + suggested_display_precision=1, + ), + TeslemetrySensorEntityDescription( + key="homelink_device_count", + streaming_key=Signal.HOMELINK_DEVICE_COUNT, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + entity_registry_enabled_default=False, + ), + TeslemetrySensorEntityDescription( + key="powershare_hours_left", + streaming_key=Signal.POWERSHARE_HOURS_LEFT, + state_class=SensorStateClass.MEASUREMENT, + native_unit_of_measurement=UnitOfTime.HOURS, + device_class=SensorDeviceClass.DURATION, + entity_category=EntityCategory.DIAGNOSTIC, + suggested_display_precision=2, + entity_registry_enabled_default=False, + ), + TeslemetrySensorEntityDescription( + key="powershare_instantaneous_power_kw", + streaming_key=Signal.POWERSHARE_INSTANTANEOUS_POWER_KW, + state_class=SensorStateClass.MEASUREMENT, + native_unit_of_measurement=UnitOfPower.KILO_WATT, + device_class=SensorDeviceClass.POWER, + entity_category=EntityCategory.DIAGNOSTIC, + suggested_display_precision=2, + entity_registry_enabled_default=False, + ), + TeslemetrySensorEntityDescription( + key="powershare_status", + streaming_key=Signal.POWERSHARE_STATUS, + entity_category=EntityCategory.DIAGNOSTIC, + options=[ + "Unknown", + "Inactive", + "Handshaking", + "Init", + "Enabled", + "EnabledReconnectingSoon", + "Stopped" + ], + streaming_value_fn=lambda x: str(x).replace("PowerShareState",""), + entity_registry_enabled_default=False, + ), + TeslemetrySensorEntityDescription( + key="powershare_stop_reason", + streaming_key=Signal.POWERSHARE_STOP_REASON, + entity_category=EntityCategory.DIAGNOSTIC, + options=[ + "Unknown", + "None", + "SOCTooLow", + "Retry", + "Fault", + "User", + "Reconnecting", + "Authentication" + ], + streaming_value_fn=lambda x: str(x).replace("PowershareStopReasonStatus",""), + entity_registry_enabled_default=False, + ), + TeslemetrySensorEntityDescription( + key="powershare_type", + streaming_key=Signal.POWERSHARE_TYPE, + entity_category=EntityCategory.DIAGNOSTIC, + options=[ + "Unknown", + "None", + "Load", + "Home" + ], + streaming_value_fn=lambda x: str(x).replace("PowershareTypeStatus",""), + entity_registry_enabled_default=False, + ), ) @dataclass(frozen=True, kw_only=True) diff --git a/custom_components/teslemetry/translations/en.json b/custom_components/teslemetry/translations/en.json index 8d926a9..4f04251 100644 --- a/custom_components/teslemetry/translations/en.json +++ b/custom_components/teslemetry/translations/en.json @@ -864,10 +864,34 @@ "name": "Grid exported" }, "center_display": { - "name": "Center Display" + "name": "Center display" }, "efficiency_package": { - "name": "Efficiency Package" + "name": "Efficiency package" + }, + "estimated_hours_to_charge_termination": { + "name": "Estimated hours to charge termination" + }, + "drive_state_expected_energy_percent_at_trip_arrival": { + "name": "Expected energy percent at trip arrival" + }, + "homelink_device_count": { + "name": "Homelink device count" + }, + "powershare_hours_left": { + "name": "Powershare hours left" + }, + "powershare_instantaneous_power_kw": { + "name": "Powershare instantaneous power" + }, + "powershare_status": { + "name": "Powershare status" + }, + "powershare_stop_reason": { + "name": "Powershare stop reason" + }, + "powershare_type": { + "name": "Powershare type" } }, "switch": {