'Listen for new messages on the bus, and add them to Prometheus.'

def handle_event(self, event):

    state = event.data.get('new_state')
    if (state is None):
        return
    entity_id = state.entity_id
    _LOGGER.debug('Handling    state    update    for    %s', entity_id)
    (domain, _) = hacore.split_entity_id(entity_id)
    if (entity_id in self.exclude):
        return
    if ((domain in self.exclude) and (entity_id not in self.include_entities)):
        return
    if (self.include_domains and (domain not in self.include_domains)):
        return
    if ((not self.exclude) and (self.include_entities and (entity_id not in self.include_entities))):
        return
    handler = ('_handle_' + domain)
    if hasattr(self, handler):
        getattr(self, handler)(state)
