Wireless Sensor Tags Integration

@tamaracks I updated the Smart App and Device Type today to add a motion capability that mirrors the previous acceleration capability. This allows you to hook up SmartApps to either motion or acceleration where previously only acceleration existed. Hopefully, this will make the PIR sensor useful. I haven’t tested with the PIR device since I don’t have one, but this should work. Let me know if this works for you.

You should be able to just copy the Wireless Tags Connect SmartApp and the Motion DeviceType over the old ones. You shouldn’t need to rerun the Connect SmartApp unless you have changes you need to make to your devices. Motion may show up as active by default in the device, but it’ll change to inactive when you refresh the device.

I didn’t fix the issue you were having from before with the extra device getting created. It’ll take some more time to dig into but at least that workaround is pretty easy.

Thanks for getting to it so quickly! I’ve tried the new code. I’m not totally sure if it’s working or not.

It’s odd. When I first got it updated, the motion tile under the PIR thing was lit. Then it went off. And it hasn’t come back on since (nor has the acceleration tile). And no matter what I do, I can’t get the tile to light up again. I checked WST and the tag is definitely registering movement. And just now, I looked at the activity for the device in ST and it shows that it registers movement there. So I don’t know why the tile isn’t indicating that.


Oh, wait. I just realized one thing that might be important. The unlit tile says “inactive”, whereas my SmartSense motion detectors say “no motion” instead. Or that could just be due to the configuration of your WST device type.

Hmm. Do you have the device in “Motion Mode: accel”? If not, try that. I think that turns on the immediate message from WST to the ST device. Otherwise the device will only update when polling which is not the desired result for your use case.

If that doesn’t work, you were seeing the acceleration tile light up before when testing it out, right? Any thoughts as to what was different with the setup?

Oh, sure, now it lights up.

It might have to do with the difference in how the WST devices reset inactivity. The SmartSense immediately shows motion or no motion, but the WST device takes longer before more motion will trigger an update. I think it’s like a minute?

@tamaracks Ok, if it’s triggering but after a minute, I’d definitely check the Motion mode and make sure it’s set to Accel. By chance is your poll timer set to a minute in the SmartApp?

That’s the motion rearm time setting? If it’s set to nothing, then it defaults to 60, right?

@tamaracks The timer I was meaning was the “Minutes between poll updates of the sensors” in the optional settings under where you select your devices. That just changes how often the ST devices poll the WST system.

The main thing to try though for getting instantaneous motion alerts is changing the “Motion mode” to “Accel” in the device to see if that gives instant updates on motion or acceleration for you.

Just a comment, but for my personal use, I removed the “Presence” and “Switch” capabilities from the motion / water tag device types. I felt that they were cluttering up my view of lights and family presence indicators.

Also, I changed the rounding on the temperature to more accurately reflect degrees F. Just sent that in as a pull request on the github repo.

1 Like

I am fixing to get SmartThings for the first time. I have the Sensor Tags. I have no experience with coding like used earlier in this thread to “marry” the sensor tags with the Smarthings hub. Can someone point me to a fairly plain explanation for how I do this? Thanks

This is one of the situations where it’s going to seem very simple to people who code and very complex to people who don’t.

The essence of it is that if you want to use the custom code available from the link to github up above, you’re going to copy and paste two separate pieces, A device type and a smart app, from github into your cloud account at SmartThings.

After they are pasted in, and you make a couple of other adjustments, you will be able to discover your sensors just like the device types that come built into the SmartThings mobile app.

And then you will be able to use a set up wizard that you also just published to yourself to use the individual sensors.

The process is pretty straightforward, and @swanny , Who is the author of this particular code, has written very good instructions in the comments to the part that you will copy, but it’s still going to seem very technical. Here is the FAQ on how custom code is used was SmartThings. This is a clickable link:

If all of that seems a little complicated but doable, I’m sure people in this thread will be happy to help you as you go through it.

If all of that just seems too techie, there is a completely different way which will also give you the ability to use your wireless sensor tags with SmartThings and doesn’t require any cutting and pasting.

The second method is something you can actually already use with the tags you have before you get smartthings, so it’s worth looking into anyway.

