mirror of
https://github.com/janishutz/mqtt-remote-gpio.git
synced 2026-10-09 05:06:21 +02:00
feat: improved payload infra
This commit is contained in:
1 parent
cd0f894e73
commit
5ab9056b55
2 files changed
+6
-3
No files matched your search
+1
-2
@@ -39,11 +39,10 @@ pub fn handler(config: Config) {
|
||||
// TODO: handle fails
|
||||
let val = read_pin(&mut topic.gpio);
|
||||
if val != pin_state[i] {
|
||||
println!("Value change for pin {} detected", topic.id);
|
||||
pin_state[i] = val;
|
||||
client
|
||||
.publish(
|
||||
String::from(&topic.topic) + &format!("/{}", topic.id),
|
||||
String::from(&topic.topic),
|
||||
QoS::AtLeastOnce,
|
||||
false,
|
||||
if val == 0 { off.clone() } else { on.clone() },
|
||||
|
||||
Reference in new issue
Block a user