Closed droans closed 1 year ago
I don't think this is d/t the add_feeding
service call.
I am guessing you have diaper entries, but none marked as Wet?
Nope, this was from calling babybuddy.add_feeding
.
Once I added a wet diaper change, it did stop complaining. However, it still will not update the last feeding sensor. Even removing and readding the integration doesn't fix it.
Here is a log from the most recent time the error occurred:
2023-05-11 11:20:01.535 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.teddy_last_feeding fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 554, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update
await coro
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 444, in async_update
await self.coordinator.async_request_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 211, in async_request_refresh
await self._debounced_refresh.async_call()
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 95, in async_call
await task
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 237, in async_refresh
await self._async_refresh(log_failures=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 349, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 146, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 406, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 652, in _async_write_ha_state
attr.update(self.extra_state_attributes or {})
File "/config/custom_components/babybuddy/sensor.py", line 511, in extra_state_attributes
KeyError: 'wet'
Edit: Ah, last feeding uses the amount for the state instead of the time like the sensor for the diaper change. Attributes are still reported correctly.
Calling
babybuddy.add_feeding
throws a KeyError with missing key 'wet'. BabyBuddy does update, though.After calling the service, it appears to retry every sixty seconds but returns the same error.
Service call:
Error Log from service call:
Error log every sixty seconds after: