    def handle_state_changes(self, ev: Event[EventStateChangedData]):
        """Watch for new mac addresses on private ble devices and act."""
        if ev.event_type == EVENT_STATE_CHANGED:
            event_entity = ev.data.get("entity_id", "invalid_event_entity")
            if event_entity in self.pb_state_sources:
                # It's a state change of an entity we are tracking.
                new_state = ev.data.get("new_state")
                if new_state:
                    # _LOGGER.debug("New state change! %s", new_state)
                    # check new_state.attributes.assumed_state
                    if hasattr(new_state, "attributes"):
                        new_address = new_state.attributes.get("current_address")
                        if new_address is not None and new_address.lower() != self.pb_state_sources[event_entity]:
                            _LOGGER.debug(
                                "Have a new source address for %s, %s",
                                event_entity,
                                new_address,
                            )
                            self.pb_state_sources[event_entity] = new_address.lower()
                            # Flag that we need new pb checks, and work them out:
                            self._do_private_device_init = True
                            # If no sensors have yet been configured, the coordinator
                            # won't be getting polled for fresh data. Since we have
                            # found something, we should get it to do that.
                            # No longer using async_config_entry_first_refresh as it
                            # breaks
                            self.hass.add_job(self.async_refresh())
Watch for new mac addresses on private ble devices and act.
custom_components/bermuda/coordinator.py