I trying to get a very simple flow to work. It has a virtual alexa device which is connected at all times to my amazon account. I then have this going to a switch node with String ON and one with string OFF.
These then link to a call service node from home assistant. This node is linked to a smart plug.
If i link virtual device directly to the call service node it works fine. plug comes on. Thats fine but i need to add a switch so i can also turn it off. If i add a debug to the end of the call service node and ask alexa to turn on device, it shows in the debug window. If i also have a debug on the ON leg of the Switch node i get no output. Its almost like the switch node is broken, yet i have replaced it a few times.
Hello,
Can you show us a screenshot of the output you see in the debug tab when a debug node is directly connected to the virtual device and another one of your switch node settings? This would be really helpful to be able to understand your problem and find possible solutions.
Your switch node is set up to check msg.payload for ON or OFF but if you look at what you are getting in the msg.payload its not a string but an object. This object includes a powerState property which has this information. So you will have to change your switch node to check for the ON and OFF strings in msg.payload.powerState instead for the check to work.
Have a read of the docs page Working with Messages, that should prove very helpful. Also, if you have not done so already, then watch right through the Node-red Essentials videos linked to the the docs. You will soon get back the hour or so spent doing that.
Thanks colin. I'll do that. It will probably inspire lots of cool ideas for automatons. Trouble is i don't have many plugs, switches etc at the moment. I'm hoping to move house in 2021 and really going to go for it.