def set_state(self, state, force=False):
     """Set the state and push events if necessary."""
     with self._exception_lock:
         if force or self.connected:
             Device.set_state(self, state)
         if self.push_events:
             state_attr = self.get_device_attr().get_attr_by_name('State')
             state_attr.fire_change_event()