# Newbee question: Use of change-Node

**URL:** https://discourse.nodered.org/t/newbee-question-use-of-change-node/83383
**Category:** General
**Created:** [2 December 2023 16:50 UTC](https://discourse.nodered.org/t/newbee-question-use-of-change-node/83383 "2023-12-02T16:50:48Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![whabby](https://avatars.discourse-cdn.com/v4/letter/w/8edcca/32.png) [@whabby](https://discourse.nodered.org/u/whabby)
#### Post date: [2 December 2023 16:50 UTC](https://discourse.nodered.org/t/newbee-question-use-of-change-node/83383/1 "2023-12-02T16:50:48Z")

</div>

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 😢  
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.

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/a/ea6006ed4084d7b61f781e048c1fce74aa66aa13.png)  
[blind.json](https://discourse.nodered.org/uploads/short-url/5b4SnZQvkEMCg3kBxY6Bf1Gf51H.json) (4.2 KB)

Where ist my fault? Many thanks for your help  
Whabby

---

<div class="post-metadata">

### Author: ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)
#### Post date: [2 December 2023 17:07 UTC](https://discourse.nodered.org/t/newbee-question-use-of-change-node/83383/2 "2023-12-02T17:07:33Z")

</div>

Hi,  
Topics should be:

```auto
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

> **[MQTT - Tasmota](https://tasmota.github.io/docs/MQTT/#command-flow)**
>
> Documentation (Wiki) for Tasmota

---

<div class="post-metadata">

### Author: ![whabby](https://avatars.discourse-cdn.com/v4/letter/w/8edcca/32.png) [@whabby](https://discourse.nodered.org/u/whabby)
#### Post date: [2 December 2023 19:15 UTC](https://discourse.nodered.org/t/newbee-question-use-of-change-node/83383/3 "2023-12-02T19:15:38Z")

</div>

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

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/e/de2cf19a2bb67789ba7e12a39bb7032868964871.png)  
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?

---

<div class="post-metadata">

### Author: ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)
#### Post date: [2 December 2023 19:32 UTC](https://discourse.nodered.org/t/newbee-question-use-of-change-node/83383/4 "2023-12-02T19:32:53Z")

</div>

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’écran 2023-12-02 à 20.41.51](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/8/a8ce964cdfcb977d3fff7204630ea3ff08e76ba4.png)

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [2 December 2023 19:48 UTC](https://discourse.nodered.org/t/newbee-question-use-of-change-node/83383/5 "2023-12-02T19:48:40Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/3/53368f74b2e3dab0d16d1317772eb42379920c6d.png)  
 ![tasmota_B](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/8/28e64cf0c78a2332d4a904b8bb518ac5ee8b1623.png)

This is what the feedback flow looks like.

 ![tasmota_C](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/7/97a20fa4cfbce51ad7b729e81b6696ce90626665.png)  
 ![tasmota_D](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/fe7ecaa20a621f94eddf16a835e9bbe95a64c099.png)  
This is what is in the function node.  
 ![tasmota_E](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/2/520fe054b5a5178facd46eb9c023bd49d85cdb44.png)

```auto
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;
}

```

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [3 December 2023 05:09 UTC](https://discourse.nodered.org/t/newbee-question-use-of-change-node/83383/6 "2023-12-03T05:09:49Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [3 December 2023 08:42 UTC](https://discourse.nodered.org/t/newbee-question-use-of-change-node/83383/7 "2023-12-03T08:42:58Z")

</div>

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.

 ![console_B](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/d/dd65253bd9a9b4dd47805cd54f69c9583d73b641.png)  
You should see what Tasmota is publishing via MQTT.  
 ![console_A](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/0/50058aa42c2e2a27ffb0aff47d6dd91e4d22b4db.png)  
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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/2/22bfbb2c04f17064287eacc0f7e2a480fbcf761b.png)

---

<div class="post-metadata">

### Author: ![whabby](https://avatars.discourse-cdn.com/v4/letter/w/8edcca/32.png) [@whabby](https://discourse.nodered.org/u/whabby)
#### Post date: [3 December 2023 16:20 UTC](https://discourse.nodered.org/t/newbee-question-use-of-change-node/83383/8 "2023-12-03T16:20:00Z")

</div>

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 🙄  
Regards whabby

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [3 December 2023 16:40 UTC](https://discourse.nodered.org/t/newbee-question-use-of-change-node/83383/9 "2023-12-03T16:40:57Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [1 February 2024 16:41 UTC](https://discourse.nodered.org/t/newbee-question-use-of-change-node/83383/10 "2024-02-01T16:41:57Z")

</div>

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