Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // msg.on is true when command was "on" or dimming, else false
- // when command was dimming, then msg.meta.input.bri is present,
- // but bri does not contain the correct dimming value,
- // correct value is in presence
- if(msg.on == true)
- if(msg.meta.input.hasOwnProperty("bri")) // Command was dimming
- msg.payload = msg.percentage;
- else // Command was on/off
- msg.payload = 100;
- else // off
- msg.payload = 0;
- return msg;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement