Adding custom state icons to custom component?

So i have written my own custom component to link into my alarm system,

It all works but i am wondering can i set a custom icon to the states of a binary sensor

is there a def state_icon in a custom component?

    @property
    def state(self):
        """Return the state of the sensor."""
        if self.yale_object[self.device_name] == "closed":
            return "closed"
        else:
            return "open"

Hello,
you have the def icon and you can change the icon in your update methog like :

@property
def icon(self):
  return self._icon

def update(self):
  if True:
    self._icon = 'mdi:xxx'
  else:
    self._icon = 'mdi:yyy'

perfect thanks