code: def async_event_handler(self, event: dict) -> None:
          
          if event['e'] == 'added':
  
              if event['r'] == 'lights' and event['id'] not in self.lights:
                  device_type = 'light'
                  device = self.lights[event['id']] = DeconzLight(
                      event['id'], event['light'], self.async_put_state)
  
              elif event['r'] == 'sensors' and event['id'] not in self.sensors:
                  if supported_sensor(event['sensor']):
                      device_type = 'sensor'
                      device = self.sensors[event['id']] = create_sensor(
                          event['id'], event['sensor'], self.async_put_state)
                  else:
                      _LOGGER.warning('Unsupported sensor %s', event)
                      return
  
              else:
                  _LOGGER.debug('Unsupported event %s', event)
                  return
  
              if self.async_add_device_callback:
                  self.async_add_device_callback(device_type, device)
  
          elif event['e'] == 'changed':
  
              if event['r'] == 'groups' and event['id'] in self.groups:
                  self.groups[event['id']].async_update(event)
  
              elif event['r'] == 'lights' and event['id'] in self.lights:
                  self.lights[event['id']].async_update(event)
                  self.update_group_color([event['id']])
  
              elif event['r'] == 'sensors' and event['id'] in self.sensors:
                  self.sensors[event['id']].async_update(event)
  
              else:
                  _LOGGER.debug('Unsupported event %s', event)
  
          elif event['e'] == 'deleted':
              _LOGGER.debug('Removed event %s', event)
  
          else:
              _LOGGER.debug('Unsupported event %s', event)
docs: Receive event from websocket and identifies where the event belong.
  
          {
              "t": "event",
              "e": "changed",
              "r": "sensors",
              "id": "12",
              "state": { "buttonevent": 2002 }
          }