Using an external button to change tabs

It should have been pretty straight forward to be able to control which tab is visible using an external button through Raspberry Pi 4, but after hours of trying (and failing) I'm reaching out to you guys for help.

So far I have 3 nodes attached:

[ rpi - GPIO in ] --> [ set msg.payload ] --> [ ui control ]
I also connected a debug node to the set node.

The GPIO node works well and I can see the status changing from 0 to 1 when I press the button and back from 1 to 0 when I release.

In the set node I defined as follows:
set msg.payload --> [type=Jason] {"tab":"Tab 2"}

Current status:
The tab changes to "Tab 2" whenever the button changes it state, both from 1 to 0 and from 0 to 1.

The problem:
I want it to change tab only when the button state changes from 0 to 1

Welcome to the forum.

Add a Switch node in series so that it only passes messages where the payload is 1

image

It works.

THANK YOU !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.