Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ For occupancy sensors the value for `NEWSTATE` is either `true` for occupancy de
For smoke sensors the value for `NEWSTATE` is either `true` for smoke detection or `false` for no smoke.

## Switch
For switches the value for `NEWSTATE` is either `true` for on or `false` for off.
For switches the value for `NEWSTATE` is either `true` for on or `false` for off. Alternatively use the value `toggle` to make the switch to into its other state.

## Push button
For push buttons the value for `NEWSTATE` is `true`. The button will be released automatically.
Expand Down
3 changes: 3 additions & 0 deletions src/homekit/accessories/HttpWebHookSwitchAccessory.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ HttpWebHookSwitchAccessory.prototype.changeFromServer = function(urlParams) {
else {
var state = urlParams.state;
var stateBool = state === "true";
if (urlParams.state === "toggle") {
stateBool = !cachedState
}
this.storage.setItemSync("http-webhook-" + this.id, stateBool);
// this.log("[INFO Http WebHook Server] State change of '%s'
// to '%s'.",accessory.id,stateBool);
Expand Down