tesla: Integration no longer exposes Powerwall Battery SoC% (may be Tesla or HA issue)

Is there an existing issue for this?

  • I have searched both the existing open issues & recently closed issues and did not find a duplicate of this issue.

Version of the Tesla component

3.20.3

Version of the Powerwall Gateway software

23.44.0 eb113390

Model

2

Current Behavior

Issue is also present in 3.20.4 as well.

I use the sensor.powerwall_name_battery (battery soc) extensively. As of 07:30 GMT on 2024-03-21 the integration is no longer reporting the value of this sensor and the HA UI shows it as ‘Unavailable’. Editing the dashboard tells me that ‘the integration is no longer providing this sensor’. This doesn’t seem likely (it is one of the most critical and useful sensors for the Powerwall) so I am guessing it may be a HA or Tesla Api issue? All the other Powerwall controls and sensors appear to be functioning as they should. My Tesla app is showing the correct SOC% value. Direct access to the local gateway API also returns the correct value. The integration debug logs show that it seems to be getting the value correctly via the Tesla API:

“percentage_charged”:92.58090184179486

Expected Behavior

The sensor value should be reported just as it always was.

Debug logs

2024-03-21 08:23:38.036 DEBUG (MainThread) [custom_components.tesla_custom] Running controller.update()
2024-03-21 08:23:38.036 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_DATA for energysite: 264032220815
2024-03-21 08:23:38.036 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:58:03
2024-03-21 08:23:38.037 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/live_status {}
2024-03-21 08:23:38.312 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"solar_power":1194,"percentage_charged":92.58090184179486,"backup_capable":true,"battery_power":-430,"load_power":764,"grid_status":"Active","grid_services_active":false,"grid_power":0,"grid_services_power":0,"generator_power":0,"island_status":"on_grid","storm_mode_active":false,"timestamp":"2024-03-21T08:23:38Z","wall_connectors":[]}}
2024-03-21 08:23:38.312 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_CONFIG for energysite: 264032220815
2024-03-21 08:23:38.312 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:58:03
2024-03-21 08:23:38.313 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_info {}
2024-03-21 08:23:38.553 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"id":"1152100-13-J--CN321257G3J8UU","site_name":"Jenkins Family","backup_reserve_percent":20,"default_real_mode":"autonomous","installation_date":"2021-12-12T14:41:51Z","user_settings":{"go_off_grid_test_banner_enabled":false,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":false,"vpp_tour_enabled":true,"sync_grid_alert_enabled":true,"breaker_alert_enabled":false},"components":{"solar":true,"solar_type":"pv_panel","battery":true,"grid":true,"backup":true,"gateway":"teg","load_meter":true,"tou_capable":true,"storm_mode_capable":true,"flex_energy_request_capable":false,"car_charging_data_supported":false,"off_grid_vehicle_charging_reserve_supported":false,"vehicle_charging_performance_view_enabled":false,"vehicle_charging_solar_offset_view_enabled":false,"battery_solar_offset_view_enabled":true,"solar_value_enabled":true,"energy_value_header":"Energy Value","energy_value_subheader":"Estimated Value","energy_service_self_scheduling_enabled":true,"show_grid_import_battery_source_cards":true,"set_islanding_mode_enabled":true,"wifi_commissioning_enabled":true,"backup_time_remaining_enabled":true,"rate_plan_manager_supported":true,"battery_type":"ac_powerwall","configurable":true,"grid_services_enabled":false,"customer_preferred_export_rule":"pv_only","edit_setting_permission_to_export":true,"edit_setting_grid_charging":true,"edit_setting_energy_exports":true,"system_alerts_enabled":true},"version":"23.44.0 eb113390","battery_count":2,"tariff_content":{"code":"Tesla_TOU(edited)","name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.31,"SUPER_OFF_PEAK":0.07},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}},"sell_tariff":{"name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.15,"SUPER_OFF_PEAK":0.15},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}}}},"nameplate_power":10000,"nameplate_energy":27000,"installation_time_zone":"Europe/London","max_site_meter_power_ac":1000000000,"min_site_meter_power_ac":-1000000000,"geolocation":{"latitude":51.4273348,"longitude":-0.769474,"source":"Site Address Preference"},"address":{"address_line1":"38 Wilstrode Avenue","city":"Bracknell","state":"BRACKNELL FOREST","zip":"RG42 4UW","country":"GB"},"vpp_backup_reserve_percent":20}}
2024-03-21 08:23:38.553 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_SUMMARY for energysite: 264032220815
2024-03-21 08:23:38.553 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:58:03
2024-03-21 08:23:38.553 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_status {}
2024-03-21 08:23:38.743 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"resource_type":"battery","site_name":"Jenkins Family","gateway_id":"1152100-13-J--CN321257G3J8UU","percentage_charged":92.58090184179486,"battery_type":"ac_powerwall","backup_capable":true,"battery_power":-440,"go_off_grid_test_banner_enabled":null,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":null,"vpp_tour_enabled":null,"sync_grid_alert_enabled":true,"breaker_alert_enabled":true}}
2024-03-21 08:23:38.743 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.707 seconds (success: True)
2024-03-21 08:23:38.743 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 261, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 417, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 183, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1050, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 548, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/config/custom_components/tesla_custom/sensor.py", line 443, in native_value
return round(self._energysite.energy_left)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: type NoneType doesn't define __round__ method
2024-03-21 08:23:48.038 DEBUG (MainThread) [custom_components.tesla_custom] Running controller.update()
2024-03-21 08:23:48.038 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_DATA for energysite: 264032220815
2024-03-21 08:23:48.039 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:53
2024-03-21 08:23:48.039 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/live_status {}
2024-03-21 08:23:48.384 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"solar_power":1197,"percentage_charged":92.58090184179486,"backup_capable":true,"battery_power":-440,"load_power":757,"grid_status":"Active","grid_services_active":false,"grid_power":0,"grid_services_power":0,"generator_power":0,"island_status":"on_grid","storm_mode_active":false,"timestamp":"2024-03-21T08:23:48Z","wall_connectors":[]}}
2024-03-21 08:23:48.385 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_CONFIG for energysite: 264032220815
2024-03-21 08:23:48.385 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:53
2024-03-21 08:23:48.385 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_info {}
2024-03-21 08:23:48.679 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"id":"1152100-13-J--CN321257G3J8UU","site_name":"Jenkins Family","backup_reserve_percent":20,"default_real_mode":"autonomous","installation_date":"2021-12-12T14:41:51Z","user_settings":{"go_off_grid_test_banner_enabled":false,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":false,"vpp_tour_enabled":true,"sync_grid_alert_enabled":true,"breaker_alert_enabled":false},"components":{"solar":true,"solar_type":"pv_panel","battery":true,"grid":true,"backup":true,"gateway":"teg","load_meter":true,"tou_capable":true,"storm_mode_capable":true,"flex_energy_request_capable":false,"car_charging_data_supported":false,"off_grid_vehicle_charging_reserve_supported":false,"vehicle_charging_performance_view_enabled":false,"vehicle_charging_solar_offset_view_enabled":false,"battery_solar_offset_view_enabled":true,"solar_value_enabled":true,"energy_value_header":"Energy Value","energy_value_subheader":"Estimated Value","energy_service_self_scheduling_enabled":true,"show_grid_import_battery_source_cards":true,"set_islanding_mode_enabled":true,"wifi_commissioning_enabled":true,"backup_time_remaining_enabled":true,"rate_plan_manager_supported":true,"battery_type":"ac_powerwall","configurable":true,"grid_services_enabled":false,"customer_preferred_export_rule":"pv_only","edit_setting_permission_to_export":true,"edit_setting_grid_charging":true,"edit_setting_energy_exports":true,"system_alerts_enabled":true},"version":"23.44.0 eb113390","battery_count":2,"tariff_content":{"code":"Tesla_TOU(edited)","name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.31,"SUPER_OFF_PEAK":0.07},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}},"sell_tariff":{"name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.15,"SUPER_OFF_PEAK":0.15},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}}}},"nameplate_power":10000,"nameplate_energy":27000,"installation_time_zone":"Europe/London","max_site_meter_power_ac":1000000000,"min_site_meter_power_ac":-1000000000,"geolocation":{"latitude":51.4273348,"longitude":-0.769474,"source":"Site Address Preference"},"address":{"address_line1":"38 Wilstrode Avenue","city":"Bracknell","state":"BRACKNELL FOREST","zip":"RG42 4UW","country":"GB"},"vpp_backup_reserve_percent":20}}
2024-03-21 08:23:48.679 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_SUMMARY for energysite: 264032220815
2024-03-21 08:23:48.679 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:53
2024-03-21 08:23:48.679 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_status {}
2024-03-21 08:23:48.871 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"resource_type":"battery","site_name":"Jenkins Family","gateway_id":"1152100-13-J--CN321257G3J8UU","percentage_charged":92.58090184179486,"battery_type":"ac_powerwall","backup_capable":true,"battery_power":-440,"go_off_grid_test_banner_enabled":null,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":null,"vpp_tour_enabled":null,"sync_grid_alert_enabled":true,"breaker_alert_enabled":true}}
2024-03-21 08:23:48.872 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.833 seconds (success: True)
2024-03-21 08:23:48.872 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 261, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 417, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 183, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1050, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 548, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/config/custom_components/tesla_custom/sensor.py", line 443, in native_value
return round(self._energysite.energy_left)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: type NoneType doesn't define __round__ method
2024-03-21 08:23:59.035 DEBUG (MainThread) [custom_components.tesla_custom] Running controller.update()
2024-03-21 08:23:59.035 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_DATA for energysite: 264032220815
2024-03-21 08:23:59.035 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:42
2024-03-21 08:23:59.036 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/live_status {}
2024-03-21 08:23:59.332 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"solar_power":1198,"percentage_charged":92.58090184179486,"backup_capable":true,"battery_power":-450,"load_power":748,"grid_status":"Active","grid_services_active":false,"grid_power":0,"grid_services_power":0,"generator_power":0,"island_status":"on_grid","storm_mode_active":false,"timestamp":"2024-03-21T08:23:59Z","wall_connectors":[]}}
2024-03-21 08:23:59.333 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_CONFIG for energysite: 264032220815
2024-03-21 08:23:59.333 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:42
2024-03-21 08:23:59.333 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_info {}
2024-03-21 08:23:59.610 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"id":"1152100-13-J--CN321257G3J8UU","site_name":"Jenkins Family","backup_reserve_percent":20,"default_real_mode":"autonomous","installation_date":"2021-12-12T14:41:51Z","user_settings":{"go_off_grid_test_banner_enabled":false,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":false,"vpp_tour_enabled":true,"sync_grid_alert_enabled":true,"breaker_alert_enabled":false},"components":{"solar":true,"solar_type":"pv_panel","battery":true,"grid":true,"backup":true,"gateway":"teg","load_meter":true,"tou_capable":true,"storm_mode_capable":true,"flex_energy_request_capable":false,"car_charging_data_supported":false,"off_grid_vehicle_charging_reserve_supported":false,"vehicle_charging_performance_view_enabled":false,"vehicle_charging_solar_offset_view_enabled":false,"battery_solar_offset_view_enabled":true,"solar_value_enabled":true,"energy_value_header":"Energy Value","energy_value_subheader":"Estimated Value","energy_service_self_scheduling_enabled":true,"show_grid_import_battery_source_cards":true,"set_islanding_mode_enabled":true,"wifi_commissioning_enabled":true,"backup_time_remaining_enabled":true,"rate_plan_manager_supported":true,"battery_type":"ac_powerwall","configurable":true,"grid_services_enabled":false,"customer_preferred_export_rule":"pv_only","edit_setting_permission_to_export":true,"edit_setting_grid_charging":true,"edit_setting_energy_exports":true,"system_alerts_enabled":true},"version":"23.44.0 eb113390","battery_count":2,"tariff_content":{"code":"Tesla_TOU(edited)","name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.31,"SUPER_OFF_PEAK":0.07},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}},"sell_tariff":{"name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.15,"SUPER_OFF_PEAK":0.15},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}}}},"nameplate_power":10000,"nameplate_energy":27000,"installation_time_zone":"Europe/London","max_site_meter_power_ac":1000000000,"min_site_meter_power_ac":-1000000000,"geolocation":{"latitude":51.4273348,"longitude":-0.769474,"source":"Site Address Preference"},"address":{"address_line1":"38 Wilstrode Avenue","city":"Bracknell","state":"BRACKNELL FOREST","zip":"RG42 4UW","country":"GB"},"vpp_backup_reserve_percent":20}}
2024-03-21 08:23:59.611 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_SUMMARY for energysite: 264032220815
2024-03-21 08:23:59.611 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:42
2024-03-21 08:23:59.611 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_status {}
2024-03-21 08:23:59.802 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"resource_type":"battery","site_name":"Jenkins Family","gateway_id":"1152100-13-J--CN321257G3J8UU","percentage_charged":92.58090184179486,"battery_type":"ac_powerwall","backup_capable":true,"battery_power":-450,"go_off_grid_test_banner_enabled":null,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":null,"vpp_tour_enabled":null,"sync_grid_alert_enabled":true,"breaker_alert_enabled":true}}
2024-03-21 08:23:59.802 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.767 seconds (success: True)
2024-03-21 08:23:59.802 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 261, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 417, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 183, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1050, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 548, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/config/custom_components/tesla_custom/sensor.py", line 443, in native_value
return round(self._energysite.energy_left)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: type NoneType doesn't define __round__ method
2024-03-21 08:24:10.040 DEBUG (MainThread) [custom_components.tesla_custom] Running controller.update()
2024-03-21 08:24:10.040 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_DATA for energysite: 264032220815
2024-03-21 08:24:10.040 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:31
2024-03-21 08:24:10.040 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/live_status {}
2024-03-21 08:24:10.562 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"solar_power":1198,"percentage_charged":92.58090184179486,"backup_capable":true,"battery_power":-480,"load_power":718,"grid_status":"Active","grid_services_active":false,"grid_power":0,"grid_services_power":0,"generator_power":0,"island_status":"on_grid","storm_mode_active":false,"timestamp":"2024-03-21T08:24:10Z","wall_connectors":[]}}
2024-03-21 08:24:10.562 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_CONFIG for energysite: 264032220815
2024-03-21 08:24:10.562 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:31
2024-03-21 08:24:10.562 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_info {}
2024-03-21 08:24:10.844 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"id":"1152100-13-J--CN321257G3J8UU","site_name":"Jenkins Family","backup_reserve_percent":20,"default_real_mode":"autonomous","installation_date":"2021-12-12T14:41:51Z","user_settings":{"go_off_grid_test_banner_enabled":false,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":false,"vpp_tour_enabled":true,"sync_grid_alert_enabled":true,"breaker_alert_enabled":false},"components":{"solar":true,"solar_type":"pv_panel","battery":true,"grid":true,"backup":true,"gateway":"teg","load_meter":true,"tou_capable":true,"storm_mode_capable":true,"flex_energy_request_capable":false,"car_charging_data_supported":false,"off_grid_vehicle_charging_reserve_supported":false,"vehicle_charging_performance_view_enabled":false,"vehicle_charging_solar_offset_view_enabled":false,"battery_solar_offset_view_enabled":true,"solar_value_enabled":true,"energy_value_header":"Energy Value","energy_value_subheader":"Estimated Value","energy_service_self_scheduling_enabled":true,"show_grid_import_battery_source_cards":true,"set_islanding_mode_enabled":true,"wifi_commissioning_enabled":true,"backup_time_remaining_enabled":true,"rate_plan_manager_supported":true,"battery_type":"ac_powerwall","configurable":true,"grid_services_enabled":false,"customer_preferred_export_rule":"pv_only","edit_setting_permission_to_export":true,"edit_setting_grid_charging":true,"edit_setting_energy_exports":true,"system_alerts_enabled":true},"version":"23.44.0 eb113390","battery_count":2,"tariff_content":{"code":"Tesla_TOU(edited)","name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.31,"SUPER_OFF_PEAK":0.07},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}},"sell_tariff":{"name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.15,"SUPER_OFF_PEAK":0.15},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}}}},"nameplate_power":10000,"nameplate_energy":27000,"installation_time_zone":"Europe/London","max_site_meter_power_ac":1000000000,"min_site_meter_power_ac":-1000000000,"geolocation":{"latitude":51.4273348,"longitude":-0.769474,"source":"Site Address Preference"},"address":{"address_line1":"38 Wilstrode Avenue","city":"Bracknell","state":"BRACKNELL FOREST","zip":"RG42 4UW","country":"GB"},"vpp_backup_reserve_percent":20}}
2024-03-21 08:24:10.844 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_SUMMARY for energysite: 264032220815
2024-03-21 08:24:10.844 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:31
2024-03-21 08:24:10.844 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_status {}
2024-03-21 08:24:11.060 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"resource_type":"battery","site_name":"Jenkins Family","gateway_id":"1152100-13-J--CN321257G3J8UU","percentage_charged":92.58090184179486,"battery_type":"ac_powerwall","backup_capable":true,"battery_power":-480,"go_off_grid_test_banner_enabled":null,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":null,"vpp_tour_enabled":null,"sync_grid_alert_enabled":true,"breaker_alert_enabled":true}}
2024-03-21 08:24:11.060 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 1.020 seconds (success: True)
2024-03-21 08:24:11.060 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 261, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 417, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 183, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1050, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 548, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/config/custom_components/tesla_custom/sensor.py", line 443, in native_value
return round(self._energysite.energy_left)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: type NoneType doesn't define __round__ method
2024-03-21 08:24:21.038 DEBUG (MainThread) [custom_components.tesla_custom] Running controller.update()
2024-03-21 08:24:21.039 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_DATA for energysite: 264032220815
2024-03-21 08:24:21.039 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:20
2024-03-21 08:24:21.039 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/live_status {}
2024-03-21 08:24:21.289 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"solar_power":1197,"percentage_charged":92.58090184179486,"backup_capable":true,"battery_power":-470,"load_power":727,"grid_status":"Active","grid_services_active":false,"grid_power":0,"grid_services_power":0,"generator_power":0,"island_status":"on_grid","storm_mode_active":false,"timestamp":"2024-03-21T08:24:21Z","wall_connectors":[]}}
2024-03-21 08:24:21.289 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_CONFIG for energysite: 264032220815
2024-03-21 08:24:21.289 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:20
2024-03-21 08:24:21.289 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_info {}
2024-03-21 08:24:21.523 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"id":"1152100-13-J--CN321257G3J8UU","site_name":"Jenkins Family","backup_reserve_percent":20,"default_real_mode":"autonomous","installation_date":"2021-12-12T14:41:51Z","user_settings":{"go_off_grid_test_banner_enabled":false,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":false,"vpp_tour_enabled":true,"sync_grid_alert_enabled":true,"breaker_alert_enabled":false},"components":{"solar":true,"solar_type":"pv_panel","battery":true,"grid":true,"backup":true,"gateway":"teg","load_meter":true,"tou_capable":true,"storm_mode_capable":true,"flex_energy_request_capable":false,"car_charging_data_supported":false,"off_grid_vehicle_charging_reserve_supported":false,"vehicle_charging_performance_view_enabled":false,"vehicle_charging_solar_offset_view_enabled":false,"battery_solar_offset_view_enabled":true,"solar_value_enabled":true,"energy_value_header":"Energy Value","energy_value_subheader":"Estimated Value","energy_service_self_scheduling_enabled":true,"show_grid_import_battery_source_cards":true,"set_islanding_mode_enabled":true,"wifi_commissioning_enabled":true,"backup_time_remaining_enabled":true,"rate_plan_manager_supported":true,"battery_type":"ac_powerwall","configurable":true,"grid_services_enabled":false,"customer_preferred_export_rule":"pv_only","edit_setting_permission_to_export":true,"edit_setting_grid_charging":true,"edit_setting_energy_exports":true,"system_alerts_enabled":true},"version":"23.44.0 eb113390","battery_count":2,"tariff_content":{"code":"Tesla_TOU(edited)","name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.31,"SUPER_OFF_PEAK":0.07},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}},"sell_tariff":{"name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.15,"SUPER_OFF_PEAK":0.15},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}}}},"nameplate_power":10000,"nameplate_energy":27000,"installation_time_zone":"Europe/London","max_site_meter_power_ac":1000000000,"min_site_meter_power_ac":-1000000000,"geolocation":{"latitude":51.4273348,"longitude":-0.769474,"source":"Site Address Preference"},"address":{"address_line1":"38 Wilstrode Avenue","city":"Bracknell","state":"BRACKNELL FOREST","zip":"RG42 4UW","country":"GB"},"vpp_backup_reserve_percent":20}}
2024-03-21 08:24:21.523 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_SUMMARY for energysite: 264032220815
2024-03-21 08:24:21.524 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:20
2024-03-21 08:24:21.524 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_status {}
2024-03-21 08:24:21.742 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"resource_type":"battery","site_name":"Jenkins Family","gateway_id":"1152100-13-J--CN321257G3J8UU","percentage_charged":92.58090184179486,"battery_type":"ac_powerwall","backup_capable":true,"battery_power":-470,"go_off_grid_test_banner_enabled":null,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":null,"vpp_tour_enabled":null,"sync_grid_alert_enabled":true,"breaker_alert_enabled":true}}
2024-03-21 08:24:21.742 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.704 seconds (success: True)
2024-03-21 08:24:21.742 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 261, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 417, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 183, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1050, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 548, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/config/custom_components/tesla_custom/sensor.py", line 443, in native_value
return round(self._energysite.energy_left)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: type NoneType doesn't define __round__ method
2024-03-21 08:24:31.040 DEBUG (MainThread) [custom_components.tesla_custom] Running controller.update()
2024-03-21 08:24:31.041 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_DATA for energysite: 264032220815
2024-03-21 08:24:31.041 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:10
2024-03-21 08:24:31.042 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/live_status {}
2024-03-21 08:24:31.296 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"solar_power":1202,"percentage_charged":92.58090184179486,"backup_capable":true,"battery_power":-430,"load_power":772,"grid_status":"Active","grid_services_active":false,"grid_power":0,"grid_services_power":0,"generator_power":0,"island_status":"on_grid","storm_mode_active":false,"timestamp":"2024-03-21T08:24:31Z","wall_connectors":[]}}
2024-03-21 08:24:31.296 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_CONFIG for energysite: 264032220815
2024-03-21 08:24:31.296 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:10
2024-03-21 08:24:31.296 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_info {}
2024-03-21 08:24:31.534 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"id":"1152100-13-J--CN321257G3J8UU","site_name":"Jenkins Family","backup_reserve_percent":20,"default_real_mode":"autonomous","installation_date":"2021-12-12T14:41:51Z","user_settings":{"go_off_grid_test_banner_enabled":false,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":false,"vpp_tour_enabled":true,"sync_grid_alert_enabled":true,"breaker_alert_enabled":false},"components":{"solar":true,"solar_type":"pv_panel","battery":true,"grid":true,"backup":true,"gateway":"teg","load_meter":true,"tou_capable":true,"storm_mode_capable":true,"flex_energy_request_capable":false,"car_charging_data_supported":false,"off_grid_vehicle_charging_reserve_supported":false,"vehicle_charging_performance_view_enabled":false,"vehicle_charging_solar_offset_view_enabled":false,"battery_solar_offset_view_enabled":true,"solar_value_enabled":true,"energy_value_header":"Energy Value","energy_value_subheader":"Estimated Value","energy_service_self_scheduling_enabled":true,"show_grid_import_battery_source_cards":true,"set_islanding_mode_enabled":true,"wifi_commissioning_enabled":true,"backup_time_remaining_enabled":true,"rate_plan_manager_supported":true,"battery_type":"ac_powerwall","configurable":true,"grid_services_enabled":false,"customer_preferred_export_rule":"pv_only","edit_setting_permission_to_export":true,"edit_setting_grid_charging":true,"edit_setting_energy_exports":true,"system_alerts_enabled":true},"version":"23.44.0 eb113390","battery_count":2,"tariff_content":{"code":"Tesla_TOU(edited)","name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.31,"SUPER_OFF_PEAK":0.07},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}},"sell_tariff":{"name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.15,"SUPER_OFF_PEAK":0.15},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}}}},"nameplate_power":10000,"nameplate_energy":27000,"installation_time_zone":"Europe/London","max_site_meter_power_ac":1000000000,"min_site_meter_power_ac":-1000000000,"geolocation":{"latitude":51.4273348,"longitude":-0.769474,"source":"Site Address Preference"},"address":{"address_line1":"38 Wilstrode Avenue","city":"Bracknell","state":"BRACKNELL FOREST","zip":"RG42 4UW","country":"GB"},"vpp_backup_reserve_percent":20}}
2024-03-21 08:24:31.534 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_SUMMARY for energysite: 264032220815
2024-03-21 08:24:31.534 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:10
2024-03-21 08:24:31.534 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_status {}
2024-03-21 08:24:31.737 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"resource_type":"battery","site_name":"Jenkins Family","gateway_id":"1152100-13-J--CN321257G3J8UU","percentage_charged":92.58090184179486,"battery_type":"ac_powerwall","backup_capable":true,"battery_power":-430,"go_off_grid_test_banner_enabled":null,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":null,"vpp_tour_enabled":null,"sync_grid_alert_enabled":true,"breaker_alert_enabled":true}}
2024-03-21 08:24:31.737 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.697 seconds (success: True)
2024-03-21 08:24:31.738 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 261, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 417, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 183, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1050, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 548, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/config/custom_components/tesla_custom/sensor.py", line 443, in native_value
return round(self._energysite.energy_left)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: type NoneType doesn't define __round__ method
2024-03-21 08:24:41.036 DEBUG (MainThread) [custom_components.tesla_custom] Running controller.update()
2024-03-21 08:24:41.036 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_DATA for energysite: 264032220815
2024-03-21 08:24:41.036 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:00
2024-03-21 08:24:41.036 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/live_status {}
2024-03-21 08:24:41.358 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"solar_power":1216,"percentage_charged":92.58090184179486,"backup_capable":true,"battery_power":-530,"load_power":686,"grid_status":"Active","grid_services_active":false,"grid_power":0,"grid_services_power":0,"generator_power":0,"island_status":"on_grid","storm_mode_active":false,"timestamp":"2024-03-21T08:24:41Z","wall_connectors":[]}}
2024-03-21 08:24:41.358 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_CONFIG for energysite: 264032220815
2024-03-21 08:24:41.358 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:00
2024-03-21 08:24:41.358 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_info {}
2024-03-21 08:24:41.584 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"id":"1152100-13-J--CN321257G3J8UU","site_name":"Jenkins Family","backup_reserve_percent":20,"default_real_mode":"autonomous","installation_date":"2021-12-12T14:41:51Z","user_settings":{"go_off_grid_test_banner_enabled":false,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":false,"vpp_tour_enabled":true,"sync_grid_alert_enabled":true,"breaker_alert_enabled":false},"components":{"solar":true,"solar_type":"pv_panel","battery":true,"grid":true,"backup":true,"gateway":"teg","load_meter":true,"tou_capable":true,"storm_mode_capable":true,"flex_energy_request_capable":false,"car_charging_data_supported":false,"off_grid_vehicle_charging_reserve_supported":false,"vehicle_charging_performance_view_enabled":false,"vehicle_charging_solar_offset_view_enabled":false,"battery_solar_offset_view_enabled":true,"solar_value_enabled":true,"energy_value_header":"Energy Value","energy_value_subheader":"Estimated Value","energy_service_self_scheduling_enabled":true,"show_grid_import_battery_source_cards":true,"set_islanding_mode_enabled":true,"wifi_commissioning_enabled":true,"backup_time_remaining_enabled":true,"rate_plan_manager_supported":true,"battery_type":"ac_powerwall","configurable":true,"grid_services_enabled":false,"customer_preferred_export_rule":"pv_only","edit_setting_permission_to_export":true,"edit_setting_grid_charging":true,"edit_setting_energy_exports":true,"system_alerts_enabled":true},"version":"23.44.0 eb113390","battery_count":2,"tariff_content":{"code":"Tesla_TOU(edited)","name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.31,"SUPER_OFF_PEAK":0.07},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}},"sell_tariff":{"name":"Intelligent Octopus","utility":"Octopus","daily_charges":[{"amount":0,"name":"Charge"}],"demand_charges":{"ALL":{"ALL":0},"Summer":{},"Winter":{}},"energy_charges":{"ALL":{"ALL":0},"Summer":{"ON_PEAK":0.15,"SUPER_OFF_PEAK":0.15},"Winter":{}},"seasons":{"Summer":{"fromDay":1,"toDay":31,"fromMonth":1,"toMonth":12,"tou_periods":{"ON_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":5,"fromMinute":30,"toHour":23,"toMinute":30}],"SUPER_OFF_PEAK":[{"fromDayOfWeek":0,"toDayOfWeek":6,"fromHour":23,"fromMinute":30,"toHour":5,"toMinute":30}]}},"Winter":{"fromDay":0,"toDay":0,"fromMonth":0,"toMonth":0,"tou_periods":{}}}}},"nameplate_power":10000,"nameplate_energy":27000,"installation_time_zone":"Europe/London","max_site_meter_power_ac":1000000000,"min_site_meter_power_ac":-1000000000,"geolocation":{"latitude":51.4273348,"longitude":-0.769474,"source":"Site Address Preference"},"address":{"address_line1":"38 Wilstrode Avenue","city":"Bracknell","state":"BRACKNELL FOREST","zip":"RG42 4UW","country":"GB"},"vpp_backup_reserve_percent":20}}
2024-03-21 08:24:41.584 DEBUG (MainThread) [teslajsonpy.controller] Updating SITE_SUMMARY for energysite: 264032220815
2024-03-21 08:24:41.584 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:57:00
2024-03-21 08:24:41.584 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/264032220815/site_status {}
2024-03-21 08:24:41.765 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":{"resource_type":"battery","site_name":"Jenkins Family","gateway_id":"1152100-13-J--CN321257G3J8UU","percentage_charged":92.58090184179486,"battery_type":"ac_powerwall","backup_capable":true,"battery_power":-530,"go_off_grid_test_banner_enabled":null,"storm_mode_enabled":false,"powerwall_onboarding_settings_set":true,"powerwall_tesla_electric_interested_in":null,"vpp_tour_enabled":null,"sync_grid_alert_enabled":true,"breaker_alert_enabled":true}}
2024-03-21 08:24:41.765 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.729 seconds (success: True)
2024-03-21 08:24:41.765 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 261, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 417, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 183, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1050, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 548, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/config/custom_components/tesla_custom/sensor.py", line 443, in native_value
return round(self._energysite.energy_left)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: type NoneType doesn't define __round__ method

