How can i have a physical button that toggles a switch on the dashboard?

hi, i'm using NodeRed on my raspberry pi, and I have a physical button wired up to the GPIO pin and it works.

what's the easiest way to make a switch on the dashboard turn on if it's off, and vica versa, when i press the button?

You can change the state of a switch in the dashboard by sending it a message with either
msg.payload = true or msg.payload = false ( note they are boolean not strings)

The easiest way is therefore probably to use a change node to change the value you are getting from your physical switch into boolean true or false, before sending that to your dashboard switch

Thank you that worked and I also had to check te pass through when msg arrives

hi can i know the details about your project? im in the same situation also

what you want to do is connect one wire to the ground of your raspberry to the button.
Than from the button to whatever Pin your using

in Node red u want to select the Pullup resistor as seen on the foto
The raspberry pi GPio node is needed for linking to a button or switch in node-red

that will do the trick