How to send data from my LAN connected device to HubV2?

Hey everyone!

I’m trying to setup a situation where my LAN connected device (Raspberry Pi) can send notifications to SmartThings HubV2 when it detects events (Motion, Network Traffic, etc).

But I’m having trouble figuring out where to send messages to FROM my Raspberry Pi (preferable via HTTP). The best documentation I could find was here:

But that just tells me how to subscribe to upnp events. Any ideas on how to subscribe to HTTP callbacks?


Okay, so how does the Hub know which devicetype to send that data to? I’m trying what you have, I’m getting a 202 ACCEPTED from the Hub, but nothing is making it to my parse function.

Okay, so I found these posts:

And I got to a pre-release version of the docs, I think:

But I still can’t figure it out, I think I’m missing the subscribe portion, but the docs only talk about upnp.


Hey @stjohn

Check this thread out where I create an endpoint for my camera system:

Thanks, @Kristopher! In this case, it looks like you’re doing an OAuth web call. I was hoping to keep my calls inside my LAN. I’ll save this for a last resort.

As far as I know, its not possible to send data over the LAN to the hub and have it received via a device/SmartApp except via UPnP. This is the reason that the current version of ObyThing Music only communicates hub -> Mac and not the other way, and the new version uses OAuth to communicate back to the hub.

Here is a piece of code I’m trying to play with to experiment:

To run it, just do:

npm install
npm start

It default uses port 8000, you can change it at the last line of the javascript.

Wow, this really needs to be in the documentation. Thank you so much for your help with this!

Is there anything I can do to support multiple device types for the same raspberry pi?

This isn’t really a callback, its just a response to an outbound lan request. The hub still needs to open a port outbound and wait for a response.

The hub ip and port (or mac) will not remain open for any responses (wish it would) for longer then 10 seconds as well.

Hopefully these things will change one day.

1 Like

I understand what the code is doing, it is opening up the port, but if it stays open then that is interesting.

If you set the DNI to your computer’s mac (or IP:PORT) and hit this url and send something, I wonder if it will work without the refresh?

I’ll check when I get home… This could be very useful if it stays open.

Confirmed, this does work.

1 Like

Okay, so this works perfectly. But I still have the problem that I want to support multiple devices for the same Raspberry Pi. How can I do that and still send push events to it?

What if I have four motion sensors hooked up to the Pi and I want to send four different motion events?

@stjohn I have plenty examples of multiple similar devices attached to one Arduino that you can use as a starting point. Check out my Multiplexer SmartApps and virtual device types in my github repository. Lots of discussions here as well which you will find helpful.

My hope is to add LAN connected support to my ST_Anything project, so you’d have the option of either the ThingShield or an Ethernet Shield to communicate with the ST Hub.

Longer term, port ST_Anything to Raspberry Pi and possibly Windows.


Just to clarify, the MAC address entered into the “Device Network Id” field must be uppercase without colons (i.e. 4D3005HB6334, not 4d:30:05:hb:63:34). The parse method seems to not be called otherwise.

1 Like

I can get the esp8266 to post to smartthings when I press polling but no future updates without pressing polling again. I am just monitoring ST logs and not worried about the device value. I have the MAC address in the Device Network Id with out colons.

Device Type - Only worried about logging output

Arduino esp8266 sketch

Did you solve the problem of multiple devices? I found that the device network id needs to be unique so if i wanted to support 4 different smart thing devices from the same machine (windows in my case) then i can only add one to device on that mac address.

I haven’t solved it yet, sadly. I’ve moved on for a bit and I’ll probably come back in a month or so.

Is this still working for everyone? I’m seeing very odd behavior with the “mac” field received/reported by my hub. I’ve been following along on some of these threads as I’m trying to create a custom LAN device. Ultimately, I’ll have a Raspberry Pi sending events to my hub, but for now I’m just trying to get things working on a Linux VM.

I’ve started with Charles_Schwer’s examples, and I’ve even gotten them working a few times. The problem is, it’s very inconsistent. When testing, I’m looking for the debug statements in parse() to show up. However, I find that more often than not, I see nothing for the device appear under ‘Live Logging’. Instead, I’ve found that these events are appearing in the “Events List” for the hub. Here, I’m able to see the event content, and I’m finding that the value in the “mac” field is not matching the MAC address of my Linux VM, but rather random devices on my network. Rebooting the hub sometimes causes things to work again, though they’ll eventually go awry again. Usually though, a reboot just causes a different invalid MAC address to appear here.

Here’s what’s really strange - if I change the network ID for the device to match this incorrect MAC address as reported by ST, the events are parsed correctly again and I see the debug messages appear in the “Live Logging.” I’ve tried sending these events from other VMs and hosts on my network, but I’m pretty consistently getting the same results.

I’m at a loss here. I’ve got a support ticket opened and I’m waiting for a response from ST, but I’m curious if anyone else has seen some odd behavior. It’s possible I’m doing something wrong, but I’ve checked things over thoroughly and I’m fairly confident in my work. I’m new to groovy and ST programming, but I’m a career software engineer, so this certainly isn’t uncharted territory for me.

@stjohn and others… just ran across this thread and wanted to share a nodejs service I wrote a while back to solve this exact problem. Basically it acts as a proxy and allows you to post data back to the ST Hub as you see fit; it’s built in such a way that all you have to do is write a connector (several available in git) to do what you want and communicate asynchronously and bi-directionally with the ST Hub. You need to write a SmartApp to handle all the inbound messages and route to the correct device, but the benefit is that you don’t need to deal with the pesky MAC address matching that takes place at the device level…

1 Like

Hi all, I’m just about to embark on a project to integrate my first Raspberry Pi Actuator/Sensor with SmartThings. Ideally I’d like my single Raspberry Pi device to be represented as several devices in SmartThings.

I’ve had a look at the official SmartThings documentation for LAN-connected devices (which seems much improved since I last looked at it):

Please can someone confirm (or correct) my understanding that using the official SmartThings method (as documented in the link above) limits you to a ‘one MAC address <-> one ST device instance’ relationship? Is this still the case?

If you want to have a LAN connected device represented as several device instances in SmartThings, then you can use @redloro’s smartthings-nodeproxy solution (or similar). The key thing in this implementation is the subscription to all location events (!):

subscribe(location, null, lanResponseHandler, [filterEvents:false])

This is great, but can anyone comment whether this is more of a hack or is it officially supported by SmartThings? I’m just worried that if it’s not an officially supported method then it runs a higher risk of being broken by an update in the future. Also, could this not result in performance issues?

[Update: obviously, the other solution is to use the Cloud-connected method and engineer a REST Endpoint that forwards the messages to the right device instances. But I’d rather keep all traffic to the LAN if possible]

[Update: @Aaron, can you offer any official guidance?]