Anything else?

Some screenshots showing the issue (ZIP file)

About this issue

  • Original URL
  • State: open
  • Created 3 months ago
  • Comments: 41

Most upvoted comments

Looks like tesla removed it but did not update their own API documentation as I was enable to locate energy_left on the site data, site summary or products API.

I commented out line 94 in sensors.py for now on my local repo so it will stop giving out errors and to get the backup reserves to appear again.

        if energysite.resource_type == RESOURCE_TYPE_BATTERY:
            entities.append(TeslaEnergyBattery(energysite, coordinator))
#            entities.append(TeslaEnergyBatteryRemaining(energysite, coordinator))
            entities.append(TeslaEnergyBackupReserve(energysite, coordinator))
            for sensor_type in BATTERY_SITE_SENSORS:
                entities.append(
                    TeslaEnergyPowerSensor(energysite, coordinator, sensor_type)
                )

Sorry, @ejbatts I stand corrected - just didn’t want to get the credit for the harder part of the programming the sensor. Kudos to you!

Here is my code: (I have two batteries)

- name: Useable Battery Remaining        
        unique_id: useable_battery_remaining
        state: >
          {% set totalcapacity = (states('sensor.powerwall_tg122xxxxxxxxx_battery_capacity') | float(0)) 
          + ((states('sensor.powerwall_tg123xxxxxxxxx_battery_capacity') | float(0))) %}
          {% set totalcharge = (states('sensor.powerwall_tg122xxxxxxxxx_battery_remaining') | float(0)) 
          + ((states('sensor.powerwall_tg123xxxxxxxxx_battery_remaining') | float(0))) %}
          {{ '{:.3f}'.format(totalcharge - totalcapacity * 0.05) }}

 - name: Useable Percentage Remaining
        unique_id: useable_percentage_remaining   
        state: >
          {% set totalcapacity = (states('sensor.powerwall_tg122xxxxxxxxx_battery_capacity') | float(0)) 
          + ((states('sensor.powerwall_tg123xxxxxxxxx_battery_capacity') | float(0))) %}
          {% set totalcharge = (states('sensor.powerwall_tg122xxxxxxxxx_battery_remaining') | float(0)) 
          + ((states('sensor.powerwall_tg123xxxxxxxxx_battery_remaining') | float(0))) %}
          {{ '{:.1f}'.format((100 * (totalcharge - totalcapacity * 0.05)) | float(0) 
          / (totalcapacity * 0.95) | float(0)) }}   

