sbabcock23 / hass-tryfi

Home Assistant integration for TryFi Dog Collar GPS monitoring.
https://github.com/sbabcock23/hass-tryfi
Apache License 2.0
52 stars 17 forks source link

No attribute ledOn #40

Closed estiens closed 2 years ago

estiens commented 2 years ago

after update to latest Home Assistant (2022.04.06) today, I'm getting this

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 137, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 328, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 994, in state
    if (is_on := self.is_on) is None:
  File "/config/custom_components/tryfi/light.py", line 74, in is_on
    return bool(self.pet.device.ledOn)
  File "/usr/local/lib/python3.9/site-packages/pytryfi/fiDevice.py", line 60, in ledOn
    return self._ledOn
AttributeError: 'FiDevice' object has no attribute '_ledOn'
2022-04-20 19:07:51 ERROR (MainThread) [homeassistant] Err

gonna give it a while in case it's something with the Fi Api, and or fixes itself with a restart or even reloading or re-adding the integration, if so I'll update it here

estiens commented 2 years ago

tracked this down (i think) to a change is the JSON returned that no longer includes charging status

https://github.com/sbabcock23/pytryfi/pull/11

sbabcock23 commented 2 years ago

Hi @estiens ,

I believe I found the issue. I think it is related to collars that are v2 versus v1. Please give hass-tryfi 0.0.11 a try