Smartthings integration to domoticz Topic is solved

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Smartthings integration to domoticz

Post by tontze »

Hi !

Ive seen many posts where domoticz items are integrated to smartthings, but since smartthings does not have pc frontend, im asking has anyone gotten smartthings items to show up on domoticz ?

I believe this is doable on node-red, but how, is there a tutorial somewhere ?
Last edited by tontze on Sunday 21 February 2021 8:24, edited 1 time in total.
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Smartthings integration to domoticz

Post by FireWizard »

@tontze,

Hi
I believe this is doable on node-red, but how, is there a tutorial somewhere ?
I suggest you read the tutorials on https://nodered.org/docs/tutorials/

This will help you.

You can install the node for "Smartthings "via the Palette in Node Red.
See: https://flows.nodered.org/node/node-red ... martthings

Regards
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Smartthings integration to domoticz

Post by tontze »

FireWizard wrote: Saturday 06 February 2021 21:36 @tontze,

Hi
I believe this is doable on node-red, but how, is there a tutorial somewhere ?
I suggest you read the tutorials on https://nodered.org/docs/tutorials/

This will help you.

You can install the node for "Smartthings "via the Palette in Node Red.
See: https://flows.nodered.org/node/node-red ... martthings

Regards
Thanks, i can now see my smartthings items in nodered, but i just cannot figure where to go from there .. I have tried simply read state of the item in nodered, but .. i dont get it how to do it :/ Can someone show an example ?
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Smartthings integration to domoticz

Post by FireWizard »

Hi, @tontze

Can you show a screenshot of what you see in Node Red? Have you connected "Debug" nodes to your Smartthings Nodes?

Regards
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Smartthings integration to domoticz

Post by tontze »

FireWizard wrote: Saturday 20 February 2021 16:31 Hi, @tontze

Can you show a screenshot of what you see in Node Red? Have you connected "Debug" nodes to your Smartthings Nodes?

Regards
I did now, and yes, i see 'value' now :D Thanx !

I also tried to add inject node to control light from nodered. but couldnt figure that out :/ Heres how i tried it :
Sieppaa.PNG
Sieppaa.PNG (31.63 KiB) Viewed 3938 times
I tried to simulate this example (couldnt find where to put it in this form):
Sieppaa2.PNG
Sieppaa2.PNG (16.73 KiB) Viewed 3936 times
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Smartthings integration to domoticz

Post by FireWizard »

Hello, @tontze

I see, that you have connected an "Inject" node, called "Switch", with msg.topic as "Kitchen Lights" and a numerical payload "1".

Is this what is expected to send to that payload?

What do I see. if you "fire" the Inject node.

The next screenshot, does not show the expected result. It looks like a part of a manual.
Where can I find that?

Regards
Last edited by FireWizard on Saturday 20 February 2021 18:54, edited 1 time in total.
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Smartthings integration to domoticz

Post by tontze »

FireWizard wrote: Saturday 20 February 2021 18:01 Hello, @tontze

I see, that you have connected an "Inject" node, called "Switch", with msg.topic as "Kitchen Lights" and a numerical payload "1".

Is this what is expected to send to that payload?

What do I see. if you "fire" the Inject node.

The next screenshot, does not show the expected result. I look like a part of a manual.
Where can I find that?

Regards
Absolutely nothing happends if i press inject node :/

Yes that is part of flow install manual, but theres not anything more there.

https://flows.nodered.org/node/node-red ... martthings
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Smartthings integration to domoticz

Post by FireWizard »

hello @tontze

I do not own any of these dvoces and I do not have a Smartthings account.

But I think, that you can probably follow the procedure as described at:

https://adam-phillips.dev/blog/2020-04- ... artthings/

Otherwise the Smartthings forum may help. https://community.smartthings.com/t/nod ... ings/27063

If we have the data properly formatted in Node Red, we can make the connection to Domoticz
Up to now, this isn't a Domoticz issue.

Regards
Last edited by FireWizard on Thursday 04 March 2021 9:15, edited 1 time in total.
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Smartthings integration to domoticz

Post by tontze »

Thank you for your help, it is true, this is not yet domoticz issue, but it will become one after i learn some more :)
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Smartthings integration to domoticz

