Hi!
I tried out virtual switches quite a while ago in some earlier beta. Today I decided to give it another try after all the recent changes. Not going so well. I added a simple toggle switch. The switch shows up in the GUI, and output payload equals 1 for on and 0 for off. Happily I tried to add 2 inject nodes. One for On that send 1, and one for Off that sets the payload to 0. Result when testing: “Received invalid payload, expected an object with payload. Ignoring.”
Have spend almost an hour, trying to get the virtual switch to accept input, but no matter what I send as payload to the virtual switch, I get the error message “Received invalid payload, expected an object with payload. Ignoring.”
Tried sending 1 and 0 as numbers, text, tried copying all the properties output from the virtual switch and input the same. Tried sending booleans, “On” Off”, and everything i can think of, but nothing is accepted.
Not sure if there’s a bug or if I have misunderstood something fundamental?
Input is a json object with one (or more) paths to set. E.g.:
{
"/SwitchableOutput/output_1/State": 1
}
If you want to set both dimming value and toggle:
{
"/SwitchableOutput/output_1/State": 1,
"/SwitchableOutput/output_1/Dimming": 25
}
I tried to make the documentation as clear as possible, showing these most relevant paths directly in the edit panel. If you have some suggestions on how to further improve that, feel welcome to share some ideas.
Thanks! Of course its me! ![]()
Makes sense now. It just might be me that is a bit stupid, but a suggestion is to start with:
“Input:”
JSON object with {path: value} or {path1: value, path2: value..} and then add the text “most relevant path(s)” stuff.
Just my single opinion, but it would at least have gotten me on the right track a whole lot sooner.
But then again, my mother claims that I am sort of “special”… ![]()
Well, lets just make sure that even your mum will understand. ![]()
Apart from adding your suggestion to the documentation I’ll add some extra input validation, giving more clear suggestions on what to do when the input isn’t a JSON { path: value } format. Giving a clear node.statusand a node.warn in the debug tab.
And then on the documentation I’ve adjusted it to look like:
I agree this is way clearer. Thanks for pointing this out. When developing it you don’t always see what the end-user, who isn’t familiar with all of the changes and the logic behind it, will think. In my world the leading slash of the path was the biggest problem and programmed the input to be liberal for both cases.
Looks like a great solution! Hopefully you have covered most of the spectrum of idiots now. ![]()
@mpvader Would it be possible to add the function: “Output Only on release” to the sliders in node red?


