Skip to content

Commit

Permalink
Merge pull request #452 from FlowFuse/311-ui-switch-onoff
Browse files Browse the repository at this point in the history
UI Switch - Check msg.payload against on/off values, not just isTruthy()
  • Loading branch information
joepavitt authored Dec 22, 2023
2 parents 9af2501 + 4ccb7c9 commit ad6115c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nodes/widgets/ui_switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ module.exports = function (RED) {
datastore.save(node.id, msg)

node.status({
fill: msg.payload ? 'green' : 'red',
fill: (msg.payload === true || msg.payload === on) ? 'green' : 'red',
shape: 'ring',
text: msg.payload ? states[1] : states[0]
text: (msg.payload === true || msg.payload === on) ? states[1] : states[0]
})

if (config.passthru) {
Expand Down

0 comments on commit ad6115c

Please sign in to comment.