Skip to content

Commit

Permalink
mqtt: fix switch
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Apr 11, 2024
1 parent 96a0a6b commit c6ea727
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins/mqtt/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/mqtt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@
"@types/node": "^18.4.2",
"@types/nunjucks": "^3.2.0"
},
"version": "0.0.78"
"version": "0.0.79"
}
6 changes: 5 additions & 1 deletion plugins/mqtt/src/autodiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,11 @@ autoDiscoveryMap.set(ScryptedInterface.OnOff, {
},
subscriptions: {
'on/set': (device, event) => {
device.on = event.json;
const d = sdk.systemManager.getDeviceById<OnOff>(device.id);
if (event.json)
d.turnOn();
else
d.turnOff();
}
},
});
Expand Down

0 comments on commit c6ea727

Please sign in to comment.