[ANNOUNCE] node-red-contrib-virtual-smart-home for Alexa

Actually, since this behavior is not intuitive at all, I already changed it for brightness and will do the same for color and color-temp soon. So when you ask Alexa to turn on a lamp to 50%, the powerState attribute will simultaneously be set to „ON“.

2 Likes

quick update: I just deployed an update of the backend which contains the aforementioned convenience features: Lights will be switched to "ON" automatically when brightness, color or color temperature are updated.

1 Like

how would i change colour of lamp, but not turn it on?

Would it make more sense to send on/off command with colour, brightness and temp

Well, you could argue that setting the color of a lamp implicitly should switch it on, too. At least that‘s what most users expect. If you asked Alexa to turn on red light, and the lamp stays dark, this is perceived as not working, even though the color attribute of the lamp was indeed updated.

I may want to set the colour or brightness to a level but not turn on the lamp, I would argue that its best to either send on command with colour and brightness, or send it seperatly,. That way the user can program the response they wish.

How do you tell Alexa in one command to do two things?

I think you are right. This is about a physical device that humans observe. It should do what is sensible for regular users. If I set it to 50% red I think most users would expect to see it alight. If I was odd enough to ask for 100% black I would expect it to be off. If I just set brightness to 80% I would expect it to go to 80% on with whatever the last colour was set to.

Great, that's perfect !!

I'm having trouble figuring out what message the alexa node is sending.

Is it possible to have a field in the node message that indicates a message sent by Alexa?

Like:
msg.payload.comand

TurnOn
TurnOff
SetBrightness
SetColor
SetColorTemperature
etc ...

That' a great idea! I just release v.1.11.0 that includes a msg.payload.directive attribute.

1 Like

The new "msg.payload.directive" attribute worked perfectly until a few hours ago, but now it doesn't work anymore.
Always comes the command "TurnOff" or nothing

Hmm, the backend hasn‘t been touched since a while. Could you please share an example flow demonstrating the issue?

Alexa, "switch off Camera" returns this:

{
   "payload":{
      "source":"alexa",
      "powerState":"OFF",
      "brightness":100,
      "colorTemperatureInKelvin":2000,
      "lightMode":"temp",
      "color":{
         "hue":255,
         "saturation":0.56,
         "brightness":1
      },
      "directive":"SetColor",
      "name":"Led Camera",
      "type":"COLOR_CHANGING_LIGHT_BULB",
      "color_rgb":[
         148,
         112,
         255
      ],
      "color_hex":"9470FF",
      "color_cmyk":[
         42,
         56,
         0,
         0
      ]
   },
   "_msgid":"4b629033.63ebf"
}

Directive is "SetColor" instead of "TurnOff"

Thanks for reporting. I'll track this here: https://github.com/csuermann/node-red-contrib-virtual-smart-home/issues/12

But will this node actually let you say "set bulb to 50% red"?

If it does - then fair enough

But all others I've tried just let you set brightness or colour but not both at same time

AFAIK it's a fundamental Amazon limitation

But I could be completely wrong

Correct, Amazon' Smart Home Skill is based on directives that change a single attribute at a time, e.g. "TurnOn", "TurnOff", "SetBrightness", "SetColor" etc.

AFAIK it's not possible to instruct Alexa to carry out more than one directive at once.

I can instruct alexa to turn on light to 50%, or turn on light and set to 50%. I can also turn on light and set to blue.

With what node?

And by which voice command exactly?

No node as i just instruct alexa to "turn on garden light and set to blue" or "turn on bedroom light and set to 50%"

I was just pointing out you can give alexa multiple instructions

All Alexa hears with those invocations is the „set to blue“ or „set to 50%“. The „turn on“ part is implied. You can omit it with the same result.

1 Like