There is a free service called IFTTT. (if this, then that.) companies pay IFTTT to include their products. Both the company that makes the wireless tags and SmartThings do this, so they each have a “channel” at IFTTT.

With the channel, you can set up simple rules, which they call recipes, to make something happen when one of your devices is triggered.

For example, if you have a Hue multicolor bulb you could have A movement alert on your motion sensor tag cause your hue bulb to start blinking orange. If movement, then blink. If this, then that.

This allows you to set up integrations between many different companies devices even when there is no direct integration.

Anyway, it’s a second way of marrying SmartThings and the wireless sensor tags. The rules are simpleer than the ones you can use with a direct integration, and there may be a slight lag since now the tag has to talk to IFTTT and IFTTT has to talk to SmartThings, and that is done over the Internet.

But you don’t have to do any cut and pasting, you just select things from drop-down list while you set up your recipes.

Eventually you will probably want to use the cut-and-paste method, because it will be both more powerful and a faster integration. But you can use the IFTTT method initially while you get Used to smartthings if you like. And a lot of people end up using each method for different situations, it just depends on exactly what you’re trying to do each time.

1 Like

Thanks guys… :grinning:

1 Like

Getting some “unexpected error” when trying to add several of my tags… I have 9 added, but need to get my last 3 added. I’ve tried each of the remaining 3 individually (9 existing checked, + 1st, failed, + 2nd, failed, + 3rd, failed), but I get the same error each time.

1 Like

@talz13 Can you check out the log in the IDE to see what it says when you try to add the tags? Feel free to message me the logs and I’ll check them out.

I’ll check out your pull request too. I have been noticing the clutter especially from the way presence appears in the new app.

1 Like

I didn’t yet try adding another tag yet, but here’s what I see when a periodic refresh triggered:

11:30:27 AM: error java.util.concurrent.TimeoutException: Execution time exceeded 20 app execution seconds: 375369270988347 @ line 394
11:30:03 AM: trace success
11:30:02 AM: trace sending /ethClient.asmx/GetTagList
11:30:02 AM: trace pollHandler

Seems pretty explanatory that it killed itself because it was running too long? I’ve got 9 tags added to ST, not sure how many should reasonably be supported due to polling time?

Yes, it looks like the ST system is timing out waiting for the devices to update from the wireless tags system. I’ve only tried about 5 or 6 tags myself. I’ll make a note to look at any optimizations that could be done to reduce the time.

Smartapps are only allowed to run for 20 seconds at a time before the cloud kills them. It’s to keep them from using up too many cloud resources.

It’s quite common when you have smart apps that handle many different devices to run multiple instances of the same smart app to avoid this problem.

I don’t know if that’s a possibility for you here, it could be you’re just running into a timeout to the service connection.

One thought I had… Many SmartApps allow multiple instances to be installed… Like Keep Me Cozy, Laundry Monitor, etc. If you add an option to name the SmartApp at install time, it could be simple to divide the sensors among installed apps. That would hopefully allow users to put, say, 5 tags on an app, and then create a new app, and so on. It might be more clutter, but it might work around the issue temporarily at least.

Edit: LOL, maybe if I actually read the reply before mine, I would see that the idea was already posted :sweat_smile:

1 Like

I’ve been trying to track down an issue I’m seeing with Wireless Tags… Seems my front door and inside garage door keep getting disarmed in the morning, and I don’t believe I have anything set up to disarm them in ST… I also checked the Motion settings on the tag manager web app, and no kind of schedule is enabled to arm/disarm these tags.

Something of note, when I go through the Wireless Tag (Connect) setup again, it seems to arm all of the tags that it polls… can that be disabled? I’m thinking this SmartApp may have something to do with my unexplained arm/disarm cycle for those tags.

I have submitted a change that allows for named instances of the SmartApp so you can split up your tags between multiple apps. I also integrated your pull request for the temperature.

If you want to turn off the initialization of the tags when you install the SmartApp, you can go to line 219 in the latest version and comment out “d.updated()”. Otherwise, I’m not sure what would be causing the reset you mention.

I may make the presence and switch changes as well at some time in the main line. It does tend to clutter up the app, and I don’t expect many people are using that functionality.

1 Like