# Smarttings failure invalid topic

**URL:** <https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702>\
**Category:** General\
**Created:** [23 July 2024 13:34 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702 "2024-07-23T13:34:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgas37](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pgas37/32/76217_2.png) [@pgas37](https://discourse.nodered.org/u/pgas37)\
**Post date:** [23 July 2024 13:34 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/1 "2024-07-23T13:34:55Z")

</div>

Hello,  
I bought an Aeontec Smartthings hub en 3 zigbee switches. The goal of the project is integrate Smarthings in Domoticz, but as almost always i have some trouble on the way:

I created a flow with a debugnode at the end, before connect it to domoticz.

- when i deploy the flow i get debug output On or Off (the state of the switch.
- when i push the Injectnode i get the failure [msg : string[13] "Invalid topic"]
- 

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/c/2cb5760b640a4e123a2379bac24f95fd83c104e0.png)  
 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/8/082f2deef648b4bf9eab901166270e5f49b0d513.png)  
 ![smartthings flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/6/16fbe52eefb7e7579df34e2de4af66085d974126.png)

Please help

Thanks  
Paul

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [23 July 2024 18:08 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/2 "2024-07-23T18:08:01Z")

</div>

The 'Zigbee Switch 1' node expects a `msg.topic` with a valid topic.

Note that the switch node will not route properly as it is comparing numbers against letters.  
Change it to:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/9/a9db0abf04dc437a47cf1ce7b00ac97eb31ce4c1.png)

---

<div class="post-metadata">

**Author:** ![pgas37](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pgas37/32/76217_2.png) [@pgas37](https://discourse.nodered.org/u/pgas37)\
**Post date:** [23 July 2024 20:30 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/3 "2024-07-23T20:30:13Z")

</div>

Thanks,  
but i do not quite understand your anser:  
"Zigbee Switch 1"; is a OnOff node and has no possiblity to change properties

I tried to change the properties of the "Zigbee 1 aan" but no result. Same behaviour and error as before.

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/4/0490012066d54d8e4523d997c4353655f88170b6.png)

Paul

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [23 July 2024 20:46 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/4 "2024-07-23T20:46:55Z")

</div>

I don't know what node that 'Zigbee Switch 1' node is (node-red-contrib-??)  
It could also be that the inject node still has the default msg.topic enabled with an empty string possibly causing the error (if the zigbee node also accepts msg.topic as input, which you can hopefully read in the documentation of the node)

---

<div class="post-metadata">

**Author:** ![pgas37](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pgas37/32/76217_2.png) [@pgas37](https://discourse.nodered.org/u/pgas37)\
**Post date:** [24 July 2024 06:18 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/5 "2024-07-24T06:18:04Z")

</div>

Zigbee Switch 1 =

![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e76e41bf2bdb687697e55d805784cb3932b40796.png)

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/7/f76e7c2ca04403c78ee5bd820539e74db2687af0.png)

the properties of the injectnode are:

![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/b/cb45839b68a75c476ddac5aecc7fc8464d42dceb.png)

I changed msg.payload to msg.topic=\> true: same error

I changed msg.payload =\> numbers : same error

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [24 July 2024 06:26 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/6 "2024-07-24T06:26:15Z")

</div>

In the inject node, can you set `msg.topic` to 'update' or 'pull' ? (as [per documentation](https://flows.nodered.org/node/node-red-contrib-smartthings))

---

<div class="post-metadata">

**Author:** ![pgas37](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pgas37/32/76217_2.png) [@pgas37](https://discourse.nodered.org/u/pgas37)\
**Post date:** [25 July 2024 17:23 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/7 "2024-07-25T17:23:06Z")

</div>

the config discribed under SMARTAPP and "...follow these steps" are (for me) not the reality of to day anymore. Anyway i could not a possibility to create a project, etc, etc.

BUT..,

After some searching I changed the inject node :  
 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/e/4e8011b42428edd6a0790eab04887fb8cffd1669.png)

Pushing the button or setting a pull by timeinterval results in a nice output (no errors) which i connected to a MQTT OUT-node configured for Domoticz. The result is visibile in a virtual swicht in Domoticz. One part of the project finished. 😀  
Now the other part: The output of the virtual switch (On or Off) in Domoticz to the switch in Smartthings.

I should be somthing like this.

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/4/a48bd8140bf1ae25ef4cd3fc3a40dc4cdb203c8f.png)

any advice?

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [25 July 2024 17:48 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/8 "2024-07-25T17:48:05Z")

</div>

The code for your function node will depend on the incoming message. Please provide an example of the incoming `msg` that would be received. If you place a debug node after the node labeled `Filter Switch` and send a message it will show up in the debug panel.

But you will probably need something like the following:

```auto
msg.topic = "switch";
msg.payload = { "value": msg.variable }; // you will need to replace the word variable with the message property used on the incoming msg

```

---

<div class="post-metadata">

**Author:** ![pgas37](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pgas37/32/76217_2.png) [@pgas37](https://discourse.nodered.org/u/pgas37)\
**Post date:** [26 July 2024 11:52 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/9 "2024-07-26T11:52:15Z")

</div>

Hi,

Sorry, but i need more detailed help.The documentation is not clear enough for me.  
i made the flow;

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/8/187dddcfc988e6650f16877d753fe980d218ab44.png)

push the inject gives the debug408 output on the right side of the screen.

the "domoticz/out' node filtered by an Mqtt explorer when switching the virtual Zigbee switch in Domoticz result in :  
 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/4/a44768496e2efe7e693558d63544ca7570cd8156.png)

Question:  
how do i need to config the switch to filter the idx:10903 from all the domoticz/out data?  
how do i need to config the function 2/3 in order to put the Zigbee Switch 1 on or off

thanks a lot

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [26 July 2024 20:15 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/10 "2024-07-26T20:15:48Z")

</div>

Try this:

```auto
msg.topic = "switch";
msg.payload = { "value": msg.payload.value};

```

But to be honest, it is difficult to help when in each response you rename your nodes and provide an incomplete picture of what is going on. For example, why are there 2 functions nodes now? They will likely cause an issue with each other because you are duplicating the messages sent to the "Zigbee Switch 1" node now. Furthermore, set your "debug" nodes to output the `complete msg object` not just the `msg.payload`, also expanding the result in the debug panel can help too.

---

<div class="post-metadata">

**Author:** ![pgas37](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pgas37/32/76217_2.png) [@pgas37](https://discourse.nodered.org/u/pgas37)\
**Post date:** [27 July 2024 09:36 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/11 "2024-07-27T09:36:28Z")

</div>

Oke, sorry for the inconvienance.

From scratch:  
the flow

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/0/705e348d2cfeb1b52cee8a5d05b20ef043b00c56.png)  
The debugnode name explains the output setting. As requested .

The settings of the Filter Switch  
 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/7/97f8385be8006a3cc7212b37c1b6fc4893af0575.png)

The settings of the function node as you suggested

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/7/6776344ed6922fa794e8df73b72f3b075ad28309.png)

Pushing the Inject node results in output of the debugs 413 en 414

Pushing the virtual switch in Domoticz : no debug output 412

II read something about converting the json string so i added the json node in the flow (config as in the name):

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/6/8686347b92d2098c42c857e0d8d800c94c828f29.png)

Pushing the virtual switch in Domoticz result in debug output 412.  
(the debug information 413 and 414 are from the inject node)

I hope i have given all the information asked for

Thanks

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 July 2024 12:37 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/12 "2024-07-27T12:37:55Z")

</div>

The message coming out of the Filter Switch node is a string, so there is no `msg.payload.value`.  
What does the output of the MQTT node look like?

Also please in future please copy/paste text of function nodes and so on rather than screenshot.

---

<div class="post-metadata">

**Author:** ![pgas37](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pgas37/32/76217_2.png) [@pgas37](https://discourse.nodered.org/u/pgas37)\
**Post date:** [27 July 2024 13:51 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/13 "2024-07-27T13:51:46Z")

</div>

I added a debug to the MQTT (domoticz/Out) node.  
searched between all the output for the Zigbee Switch 1

```auto
RSSI: 12
description: ""
dtype: "Light/Switch"
hwid: "11"
id: "00016AE7"
idx: 10903
name: "Zigbee Switch 1"
nvalue: 0
stype: "Switch"
svalue1: "0"
switchType: "On/Off"
unit: 1

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 July 2024 14:53 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/14 "2024-07-27T14:53:48Z")

</div>

That is already a JavaScript object. By adding the JSON node you have converted it to a string. You don't want to do that. Take the JSON node out.  
Also note that there is not a msg.payload.value. There is an nvalue, perhaps that is what you want.

---

<div class="post-metadata">

**Author:** ![pgas37](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pgas37/32/76217_2.png) [@pgas37](https://discourse.nodered.org/u/pgas37)\
**Post date:** [27 July 2024 18:08 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/15 "2024-07-27T18:08:56Z")

</div>

for clarity:  
HaroldPeters asked a debug node (412). As described earlier, there was no output on 412. I added json in between, resulting in the output given earlier.  
i took out the json (your advice).  
Your wrote; 'there is not a msg.payload.value.., there is an nvalue" so i edited the function node and replaced the msg.payload.value for msg.payload.nvalue.

```auto
msg.topic = "switch";
msg.payload = { "value": msg.payload.nvalue};
return msg;

```

When I press the virtual switch in domoticz it gives no results in the debug nodes.

As previously written, the purpose of this flow is to operate the Zigbee Switch 1 via the virtual switch in Domoticz.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 July 2024 18:39 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/16 "2024-07-27T18:39:58Z")

</div>

> [@pgas37](#):
>
> When I press the virtual switch in domoticz it gives no results in the debug nodes.

Sorry, I have no idea what a virtual switch in domoticz is. If there is no output in the debug node connected to the domoticz out then there is not much I can do.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 July 2024 18:44 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/17 "2024-07-27T18:44:31Z")

</div>

If you mean there is nothing in debug node 412 then your filter switch must be wrong.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 July 2024 20:30 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/18 "2024-07-27T20:30:31Z")

</div>

I think perhaps you might find it useful to read this, and watch the videos. [Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages). Make sure you understand the concepts described there.

---

<div class="post-metadata">

**Author:** ![pgas37](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pgas37/32/76217_2.png) [@pgas37](https://discourse.nodered.org/u/pgas37)\
**Post date:** [29 July 2024 10:01 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/19 "2024-07-29T10:01:45Z")

</div>

After some experimenting, I have made some progress and get output in the debug nodes.  
the **flow** is the same, i addes some debufs and looks like this:

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/13165a4f3a416e73b2573aad496a04dd1715e0c5.png)  
**the config of the filter switch:**

![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e083a19bb7ce1ec752a53f4d0ad5d4266bd34d56.png)

**the config of the function node** :

 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/1/31cd95c3448c374bf86b1d88101d5fd360a2752f.png)

The configuration of the debug nodes are in the name.

The output of "domoticz/out looks like this (debug 412 and 416):

```auto
29-7-2024 11:36:38node: msg.payload.idx (complete msg object debug 412)domoticz/out : msg.payload.idx : number
10903
29-7-2024 11:36:38node: msg.payload ( debug 416)device : msg.payload : Object
object
value: 1
29-7-2024 11:36:39node: Zigbee Switch 1
msg : string[13]
"Invalid topic"

```

The output after pushing the inject node looks like this(debug 413 and 414):

```auto
type 9-7-2024 11:35:39node: msg.payload (debug 413)device : msg.payload : Object
object
deviceId: "ce0aef95-04ac-4b7b-8583-90099194af59"
deviceType: "switch"
name: "Zigbee Switch 1"
value: 0
timestamp: "2024-07-29T09:35:39.972Z"
29-7-2024 11:35:39node: complete msg object debug 414device : msg : Object
object
topic: "device"
payload: object
_msgid: "5876a93243ebb3cb"or paste code here

```

See debug 413; the value of the Zigbee Switch 1 is 0 (svalue =off) and can change to 1(svalue =On).  
When i push the switchbutton in domoticz the value of the button in smartthings is shown (0 or 1).  
What I want is when I switch the switch button in domoticz, for example from On to Off, the switch button in smartthings also switches from On to Off.

Any help will be appreciated.  
thanks

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [29 July 2024 10:23 UTC](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702/20 "2024-07-29T10:23:14Z")

</div>

Does the Inject node do what you want? If it does then compare the output of the Inject node with the output of the function node. If they are the same then it will work.

[Next page](https://discourse.nodered.org/t/smarttings-failure-invalid-topic/89702.md?page=2)
