diff --git a/uplink/src/base/actions.rs b/uplink/src/base/actions.rs index 047950bf3..229339e5f 100644 --- a/uplink/src/base/actions.rs +++ b/uplink/src/base/actions.rs @@ -22,6 +22,9 @@ pub struct Action { // Instant at which action must be timedout #[serde(skip)] pub deadline: Option, + // Marker that action was received through newer action topic and must be responded to on similarly named topic + #[serde(skip)] + pub new_topic: bool, } #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/uplink/src/base/mqtt/mod.rs b/uplink/src/base/mqtt/mod.rs index 48cda5035..4f1586591 100644 --- a/uplink/src/base/mqtt/mod.rs +++ b/uplink/src/base/mqtt/mod.rs @@ -150,11 +150,13 @@ impl Mqtt { return Ok(()); } + let mut action: Action = serde_json::from_slice(&publish.payload)?; + if self.config.actions_subscription != publish.topic { // Set a marker in recevied action for later use + action.new_topic = true; } - let action: Action = serde_json::from_slice(&publish.payload)?; info!("Action = {:?}", action); self.native_actions_tx.try_send(action)?;