move the device event broadcasts outside of the set_state callback