Node Red with Smarthings using Samsung Automation Studio

Yea I saw that. On top of that the Node Red built Docker container is still using Node.js 10.x as well. Like you said as well 14.x is supported. Between all of those discrepancies i figured it wouldn't hurt to go to 14 which is the newest LTS version out right now.

The problem is that if you try to update the Samsung Automation Studio to 1.1.0 now which was released a few days ago you need Node.js 14.16. That was at least explained in response to my opened issue on their Github. So far everything is working on the VM i built with the combination listed above It also didn't take long at all to deploy it in that manor either. Maybe a total of 20 min to get it up including os isntall working following the directions on line. I suspect it would even be faster on a raspberry pi(thogh maybe not with the difference in CPU).

For what itโ€™s worth, and I may be duplicating effort, I created a quick Arlo Camera device to use with the SmartThings and Hubitat nodes:

Arlo Camera Device

and a 6 camera sample flow to support (using polling):
SmartThings - Hubitat Arlo Flow

I have the clip capture working from end to end, but havenโ€™t found a way to pull it back into HE yet. (Pulling back the Clip object from ST, but it is worthless).

1 Like

I have updated my first post to put details about how to get this fully working and setup. There is still a little bit more to add about Nginx proxy Manager, but i have it all figured out.

1 Like

I have added directions for Nginx configuration.

I am trying to use Node red to sync my Samsung VRF AC units with virtual devices on the Hubitat side.
I would like to be able to control the AC units using their physical wall termostats but also through Hubitat virtual devices on my dashboards and automations. The devices should synce immidiatly.
As the virtual thrmostat in HE does not support the Switch capability that samsung supports I will end up with probably virtual switch and virtual thermostat for each physical wall thermostat.
I was able to create a flow that track changes in the virtual switch on the HE side and change the switch status on the ST side. one down.
Now, trying to create a flow to track changes to the ST thermostst switch and change the HE virtual switch accordingly. PROBLEM.
I read that using the Event node on ST requires a lot of setup that I would like to avoid if possible.
I can probably create a flow to check the device status on the ST side every couple of seconds and use the Command node to triger the change in the HE side but it seems like a lot of trafic.
Am I missing somethig? Can you suggest a better logic?
Thanks,

You pretty much have it spot on. There are two ways to get updates from Smartthings with node red and SAS.

  1. Polling
  2. Event based automatoins

Polling is by far easier since all you need to do is get your token and just setup the flow with the token in the "My Device" Node. Once you do that you just setup Node red to do what you want with the updates for the device. You should be able to setup one flow for all of the potential status updates needed.

You can create "Event" based automations with Node Red as well. I know the write up I did above seems involved, but most of it is one time setup. Though it seems complicated it really doesn't take long to setup on a raspberry pi if you have one. You will spend more time waiting on the pie to download and install the apps then anything else.

Endpoint Event automatoins are really needed when you want the fastest updates possible. I think of this like when a switch is changed or when motion is detected. Just a few seconds in that case can mean allot. I use endpoints automations with my arlo cameras for motion detection as well as the doorbell for immediate notifications. Most other items I use polling.

Samsung Automation Studio makes setting up a automation super simple. Basically the whole app is handled by 3 nodes. You just need the device profile, automation, and the event node for SAS to create the smartapp for you.

One draw back to keep in mind with SAS for Endpoints is that each endpoint automation requires it's own flow. So just be aware of that.

The summary of what is needed for Endpoints automation is actually quite simple. 1. You need a server to accept the connection. ie node red. 2. You need the connection to be secure between Smartthings and your local server host.

If you have a place to run Node-Red you already have half of that done. Securing it can be the hard part and is the big part of what posted before.

Something else I would add is some of that extra work would also have other benefits. Having NGINX proxy Manager woking means potentially you have a good way to secure anything internal you want to externalize. I was able to externalize several apps other then node red with improved security once Nginx was setup. Even older apps that have lesser security can be updated with this to provide improved robust security.

I have a Windows Home Server from 2011 that was starting to age and have security issues because it lacks newer ciphers. Nginx brought it up to current tech with TLS1.3. That doesn't help with .net vulnerabilities, but does negate the limitations of the older os and it's cipher limitations.

Setting up DuckDNS or a similar service means you can now always access your home via host name vs IP and it will update somewhat regularly if your IP changes from the ISP.

Side note... Has anyone else looked at the communication back to Samsung when you use this node-red integration? It is staggering in terms of the # of sessions created/destroyed - tens of thousands/day on my system anyway.

Not saying it is a problem, necessarily, just an interesting observation.

Just found out this post. Do you think this might be a possible solution?

That doesn't exactly lean fully on the new Smartthings API. It still has you loading groovy code in the IDE which Samaung has said is marked for shutdown. That is why i didn't give it any further investigation when i saw it a while back. Ontop of that I also dont think many folks were very successful with it.

