widewing / ha-toyota-na

Home Assistant integration for Toyota Motor (North America) connected services
75 stars 17 forks source link

AttributeError: `NoneType` #39

Closed johndbritton closed 2 years ago

johndbritton commented 2 years ago

The integration isn't working after updating Home Assistant.

System Health

version core-2022.3.5
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.9
os_name Linux
os_version 5.10.103
arch x86_64
timezone America/New_York
Home Assistant Community Store GitHub API | ok -- | -- Github API Calls Remaining | 4974 Installed Version | 1.20.0 Stage | running Available Repositories | 1007 Downloaded Repositories | 3
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | April 2, 2022, 8:00 PM relayer_connected | true remote_enabled | true remote_connected | true alexa_enabled | true google_enabled | false remote_server | us-east-1-2.ui.nabu.casa can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 7.5 -- | -- update_channel | stable supervisor_version | supervisor-2022.03.5 docker_version | 20.10.9 disk_total | 30.8 GB disk_used | 7.0 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | Z-Wave JS to MQTT (0.36.0), File editor (5.3.3), Terminal & SSH (9.3.0)
Lovelace dashboards | 1 -- | -- resources | 0 views | 2 mode | storage
This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/toyota_na/sensor.py:90 
Integration: Toyota (North America) (documentation, issues) 
First occurred: 11:15:14 AM (2 occurrences) 
Last logged: 2:48:01 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 553, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 612, in _async_write_ha_state
    unit_of_measurement = self.unit_of_measurement
  File "/config/custom_components/toyota_na/sensor.py", line 90, in unit_of_measurement
    _unit = cast(ToyotaNumeric, self.feature(self._vehicle_feature)).unit
AttributeError: 'NoneType' object has no attribute 'unit'
jlmaners commented 2 years ago

@johndbritton Have you tried an additional restart after receiving this error? I'm on 2022.3.5 without any issue. Also, in the integration view does the device and entities still show or not?

johndbritton commented 2 years ago

@jlmaners embarrassingly, that worked. Thanks for responding here.

For anyone else who has this issue, after a restart my Toyota NA integration needed to be reauthenticated.