Newbee question: Use of change-Node

Hello everybody
Yes, it's a beginners question and yes, there are many instructions on the web, but no, I didn't find something helping me :cry:
I use a Shelly 2 for a blind and a Sonoff mini for a bulb. Both are working with Tasmota.
The bulb have to be on or off dependig the blind is up or down. So I created the following flow, but it is not workig.


blind.json (4.2 KB)

Where ist my fault? Many thanks for your help
Whabby

Hi,
Topics should be:

stat/YOUR_TOPIC/RESULT -> subscribe state
cmnd/YOUR_TOPIC/Power -> to write state

For your change node it will depend on what you receive from Blind

Hi
This I don't understand. This flow for example:


In the debug1 the msg.payload is "ON", that's correct
With the change node, msg.payload is changed to OFF
The debug2 also shows me as result the msg.payload "OFF", so everything is correct til now. This msg.payload is sended finally to the mqtt out node. This module is actually ON and should change to OFF now, but nothing happens. Why that?

I'm not an expert with Tasmota but topics pattern are standardized (by Tasmota), your ON/OFF command will only work if you publish on the right topic.

A thing like cmnd/tasmota/Power

Where tasmota is your topic defined in settings:
Capture d’écran 2023-12-02 à 20.41.51

Here's part of one of my flows to control SonOff switches flashed with Tasmota.

I just send a msg.payload = 1 (from the change node) to turn the switch ON.
tasmota_A
tasmota_B

This is what the feedback flow looks like.


tasmota_D
This is what is in the function node.

if (msg.payload.POWER == "OFF") {
    msg.payload = "Light is off";
    node.status({fill:"grey",shape:"dot",text:"Light is OFF"});
    return msg;
}
else if (msg.payload.POWER == "ON") {
    msg.payload = "Light is ON";
    node.status({fill:"green",shape:"dot",text:"Light is ON"});
    return msg;
}
else {
    return null;
}
1 Like

It looks like you have changed the standard topic settings.
You can check or change them, via -

  • %prefix% = one of three prefixes as defined by commands Prefix1 (default = cmnd), Prefix2 (default = stat) and Prefix3 (default = tele).

Personally I would recommend leaving them at default, unless there is a very good reason. Otherwise you will have issues with future support as we don't know how you have things setup, it's difficult to help you.

Either change back to default, or post here exactly what you have setup, so we can try and figure out what you need to use as a topic with the above flow.

Another thing you could try is to check what your Tasmota "Console" is reporting.
Go to the IP address of your Tasmota device and click on the Console option.


You should see what Tasmota is publishing via MQTT.
console_A
As you can see the topic 'tele/node54/STATE' is reported every 300 secs (5 minutes) while 'stat/node54/POWER' and 'stat/node54/RESULT' are reported more frequently.

Another option is to install MQTT Explorer (or equivalent) and become a "network detective".
mqtt_explorer

1 Like

Hi everybody
Thanks for your help. It's nice to find everytime such people willing to help others! My probelm is soved. After resetting all (node-red, mosquitto, shelly2 and sonoff mini) all is working as planed with my original flow. I dont't have any idea why, but it's working perfect :roll_eyes:
Regards whabby

3 Likes

Really pleased to hear you got it working - well done.

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