woozar / node-red-contrib-time-based-dimmer

MIT License
4 stars 4 forks source link

Add parameter with current brightness level #4

Closed geoffreydemaagd closed 4 years ago

geoffreydemaagd commented 4 years ago

Hi Woozar, would it be possible to add a parameter with the current brightness?

Now this node chooses itself what the current value of the brightness is.

For example if the lamp is at 50% I would sent 50 what will be between the min and max value.

The lamp can be dimmed via different channels, like sliders, Google home and they should be in sync. Is this possible?

Many thanks

woozar commented 4 years ago

This should actually already be working if you send a number as payload. Please let me know if it doesn't.

switch (typeof msg.payload) {
  case 'number':
    node.status({ fill: 'grey', shape: 'dot', text: msg.payload.toString() })
    node.context().set('value', msg.payload)
    send(msg)
  break
geoffreydemaagd commented 4 years ago

Hi Woozar, I tested it indeed with a string for the dimming commands and a number for the brightness and I works jusy like you said. Thanks for the help. I'll close this issue.