Post by tontze »

Ok, managed to get it working !

Below is an example, im sure it can be done better, but this is how i got it working :)

Now to the domoticz part, how do i get domoticz in/out to node-red ?
Smartthings manipulate switch.PNG
Smartthings manipulate switch.PNG (36.99 KiB) Viewed 3905 times
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Smartthings integration to domoticz

Post by FireWizard »

Hello @tontze,
Ok, managed to get it working !

Below is an example, im sure it can be done better, but this is how i got it working
Yes probably it could have been done in a different way. Better? Who decides, what is better?

But some hints.

1. You declare a variable msg. This variable is a standard in Node Red and not necessary to declare.
2. A topic (in your case "switch" is sometimes necessary, but I do not see, where it is used here.
I do not know what the Smartthings node, called "Kitchen Lights" expects.
3. Probably you send a timestamp with the two "Inject" nodes.
You can insert directly the payload in the "Inject" nodes and also the topic.
Then you don't need those two "Function" nodes.
Now to the domoticz part, how do i get domoticz in/out to node-red ?
Domoticz Out is not a problem.

Step 1: Configure a virtual Switch in Domoticz. Note down the IDX number

Step 2: Install in Domoticz hardware: MQTT Client Gateway with LAN interface, if not done already.
I assume you have Mosquitto running?

Insert the following flow and replace in the Switch node, called Filter Switch the current IDX (13) with yours.

Code: Select all

[{"id":"f1bbcae6.fbeeb","type":"mqtt in","z":"68896a5a.1b56e4","name":"","topic":"domoticz/out","qos":"0","datatype":"json","broker":"f9f13036.e28b58","x":110,"y":820,"wires":[["6805674d.4e1d48"]]},{"id":"d40eb5a7.72987","type":"debug","z":"68896a5a.1b56e4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":820,"wires":[]},{"id":"6805674d.4e1d48","type":"switch","z":"68896a5a.1b56e4","name":"Filter Switch","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"13","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":310,"y":820,"wires":[["be2d15e0.7d88a"]]},{"id":"be2d15e0.7d88a","type":"function","z":"68896a5a.1b56e4","name":"","func":"msg.topic = \"Switch\";\nmsg.payload = msg.payload.nvalue;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":820,"wires":[["d40eb5a7.72987"]]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Replace the Debug node with the Smartthings node.

Now it should be possible to operate your "Kitchen Lights" FROM Domoticz with the virtual switch.

To send data TO Domoticz, I need to know the contents of your Debug node.
Can you publish that?

Regards
User avatar
pgielen
Posts: 90
Joined: Monday 18 February 2019 14:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Boxmeer
Contact:

Re: Smartthings integration to domoticz

Post by pgielen »

tontze wrote: Saturday 06 February 2021 13:44 I believe this is doable on node-red, but how, is there a tutorial somewhere ?
I just posted a blog post about my own experiences with the Aeotec Smart Home Hub (Works with SmartThings) and step by step instructions to get it working (in Dutch): https://bit.ly/smartthings-domoticz.
https://robothuis.nl, RPi4B, RFXCOM XL, Aeotec Z-Stick, ESP Easy, Weatherstation, several switches and sensors, Ikea Trädfri, Philips Hue, Foscam, Reolink, Lyric T6, Ring
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Smartthings integration to domoticz

Post by waaren »

pgielen wrote: Thursday 04 March 2021 9:09 I just posted a blog post about my own experiences with the Aeotec Smart Home Hub (Works with SmartThings) and step by step instructions to get it working (in Dutch): https://bit.ly/smartthings-domoticz.
👍 Very nice article. Thx.
Would you be OK if someone translates your blog and add the translated article to the domoticz wiki?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Smartthings integration to domoticz

Post by tontze »

Thnx for the golden answers ! These helps me a LOT ! :!:
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Smartthings integration to domoticz

Post by tontze »

FireWizard wrote: Sunday 21 February 2021 23:13 Hello @tontze,
Ok, managed to get it working !

Below is an example, im sure it can be done better, but this is how i got it working
Yes probably it could have been done in a different way. Better? Who decides, what is better?

But some hints.

1. You declare a variable msg. This variable is a standard in Node Red and not necessary to declare.
2. A topic (in your case "switch" is sometimes necessary, but I do not see, where it is used here.
I do not know what the Smartthings node, called "Kitchen Lights" expects.
3. Probably you send a timestamp with the two "Inject" nodes.
You can insert directly the payload in the "Inject" nodes and also the topic.
Then you don't need those two "Function" nodes.
Now to the domoticz part, how do i get domoticz in/out to node-red ?
Domoticz Out is not a problem.

Step 1: Configure a virtual Switch in Domoticz. Note down the IDX number

Step 2: Install in Domoticz hardware: MQTT Client Gateway with LAN interface, if not done already.
I assume you have Mosquitto running?

Insert the following flow and replace in the Switch node, called Filter Switch the current IDX (13) with yours.

Code: Select all

[{"id":"f1bbcae6.fbeeb","type":"mqtt in","z":"68896a5a.1b56e4","name":"","topic":"domoticz/out","qos":"0","datatype":"json","broker":"f9f13036.e28b58","x":110,"y":820,"wires":[["6805674d.4e1d48"]]},{"id":"d40eb5a7.72987","type":"debug","z":"68896a5a.1b56e4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":820,"wires":[]},{"id":"6805674d.4e1d48","type":"switch","z":"68896a5a.1b56e4","name":"Filter Switch","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"13","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":310,"y":820,"wires":[["be2d15e0.7d88a"]]},{"id":"be2d15e0.7d88a","type":"function","z":"68896a5a.1b56e4","name":"","func":"msg.topic = \"Switch\";\nmsg.payload = msg.payload.nvalue;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":820,"wires":[["d40eb5a7.72987"]]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Replace the Debug node with the Smartthings node.

Now it should be possible to operate your "Kitchen Lights" FROM Domoticz with the virtual switch.

To send data TO Domoticz, I need to know the contents of your Debug node.
Can you publish that?

Regards
Thnx, i can see in debug node that virtual switch is changing in node-red between 0 and 1, this is what i came up with (does not switch smartthings light tho):
Sieppaa2.PNG
Sieppaa2.PNG (17.14 KiB) Viewed 3808 times
Sieppaa.PNG
Sieppaa.PNG (20.77 KiB) Viewed 3808 times
Ofcourse i would like this to be working other way around too, switching in smartthings, switches state in domoticz :)
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Smartthings integration to domoticz

Post by FireWizard »

Hello @ tontze

You wrote:
Thnx, i can see in debug node that virtual switch is changing in node-red between 0 and 1, this is what i came up with (does not switch smartthings light tho):
I suggest that we make this first.

Can you publish your flow?
Ofcourse i would like this to be working other way around too, switching in smartthings, switches state in domoticz
This is very well possible but I suggest we do this afterwards, when the other way is working.

Regards
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Smartthings integration to domoticz

Post by tontze »

FireWizard wrote: Sunday 14 March 2021 22:46 Hello @ tontze

You wrote:
Thnx, i can see in debug node that virtual switch is changing in node-red between 0 and 1, this is what i came up with (does not switch smartthings light tho):
I suggest that we make this first.

Can you publish your flow?
Ofcourse i would like this to be working other way around too, switching in smartthings, switches state in domoticz
This is very well possible but I suggest we do this afterwards, when the other way is working.

Regards
I really appreciate you helping me FireWizard, i really do :)

By publishing, do you mean this :

Code: Select all

[{"id":"f1bbcae6.fbeeb","type":"mqtt in","z":"e1366dff.7c47f8","name":"","topic":"domoticz/out","qos":"0","datatype":"json","broker":"f9f13036.e28b58","x":110,"y":560,"wires":[["6805674d.4e1d48"]]},{"id":"6805674d.4e1d48","type":"switch","z":"e1366dff.7c47f8","name":"Filter Switch","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"11","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":310,"y":560,"wires":[["be2d15e0.7d88a"]]},{"id":"be2d15e0.7d88a","type":"function","z":"e1366dff.7c47f8","name":"","func":"msg.topic = \"switch\";\nmsg.payload = msg.payload.nvalue;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":540,"wires":[["c2df7e0f.2b59e8","7ee580f7.e4755"]]},{"id":"c2df7e0f.2b59e8","type":"smartthings-node-onoff","z":"e1366dff.7c47f8","conf":"666c7bf2.c25414","name":"Kitchen Lights","device":"e162c5c6-80d2-46e1-aaef-741a39f934fe","x":700,"y":500,"wires":[["5ad15b3c.79e194"]]},{"id":"5ad15b3c.79e194","type":"debug","z":"e1366dff.7c47f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":910,"y":500,"wires":[]},{"id":"7ee580f7.e4755","type":"debug","z":"e1366dff.7c47f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":580,"wires":[]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"666c7bf2.c25414","type":"smartthings-config","name":"ST","token":"xxx"}]
This is what i use between nodered and smartthings : https://flows.nodered.org/node/node-red ... martthings

End of that page it says :

"For example, to turn on a switch you can send a message to its device node:

Code: Select all

{
    topic: "switch",
    payload: {
        value: 1
    }
}
This will turn on the device using Smartthings API and send the current status to the output."

So i believe we just need to get output formatted and forwarded correctly to make it work ?)
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Smartthings integration to domoticz

Post by FireWizard »

Hello @tontze

I have loaded the Smartthings nodes.

I found the msg.topic quite confusing.
So, as I'm not sure either msg.topic should be set to "switch" or msg.paylaod.topic should be set to "switch" or or both.
I configured them both, just to be sure.

Can you do the following:

1, Create in Hardware a Dummy (Does nothing, use for virtual switches only) device.
2. Press "Create Virtual Sensors" and create a virtual Switch. Give it a name you like and note down its IDX number.

Try the following flow:

Screenshot_Smartthings1.png
Screenshot_Smartthings1.png (19.07 KiB) Viewed 3761 times
3. Configure the MQTT input node to your MQTT settings.
4. Replace in the "Filter Switch" the IDX number to the one you noted previously.
5 Test if you switch the virtual Switch in Domoticz if your light do go On and/or OFF.

Let me know.

See the complete flow below:

Code: Select all

[{"id":"f1bbcae6.fbeeb","type":"mqtt in","z":"4e92e308.9bb32c","name":"","topic":"domoticz/out","qos":"0","datatype":"json","broker":"f9f13036.e28b58","x":210,"y":280,"wires":[["6805674d.4e1d48"]]},{"id":"6805674d.4e1d48","type":"switch","z":"4e92e308.9bb32c","name":"Filter Switch","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"12","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":410,"y":280,"wires":[["a161ac66.49283"]]},{"id":"c2df7e0f.2b59e8","type":"smartthings-node-onoff","z":"4e92e308.9bb32c","conf":"666c7bf2.c25414","name":"Kitchen Lights","device":"e162c5c6-80d2-46e1-aaef-741a39f934fe","x":880,"y":280,"wires":[["5ad15b3c.79e194"]]},{"id":"5ad15b3c.79e194","type":"debug","z":"4e92e308.9bb32c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1090,"y":280,"wires":[]},{"id":"7ee580f7.e4755","type":"debug","z":"4e92e308.9bb32c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":340,"wires":[]},{"id":"a161ac66.49283","type":"function","z":"4e92e308.9bb32c","name":"Function Kitchen Light","func":"msg.topic = \"switch\";\nmsg.payload =\n{\n    topic: \"switch\",\n    payload: {\n        value: msg.payload.nvalue\n    }\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":640,"y":280,"wires":[["c2df7e0f.2b59e8","7ee580f7.e4755"]]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"666c7bf2.c25414","type":"smartthings-config","name":"ST","token":"xxx"}]
Regards
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Smartthings integration to domoticz

Post by tontze »

Nope. your example didnt work, but i figured it out from your example and from my earlier inject node. This is working:

Code: Select all

[{"id":"6b48d27b.84f02c","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"25239b40.b1f3bc","type":"mqtt in","z":"6b48d27b.84f02c","name":"","topic":"domoticz/out","qos":"0","datatype":"json","broker":"f9f13036.e28b58","x":150,"y":180,"wires":[["cc094159.4c585"]]},{"id":"cc094159.4c585","type":"switch","z":"6b48d27b.84f02c","name":"Filter Switch","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"11","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":180,"wires":[["a161ac66.49283"]]},{"id":"c6497977.29095","type":"smartthings-node-onoff","z":"6b48d27b.84f02c","conf":"666c7bf2.c25414","name":"Kitchen Lights","device":"e162c5c6-80d2-46e1-aaef-741a39f934fe","x":820,"y":180,"wires":[["20cab71c.d8dc48"]]},{"id":"20cab71c.d8dc48","type":"debug","z":"6b48d27b.84f02c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1030,"y":180,"wires":[]},{"id":"df6244d0.37a72","type":"debug","z":"6b48d27b.84f02c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":810,"y":240,"wires":[]},{"id":"a161ac66.49283","type":"function","z":"6b48d27b.84f02c","name":"Function Kitchen Light","func":"var msg = {\n    topic: \"switch\",\n    payload: {\n        value: msg.payload.nvalue\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":180,"wires":[["c6497977.29095","df6244d0.37a72"]]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"666c7bf2.c25414","type":"smartthings-config","name":"ST","token":"xxxxxxxxxxxxxxxxxxx"}]
It is working now :D I can switch smartthings switch from domoticz :) Now just need to make it other way around :)
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Smartthings integration to domoticz

Post by FireWizard »

Hello @tontze

You said:
Nope. your example didn't work, but i figured it out from your example and from my earlier inject node. This is working:
I was not sure about the example in the Smartthings documentation.
I already said:
I found the msg.topic quite confusing.
So, as I'm not sure either msg.topic should be set to "switch" or msg.payload.topic should be set to "switch" or or both.
I configured them both, just to be sure.
But perfect, that it is working now.

I have one small remark to your code.
The first line of your code shows:
var msg = {
and if you click in the function node you will see a small yellow triangle with the text: 'msg' is already defined.
It is not necessary to declare the variable msg, as this is already done (by default).

So the contents of the function node should become:

Code: Select all

msg = {
    topic: "switch",
    payload: {
        value: msg.payload.nvalue
    }
}
return msg;
It is working now :D I can switch smartthings switch from domoticz :) Now just need to make it other way around
Can you operate the lamp, connected to the Smartthings node, and see if something is shown in the last "Debug"node.

Or if this is not possible can you test the following flow:

Code: Select all

[{"id":"7c7791de.29521","type":"inject","z":"4e92e308.9bb32c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":280,"wires":[["b994970e.927188"]]},{"id":"b6f73d8f.ef4cc8","type":"smartthings-node-onoff","z":"4e92e308.9bb32c","conf":"666c7bf2.c25414","name":"Kitchen Lights","device":"e162c5c6-80d2-46e1-aaef-741a39f934fe","x":640,"y":280,"wires":[["635ae9af.854d9"]]},{"id":"b994970e.927188","type":"function","z":"4e92e308.9bb32c","name":"Function Kitchen Light","func":"msg = {\n    topic: \"update\",\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":400,"y":280,"wires":[["b6f73d8f.ef4cc8"]]},{"id":"635ae9af.854d9","type":"debug","z":"4e92e308.9bb32c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":280,"wires":[]},{"id":"666c7bf2.c25414","type":"smartthings-config","name":"ST","token":"xxx"}]
I expect you will see, something like:

Screenshot_Smartthings2.png
Screenshot_Smartthings2.png (12.71 KiB) Viewed 3745 times

If this is the case, can you test the following flow:

Connect the output of the Smartthings node to the input of the "Function" node.
And configure the MQTT output node, according to your configuration.

Code: Select all

[{"id":"191ec999.485656","type":"function","z":"4e92e308.9bb32c","name":"","func":"if (msg.payload.value === 1 )\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": 11, \"switchcmd\": \"On\" };\n}\nelse if ( msg.payload.value === 0 )\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": 11, \"switchcmd\": \"Off\" };\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1040,"y":100,"wires":[["d805ccf1.c0753"]]},{"id":"d805ccf1.c0753","type":"mqtt out","z":"4e92e308.9bb32c","name":"","topic":"domoticz/in","qos":"1","retain":"false","broker":"f9f13036.e28b58","x":1230,"y":100,"wires":[]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Awaiting your response,

Regards
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest