How to do a push update

I’m working on a new platform for homeassistant. My platform can notify homeassistant of changes (light turns on). I can’t find any documentation on how to send homeassistant a push rather than having it poll for state changes.Could you please explain or point to some documentation?

Follow up. I figured it out. You have to hand a function back to the library that knows when data changes. Here is a sample

def new_state(state):
    if state == 1:self._state=STATE_CLOSED
    elif state == 0 : self._state=STATE_OPEN
    else : self._state=STATE_UNKNOWN
    self.schedule_update_ha_state()
self._device.notifyVariableChange("ContactState",new_state)