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

Virtual Smart Home

I know there are already some Alexa nodes available for Node-RED, but the ones I tried did not proof to be reliable or convenient enough. Hence I went all in and created virtual smart home, which consists of a Node-RED module and a corresponding Alexa skill that leverages the AWS IoT cloud as a super reliable and scalable backbone.

What is it for?

Let's say you have built some fancy automations with Node-RED, for instance a plant watering system, a smart plug, a light or even some complex routines. Great, now you can control that from within Node-RED, e.g. using the NR dashboard. But sometimes nothing beats the convenience of simply using your voice to control things. If you own an Amazon Alexa compatible device, virtual smart home is for you!

Highlights

  • supports a growing set of device types
    • Switch
    • Plug
    • Dimmable Light Bulb
    • Color Changing Light Bulb
    • Dimmer Switch
    • Blinds
    • Garage Door Opener
  • no separate account needed. Just link your existing Amazon account.
  • new virtual devices can simply be dragged onto the Node-RED canvas and will proactively be discovered by Alexa. No need to ask Alexa to discover devices.
  • devices that are no longer needed can be removed from Alexa via the Node-RED editor.
  • local state changes of devices get synchronized with Alexa
  • secure communication with the IoT cloud through individually provisioned certificates

How does it work?

The node gets invoked through Amazon Alexa (either via a voice command or via the Alexa app) and outputs a msg object containing the updated device state as payload. For example, when you say "Alexa, dim the kitchen light to 50 percent", the following msg object will be emitted:

{
  "brightness":50,
  "powerState":"ON",
  "source":"alexa"
}

The node also accepts incoming messages that can be used to inform Alexa about local device changes, which will then be reflected in the Alexa app. If the passthrough option is enabled, this will also trigger an outgoing message, just like when the node gets invoked via Alexa. In this case payload.source is set to device instead of alexa.

Your feedback is appreciated

I've been running virtual smart home in my own home for some time now and it never let me down. But I'm sure it can get even better. Feel free to make suggestions or report problems.

Looking forward to your feedback!

Thank you!

6 Likes

Hi linking was quick and easy.
The devices are not auto discovered, Have not asked alexa to discover as yet, giving it some time to auto find.
edit/ ok working.

Would be nice if the msg contained the name of the switch
i.e.

{"payload":{"source":"alexa","powerState":"ON"`,"vDevice":"lounge wall"},"_msgid":"c5c6fa9a.575c18"}

P.S. Nice work, seems very quick, will give it a try over the next week.

Thank you for the excellent suggestion! Included in v1.7.0 :grinning:

2 Likes

One more suggestion.

option for when receiving an incoming msg, to only accept messge if vDeice property equals virtual device nodes name.

That way we could have one function node feeding all my virtual device nodes, and no need for a switch node, or multiple outputs on a function node.

Woo - that's a brilliant enhancement... shows "type" as well as "name". Thanks.

Screen Shot 10-17-20 at 01.45 PM

1 Like

It seems it does not work with german acconts. Is that right?

regards

German accounts should work as well as English, French, Spanish and Italian ones. What kind of issue are you running into?

Because via the link provided
.................................................
The connection must be linked to the same Amazon Alexa account that was / will be used to activate the 'virtual smart home' skill.

Go to https://amazon.com/de/code on your smartphone, computer, or tablet and enter this code after loggin in:
................................
I need to login with my amazon.com account but my devices are not in this account.
I have an amazon.de account.

Amazon account identities are global, so you should be able to login at https://www.amazon.com/us/code with your German account credentials. Have you tried it?

yes and it did not work.
I have the same email adresse for both accounts but different passwords.
And when i want to use the password for my amazon.de account it tells me wrong password.
And when i login with my password for the amazon.com account it works, but there are no alexa devices registerd.

Hmm, that's the first time I come across such a problem. I only have one Amazon account and can use it on .de and .com. I found this article, which might (or might not) be helpful: https://www.zauberware.com/en/articles/2018/amazon-difference-indifference-amazon-com-vs-amazon-de

Hi, i created a new Amazon account at amazon.de and can now login at amazon.com with the same login data.
I created one flow in node red with a virtual switch and connected it via the link and the code.
It seems to be online but the alexas registered at the new account didnt find a new device.

Just to be sure: You activated the "virtual smart home" skill via the Alexa app and completed the account linking process there with the very same Amazon account? Did the account linking go through successfully? What does Alexa respond when you ask her to switch "teestatsestas" on?

P.S. You seem to be running a rather old Node-RED version (1.0.0-beta.2). In order to eliminate as many sources of failure as possible, you might want to upgrade to NR v.1.2.2.

sorry i missed to activate the skill.
I dont know why :slight_smile:

I will test and report back.

I tested and the first impression is very good!!!

  1. You need an amzon account where you can login at .de and .com
  2. Dont forget to activate the "virtual smart home" skill

Thanks for this.

1 Like

So i tested a few funktions.
About the blind, i the app i can only close and open the blinds.
But it would also be a very good option to go to percentege.
see the links

I will look into supporting %-based commands for blinds. As a workaround, you could also (mis)use a "dimmable light" instead.

Thx.
I know i can use a dimmable light but then its not handled 100% right in alexa when you say all lights off or something like this.

I also tested the "Garage door opener" but this i cant control via alexa

RGB Lamp OFF remain OFF asking color.

Using an RGB lamp bulb, if the lamp is off and I ask Alexa "set lamp to Red" the powerState value transmitted by the node remains OFF, so the lamp does not turn on

Hi and welcome to the forum

This is a general feature that all/nearly all lamp nodes employ.

The on/off is one function

Colour is another function

Brightness is another function

So, it is up to us programmers to tell the lamp to switch on and then change color