SmartThings & Nodered - Webhook not sending data to Nodered

Hello, I am new to the community and need some help. Let me give you a little background.

I am setting up a Raspberry Pi 4B to handle home automation. Most of my wifi devices were previously controlled via Tuya’s SmartLife app (just scheduled events, not any automations). But recently, all devices were imported into the SmartThings app.

I have installed Docker and used IOTstack to set up a stack with Portainer, Mosquitto, Nodered, Grafana, and Influxdb. Everything is installed and running properly.

Under Nodered, I noticed the node-red-contrib-smartthings node and installed it. By setting up a token from my SmartThings account, I could see all of my devices in Nodered. Immediately, I could add an OnOff node in Nodered and direct output to a debug node. When I deployed flow, I saw the debug message stating the current switch status (on/off). I thought I was on my way, but I have hit a wall and am stuck here.

I do not receive any updates when the status changes. I only see the debug statements immediately when I deploy the flow. So there isn’t actually communication between SmartThings and Nodered.

Upon researching, I see that I need a webhook app running to send this information to Nodered. I followed the instructions on this site:
node-red-contrib-smartthings

Now the Webhook app is saved, published, and installed. I have set it up to run as local network and used https local ip address /smartthings/webhook (sorry for strange format, got error I couldn’t post so I changed it) as the webhook URL. Devices were added and all modes were selected. I have the SmartApp added to my iphone SmartThings app (under Automations page).

On the SmartThings page, I log into my account and go to the Live Logging page. Every time I switch a light on/off, it shows up in the log (/smartthings/webhook, Local POST fallback).

However, that information is not being send to Nodered. Nodered logs do not show any information being received when there is a status change.

I followed this page which seems to describe exactly my problem:
Debug SmartApp

I could not figure out what it meant in step 5. Set the location to debug. I only have one location option (MyHome). However, I did follow the simulation instructions. I receive the same log information that I receive in the Live Logging page. I do not receive any error messages. I believe the Webhook is receiving the information. It either isn’t passing it on to Nodered correctly, or Nodered isn’t receiving it.

Any suggestions what I try next to fix this? Or where to look to help me figure out what the problem is? Thanks!!!

Hi @TexasMom, see if the tutorial in the link below can help you, translate the text in Google Translate from Portuguese to English. Excellent tutorial by master @niquini

1 Like

Thanks @reinaldots

The article did give good instructions on how to set up node red and create and install a ST SmartApp. However, I have already followed these steps.

My issue is that within Live Logging on ST, I can see the debug log statements whenever a device state changes. This is in the Local POST fallback code. Everything seems to be running fine from ST side.

In Nodered, I have a ST OnOff node set to a specific switch. The output is sent to a debug node. When I deploy the flow, I receive the debug message for the device and the payload message accurately states whether it is on or off. So there is correct connection between NodeRed and ST.

However, the webhook does not seem to POST the state changes as they happen, or NodeRed is not GET them. Since there is some basic connectivity, I am not sure where to go in debugging why the state changes are not being received when I toggle the switch on/off. Again, the debug messages display in ST live logging, but nothing happens in NodeRed.

I really appreciate any help!!

Ok, make sure that in SmartApp NodeRed WebHook you checked the Local Network option and that you selected the devices you want to get the status and control in the nodes of node-red-contrib-smartthings in Node-RED.

Have you seen this?

Yes, I do have the local network call turned on.

I have not seen that. I am going to try it out tonight. I will let you know. Thank you!!

Well, I gave it a good try. I am completely lost. The ST node in NodeRed with the webhook was a very straight forward, simple to understand concept. But this new node seems to be more for developers releasing new devices or writing apps for the public. I am not trying to do any of that.

Maybe it is best if I back up and just say what I would like to do. Maybe I can get some recommendations on the proper way I should approach this.

I have several direct connected devices on my local network. Most of them are switches, so that is where I am starting. I would like to know when a device changes state (on/off). In NodeRed, I will have flows to then perform various tasks when the device is changed.

To begin with, I would just like to write to the debug window in NodeRed when the state changes. Using the ST NodeRed node, I only received debug messages when I deployed the flow. The webhook was not sending change of state messages. On ST IDE website, I could go to Live Logging and see that the webhook SmartApp was generating all the debug statements every time the switch changed states. But the communication from webhook and NodeRed isn’t working properly.

Now I can keep working on debugging that to get it working, but I am concerned with the introduction of Samsung Automation Studio, that the webhook functionality may be disabled thus explaining my problem. Is there a different way in NodeRed to access local devices directly connected to my WIFI? I do not want to set up an external website to do this. I would like everything to run local/within my network.

Appreciate the help with this pretty basic question. I just neeed help getting pointed in the right direction.

I was able to finally get things working, but not exactly how I thought. I am able in NodeRed to use injector nodes to turn my smart plug light(s) on/off. However, I was surprised to find out that the state of each device is kept in a local state table. When I use a mobile app to change the value of a switch (on/off), NodeRed does not receive any notification of the change. I thought webhook would detect the state change of the device and send a message to NodeRed nodes. This isn’t working. Have I done something wrong, or is this how webhook is supposed to work?

I just noticed this in your first post. Did you really mean https? The link between ST and Node-RED seems to be via a legacy Groovy SmartApp so it would have to be http surely?