Slider - If msg arrives on input ... misleading

The ui slider node has a checkbox labelled 'If message arrives on input, set slider to new payload value`. However, for me, the slider position on the display seems to always be updated by a message, but the select box actually controls whether a message is sent or not. So it performs like the Pass Through checkbox on the Switch. I believe the behaviour is correct but does not seem to match the words in the config dialog.

In addition, in the help text, it says
"Note: An input msg to the slider node will not change the status information displayed unless the slider node output is connected to another node."
That does not seem to be correct, whether it is connected to another node does not seem to affect the status display.

I am running node-red 1.2.2 and dashboard 2.23.4 with Waterfox browser.

Am I alone in thinking that the checkbox description is wrong, and that the help text referenced is also wrong?

I think there could be a bug and the check box is being ignored

It does work, if the correct action is to pass through the message when the box is checked, just like the pass through checkbox on the mqtt node.

I think that if a msg comes into a ui node, it should eithor change the status on the dashboard AND forward the message onward or not change the status on the dashboard and not send the msg on. But then, I didn't code those nodes....

i.e. it should be consistant for all dashboard nodes.

That isn't what a ui_switch node does. If the payload is valid it will always update the switch state, whatever the pass through checkbox is set to. In fact that is exactly what is required in the common case of setting the switch to show the state of the input and sending the switch message of to some device that responds when it sees the new state, and that is sent back to the switch input to update the visible state. The checkbox being clear prevents a loop.

I guess I look at it as the device is paramount. If the device on the dashboard changes, it should send a msg out to reflect the change so that the action of changing the device on the dashboard acts the sames as a message coming in.

And I agree loops can be a problem if you feed back to the input of the device but there are ways to prevent that. I just posted a flow yesterday about a button. The user wanted to press the button and have a relay turned on and the label change. Then one second later have the label change back and the relay shut off.

I actually don't care which way it ends up as long as there is a standard that is the same across the dashboard.

The way it is currently implemented in the slider is consistent with the switch. It is just (I believe) the words in the dialog that are confusing. I don't want a change in function.

What is messy with the switch is that the you have the option of showing the indicator based on the input msg or the output message. So you can set it up where clicking the switch on the dashboard sends a false out of the node, but the switch still shows as being on - it doesn't move. Just uncheck Pass through msg if payload matches new state the select 'Switch icon shows state ofthe output`

That is exactly the desired behaviour when you want the switch to show the state of the real world system. For example, imagine I have a Sonoff switch controlling a fan. The ui_switch output goes to the MQTT Out topic to control the fan. An MQTT In is configured to pickup the state of of the Sonoff device and feed it into the ui_switch. With the switch configured to Not Pass Through and to Show State of Input, when I click the switch the display does not change, but it sends the command to switch the fan. The Sonoff then sends the new state, which goes into the switch which updates to match the real world. In practice this is effectively instantaneous, there is no discernable delay on the display. If, however, the Sonoff is not accessible for some reason then clicking the ui_switch has no effect on the display so it is clear that there is a problem. Also, if the the Sonoff is connected ok and I manually press the button on the Sonoff to change its state then the ui_switch automatically updates to show the state of the real world. Perfect.

1 Like

I have submitted a PR to improve the words.

1 Like

you have also added extra that is not required.

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