Skip to content

Commit

Permalink
Publish hold message on receipt of WriteSingle packets (#32)
Browse files Browse the repository at this point in the history
* Publish new lxp/hold/xx message on RX of WriteSingle packets

* Update changelog
  • Loading branch information
celsworth authored Nov 1, 2021
1 parent 43b8d6b commit 158a2a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased

* Fix "Channel closed" crash when MQTT is disabled (#31)
* Fix: Send missing MQTT lxp/hold/XX message with new register value on receipt of a WriteSingle packet (#32)


# 0.4.0 - 12th October 2021
Expand Down
9 changes: 8 additions & 1 deletion src/coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,14 @@ impl Coordinator {
payload: serde_json::to_string(&r3)?,
}),
},
DeviceFunction::WriteSingle => {}
DeviceFunction::WriteSingle => {
for (register, value) in t.pairs() {
r.push(mqtt::Message {
topic: format!("{}/hold/{}", t.datalog, register),
payload: serde_json::to_string(&value)?,
});
}
}
DeviceFunction::WriteMulti => {}
},
Packet::ReadParam(rp) => {
Expand Down

0 comments on commit 158a2a1

Please sign in to comment.