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).
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.
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.
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.
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.
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.
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…
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.
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 (!):
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?]