Most of the sensors from the Custom Integration don’t seem to be updating dynamically - Backup Reserve and Operation Mode seem to be working OK (but see below) and the other’s seem to be either available on the official integration or can be derived as detailed above by @ejbatts.

All the custom integration sensors/backup reserve number are becoming sporadically becoming unavailable - it was happening when my router rebooted at 0420 every day but I’ve stopped that happening a few days ago and they all stayed available until last night (0016) they went unavailable and stayed that way until I restarted the integration this morning. That meant none of my overnight charge/hold/discharge automations triggered.

Is anyone else seeing this behaviour?

I’ve written an automation in HA triggered when the backup reserve number becomes unavailable, it waits 90 seconds (to allow for network delays or a self-rebooting router),reloads the integration, then checks again after 5 mins - and reloads the integration again if it’s still unavailable. I’m aware the automations could still fail if they trigger during the 90 second delay but haven’t got the time to build the check into every automation (hoping the integration errors get sorted quickly). Also, it’s not very elegant so can anyone think of a better way ?

Have you tried the workaround from here: https://github.com/alandtse/tesla/issues/919#issuecomment-2015548967 That fixed the sensors not updating for me

Thanks to @Avatar1976 for the original maths and formatting - it’s a lot neater than mine would have been!

Or ME (if you like @wanblue) for the original, ‘original’ maths and formatting…! 😉

I’ve switched to using the HA built-in Powerwall integration for Battery Charge. It uses the local API, not Tesla Cloud, so is working fine. Both integrations work along side each other.

Just be aware that % charge provided by this integration is slightly different, it’s percentage of total battery including the 5% which is always reserved and not seen in the Tesla app. So for example when custom integration would have shown zero % this one will show 5%.