mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Improve diagnostics in Teslemetry (#117613)
This commit is contained in:
parent
b39028acf2
commit
1b0c91fa4d
@ -23,20 +23,32 @@ VEHICLE_REDACT = [
|
||||
"drive_state_native_longitude",
|
||||
]
|
||||
|
||||
ENERGY_REDACT = ["vin"]
|
||||
ENERGY_LIVE_REDACT = ["vin"]
|
||||
ENERGY_INFO_REDACT = ["installation_date"]
|
||||
|
||||
|
||||
async def async_get_config_entry_diagnostics(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry
|
||||
hass: HomeAssistant, entry: ConfigEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a config entry."""
|
||||
vehicles = [x.coordinator.data for x in config_entry.runtime_data.vehicles]
|
||||
vehicles = [
|
||||
{
|
||||
"data": async_redact_data(x.coordinator.data, VEHICLE_REDACT),
|
||||
# Stream diag will go here when implemented
|
||||
}
|
||||
for x in entry.runtime_data.vehicles
|
||||
]
|
||||
energysites = [
|
||||
x.live_coordinator.data for x in config_entry.runtime_data.energysites
|
||||
{
|
||||
"live": async_redact_data(x.live_coordinator.data, ENERGY_LIVE_REDACT),
|
||||
"info": async_redact_data(x.info_coordinator.data, ENERGY_INFO_REDACT),
|
||||
}
|
||||
for x in entry.runtime_data.energysites
|
||||
]
|
||||
|
||||
# Return only the relevant children
|
||||
return {
|
||||
"vehicles": async_redact_data(vehicles, VEHICLE_REDACT),
|
||||
"energysites": async_redact_data(energysites, ENERGY_REDACT),
|
||||
"vehicles": vehicles,
|
||||
"energysites": energysites,
|
||||
"scopes": entry.runtime_data.scopes,
|
||||
}
|
||||
|
@ -3,6 +3,92 @@
|
||||
dict({
|
||||
'energysites': list([
|
||||
dict({
|
||||
'info': dict({
|
||||
'backup_reserve_percent': 0,
|
||||
'battery_count': 3,
|
||||
'components_backup': True,
|
||||
'components_backup_time_remaining_enabled': True,
|
||||
'components_battery': True,
|
||||
'components_battery_solar_offset_view_enabled': True,
|
||||
'components_battery_type': 'ac_powerwall',
|
||||
'components_car_charging_data_supported': False,
|
||||
'components_configurable': True,
|
||||
'components_customer_preferred_export_rule': 'pv_only',
|
||||
'components_disallow_charge_from_grid_with_solar_installed': True,
|
||||
'components_energy_service_self_scheduling_enabled': True,
|
||||
'components_energy_value_header': 'Energy Value',
|
||||
'components_energy_value_subheader': 'Estimated Value',
|
||||
'components_flex_energy_request_capable': False,
|
||||
'components_gateway': 'teg',
|
||||
'components_grid': True,
|
||||
'components_grid_services_enabled': False,
|
||||
'components_load_meter': True,
|
||||
'components_net_meter_mode': 'battery_ok',
|
||||
'components_off_grid_vehicle_charging_reserve_supported': False,
|
||||
'components_set_islanding_mode_enabled': True,
|
||||
'components_show_grid_import_battery_source_cards': True,
|
||||
'components_solar': True,
|
||||
'components_solar_type': 'pv_panel',
|
||||
'components_solar_value_enabled': True,
|
||||
'components_storm_mode_capable': True,
|
||||
'components_system_alerts_enabled': True,
|
||||
'components_tou_capable': True,
|
||||
'components_vehicle_charging_performance_view_enabled': False,
|
||||
'components_vehicle_charging_solar_offset_view_enabled': False,
|
||||
'components_wall_connectors': list([
|
||||
dict({
|
||||
'device_id': '123abc',
|
||||
'din': 'abc123',
|
||||
'is_active': True,
|
||||
}),
|
||||
dict({
|
||||
'device_id': '234bcd',
|
||||
'din': 'bcd234',
|
||||
'is_active': True,
|
||||
}),
|
||||
]),
|
||||
'components_wifi_commissioning_enabled': True,
|
||||
'default_real_mode': 'self_consumption',
|
||||
'id': '1233-abcd',
|
||||
'installation_date': '**REDACTED**',
|
||||
'installation_time_zone': '',
|
||||
'max_site_meter_power_ac': 1000000000,
|
||||
'min_site_meter_power_ac': -1000000000,
|
||||
'nameplate_energy': 40500,
|
||||
'nameplate_power': 15000,
|
||||
'site_name': 'Site',
|
||||
'tou_settings_optimization_strategy': 'economics',
|
||||
'tou_settings_schedule': list([
|
||||
dict({
|
||||
'end_seconds': 3600,
|
||||
'start_seconds': 0,
|
||||
'target': 'off_peak',
|
||||
'week_days': list([
|
||||
1,
|
||||
0,
|
||||
]),
|
||||
}),
|
||||
dict({
|
||||
'end_seconds': 0,
|
||||
'start_seconds': 3600,
|
||||
'target': 'peak',
|
||||
'week_days': list([
|
||||
1,
|
||||
0,
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
'user_settings_breaker_alert_enabled': False,
|
||||
'user_settings_go_off_grid_test_banner_enabled': False,
|
||||
'user_settings_powerwall_onboarding_settings_set': True,
|
||||
'user_settings_powerwall_tesla_electric_interested_in': False,
|
||||
'user_settings_storm_mode_enabled': True,
|
||||
'user_settings_sync_grid_alert_enabled': True,
|
||||
'user_settings_vpp_tour_enabled': True,
|
||||
'version': '23.44.0 eb113390',
|
||||
'vpp_backup_reserve_percent': 0,
|
||||
}),
|
||||
'live': dict({
|
||||
'backup_capable': True,
|
||||
'battery_power': 5060,
|
||||
'energy_left': 38896.47368421053,
|
||||
@ -33,9 +119,21 @@
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
]),
|
||||
'scopes': list([
|
||||
'openid',
|
||||
'offline_access',
|
||||
'user_data',
|
||||
'vehicle_device_data',
|
||||
'vehicle_cmds',
|
||||
'vehicle_charging_cmds',
|
||||
'energy_device_data',
|
||||
'energy_cmds',
|
||||
]),
|
||||
'vehicles': list([
|
||||
dict({
|
||||
'data': dict({
|
||||
'access_type': 'OWNER',
|
||||
'api_version': 71,
|
||||
'backseat_token': None,
|
||||
@ -290,6 +388,7 @@
|
||||
'vehicle_state_webcam_available': True,
|
||||
'vin': '**REDACTED**',
|
||||
}),
|
||||
}),
|
||||
]),
|
||||
})
|
||||
# ---
|
||||
|
Loading…
x
Reference in New Issue
Block a user