Advertisement
Guest User

Untitled

a guest
Feb 20th, 2021
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // msg.on is true when command was "on" or dimming, else false
  2. // when command was dimming, then msg.meta.input.bri is present,
  3. // but bri does not contain the correct dimming value,
  4. // correct value is in presence
  5.  
  6.  
  7. if(msg.on == true)
  8.   if(msg.meta.input.hasOwnProperty("bri")) // Command was dimming
  9.     msg.payload = msg.percentage;
  10.   else // Command was on/off
  11.     msg.payload = 100;
  12. else // off
  13.  msg.payload = 0;
  14.  
  15. return msg;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement