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"]
Please help
Thanks
Paul
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://global.discourse-cdn.com/business6/uploads/nodered/original/3X/a/9/a9db0abf04dc437a47cf1ce7b00ac97eb31ce4c1.png)
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.
Paul
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)
Zigbee Switch 1 =
![afbeelding](https://global.discourse-cdn.com/business6/uploads/nodered/original/3X/e/7/e76e41bf2bdb687697e55d805784cb3932b40796.png)
the properties of the injectnode are:
![afbeelding](https://global.discourse-cdn.com/business6/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
In the inject node, can you set msg.topic
to 'update' or 'pull' ? (as per documentation)
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://global.discourse-cdn.com/business6/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. ![:grinning: :grinning:](https://emoji.discourse-cdn.com/twitter/grinning.png?v=12)
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.
any advice?
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:
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
Hi,
Sorry, but i need more detailed help.The documentation is not clear enough for me.
i made the flow;
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://global.discourse-cdn.com/business6/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
Try this:
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.
Oke, sorry for the inconvienance.
From scratch:
the flow
The debugnode name explains the output setting. As requested .
The settings of the Filter Switch
![afbeelding](https://global.discourse-cdn.com/business6/uploads/nodered/original/3X/9/7/97f8385be8006a3cc7212b37c1b6fc4893af0575.png)
The settings of the function node as you suggested
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):
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
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.
I added a debug to the MQTT (domoticz/Out) node.
searched between all the output for the Zigbee Switch 1
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
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.
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.
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.
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.
If you mean there is nothing in debug node 412 then your filter switch must be wrong.
I think perhaps you might find it useful to read this, and watch the videos. Working with messages : Node-RED. Make sure you understand the concepts described there.
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:
the config of the filter switch:
![afbeelding](https://global.discourse-cdn.com/business6/uploads/nodered/original/3X/e/0/e083a19bb7ce1ec752a53f4d0ad5d4266bd34d56.png)
the config of the function node:
The configuration of the debug nodes are in the name.
The output of "domoticz/out looks like this (debug 412 and 416):
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):
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
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.