2 Likes

I think depending on the number of flows and and the polling interval that wouldn't suprise me. If you do the math even if you have one flow triggering every 2 seconds that would end up being 43k connections.

Running (more like slowly crowling :crazy_face:) through this process you described.
What do you mean by endpoint folder. what shoud i put in the address?

The point of that step is to setup the routing through NGNIX to allow a URL that Smartthings will call to be routed to your local Node red install. So in that graphic the location value in the graphic is the endpoint url that Nginx will listen for and route to your internal webserver or in this case node red instance. The ForwardHostname/ip field is going to need the ip or hostname of your device/PI followed by the Endponts you are configured in node red when setting up the Automatoin Node.

In the Example i do have the location starting with /nodered/ which is simply used to create a application folder to help organize the endpoints for node red and SAS.

You will need to use the Host name you configured with duckDNS and this location as the full URL when setting up the smartapp in the Samsung developer workspace.

Maybe I need to create a Youtube video or something to help with this.

2 Likes

I came back to this after I realized the potential of Node Red while implementing it to control other devices in my house.
Still, and as much as I tried I could not figure out the proxy and the ST side of things. I have no network knowledge and as I never used ST before I am not fluent in that side too.
I do have some Samsung devices running a hubless smartthings and as I was not able to utilize the Event node I am forced to poll the devices every couple of seconds and it does not make sence.
Did you have a chance to work on this tutorial video you mentioned?

I have not. Honestly i have never tried to do it and as such and a little stumped on where to start to work on getting setup to do it.

Any idea where you are stuck? Maybe i can provide figure it out this way.

What is working and what isn't?

Been working on it again last night but not yet finished. I will test it again today and update on where I am getting stuck. Thanks

OK. I was finally able to fugure it out and make it work after reading @mavrrick58 post above over and over again and with some luck to cover for my lask of ST and Network knowledge.
I now have the connection through the Event node and I can see changes on my AC unit (connected to hubless ST). Every time I turn the AC unit off or on (switch capability) I get a message in the Event node in Node Red that I can capture in a virtual switch connected to HE.
This is great......for a start.
Still, the AC unit has a list of about 20 capabilities that I would like to track changes in. For example the AC unit has a capability of AC Mode (Auto, Cool, Dry and Off).
So, I added these capabilities to my flow in Node Red and created an Event node for them to track changes. For some reason I do not understand, changes to the AC Mode does not report and Event in Node Red. I can see thses attributes if I create a Status node for the same device but the Event node does not report changes.
Any idea?
This is how my flow looks like:

To make it more interesting, I added a debug node to the Automation node and now I see that every change in each of the capabilities attributes initiate a message from automation with the changes data in them but this message does not go through to the Event node. Am I missing something?

When setting up the app in Smartthings did you select the thermostat for each type of event. You would need to go through it again if you added new event nodes.

Each device profile links should be associated with the Event profile node you setup. That event profile node tells Smartthings when you setup the generated smartapp what device attribute to allow you to select. So now you should have 4 different selections on the Smartapp setup screen in Smartthings. Once they are selected for the given attribute Smartthings will subscribe to that device for those events and pass them to Node-Red.

With that said it does appear everything will be passed when the event is triggered that is subscribed to. That explains why you see the other attributes even when just the one is triggered.

You may want to check the Virtual Thermostat device as it may be a better fit to replicate your A/C's states. You can always work on building a virtual switch as well, but that can be a interesting endeavour, and possibly cause trouble as i have experienced some strange things with my APC Backup virtual device.

If you have already confirmed that you have all of the event nodes setup in the smartapp then you may want to check and make sure you have the latest version of Node Red and the Samsung Automation Studio loaded. I know early on I had issues with setting up automations with many event nodes. In recent times after updates to both of them though I have tested it with a good amount of success with more then one event node. I am testing a new flow with 6 device profiles with 3 devices and it appears to work in testing.

The last things to remember about events is that Samsung does have rate limits in place that apply at the Smartapp level. If the device is busy enough you could hit them. Also with your thermostat having 20 attributes that would reach the limit of event subscriptions for a single Smartapp.

The rate limit into for Smartthings is Smartthings API Doc

A thermostat is a device I would likely just poll every 5 seconds (maybe even longer). It probably isn't as critical to get it's changes into Hubitat as quickly as possible. Remember when you send commands to the device they will still happen instantly. With that said nothing wrong with wanting it faster.

@amithalp if you want to DM me the parts that you struggled with I will see if i can edit the directions to be easier to follow. I am a IT guy so it is in some cases easy for me to spew this stuff out. I know it is allot of steps, but i walked through it myself as i was writing it up. I always tell team new team members take my notes mark it up and lets make the documentation better. So please feel free to let me know what you feel I can do to make the directions clearer.