the cat flap sensor does change its icon based on the lock state.
the icon will be called by surepy / entities / devices.py
@property
def icon(self) -> str | None:
"""Icon of the Pet/Cap Flap."""
icon_url = "https://surehub.io/assets/images/petdoor-left-menu.png"
if self.state == LockState.LOCKED_ALL:
icon_url = "https://surehub.io/assets/images/both-ways-icon.svg"
elif self.state == LockState.LOCKED_IN:
icon_url = "https://surehub.io/assets/images/inside-icon.svg"
elif self.state == LockState.LOCKED_OUT:
icon_url = "https://surehub.io/assets/images/outside-icon.svg"
return urlparse(icon_url).geturl()
The Icon will be set in sureha / sensors.py
class Flap(SurePetcareSensor):
"""Sure Petcare Flap."""
def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None:
super().__init__(coordinator, _id, spc)
self._surepy_entity: SureFlap
self._attr_entity_picture = self._surepy_entity.icon
self._attr_unit_of_measurement = None
But the Icon change will not take place whenever the device status changes... it seems, that this will only be polled from time to time, or whenever something else might trigger a poll from the webserver.

Would it be better to save the image locally instead?
Or to pull the picture directly with each state change?
states:
unlocked https://surehub.io/assets/images/petdoor-left-menu.png
locked_in https://surehub.io/assets/images/inside-icon.svg
locked_out https://surehub.io/assets/images/outside-icon.svg
locked_all https://surehub.io/assets/images/both-ways-icon.svg
the cat flap sensor does change its icon based on the lock state.
the icon will be called by surepy / entities / devices.py
The Icon will be set in sureha / sensors.py
But the Icon change will not take place whenever the device status changes... it seems, that this will only be polled from time to time, or whenever something else might trigger a poll from the webserver.

Would it be better to save the image locally instead?
Or to pull the picture directly with each state change?
states:
unlocked https://surehub.io/assets/images/petdoor-left-menu.png
locked_in https://surehub.io/assets/images/inside-icon.svg
locked_out https://surehub.io/assets/images/outside-icon.svg
locked_all https://surehub.io/assets/images/both-ways-icon.svg