diff --git a/index.html b/index.html index 541d3a4..816e055 100644 --- a/index.html +++ b/index.html @@ -79,6 +79,9 @@

Inputs

payload.ct string
The mired color temperature of the light (min 153, max 500)
+ +
payload.forceSend boolean
+
Force the hub to send the payload, even when state is unchanged

Outputs

diff --git a/index.js b/index.js index 0eba1eb..e60dd50 100644 --- a/index.js +++ b/index.js @@ -98,13 +98,15 @@ module.exports = function(RED) { msg.payload.deviceid = formatUUID(nodeDeviceId); - // Send payload if state is changed - var stateChanged = false; - var deviceAttributes = getDeviceAttributes(msg.payload.deviceid, hubNode.context()); - - for (var key in msg.payload) { - if (key in deviceAttributes && msg.payload[key] !== deviceAttributes[key]) { - stateChanged = true; + // Send payload if state is changed or force send is set + var stateChanged = msg.payload.forceSend ? true : false; + if (!stateChanged) { + var deviceAttributes = getDeviceAttributes(msg.payload.deviceid, hubNode.context()); + + for (var key in msg.payload) { + if (key in deviceAttributes && msg.payload[key] !== deviceAttributes[key]) { + stateChanged = true; + } } }