How To Send Sensor Triggers to Android and Have Android React

Thanks, @joshua_lyon.

In this use case, I want to trigger on either motion sensor. So (using your hall idea), if I put motion in the attribute field, and hall in the thing field (assuming the motion sensors I’m using here have hall in their name [I know that I will also have to manage the name-space and make sure I’m not getting triggered by others elsewhere that may also have hall in their names]), is it correct that it will effectively be like saying ANY, and even if I was originally looking for OR, this works just the same?

Yes, that’s a great way of putting it – the ANY condition is very much like an OR condition. The configuration you noted would trigger for any subscribed motion attribute that changes for a device with the hall in its name.

1 Like

Awesome! Thanks, man. I’m making the change to test it out right now…

Um…uh-oh…I think I may have freaked out one of my motion sensors…
For the past few minutes, I’ve been noticing that the motion detector that I’m testing with (which I ‘borrowed’ from another room down the hall) is no longer reporting motion when motion happens.

If this is a simple issue, please somebody give me the scoop here. Otherwise, if you think I should, I’ll go create a thread (I searched and couldn’t find anything specifically like what I’m experiencing yet, but if it’s there, please point me there).

It was working just fine for a while. I was able to have it pointed away from me on my desk, wave hand in front of it, and watch the tablet turn on. Now, tablet screen doesn’t wake, and there’s no report of motion within SmartThings app (when there still is for the other motion detector of the same kind in same room down the hall).

Is there anything goofy that can happen if you move a motion detector around like I did for this testing, and if so, is that this? :slight_smile:

Ideas?

There was an issue with SmartApps that was just resolved recently… Not sure if it’s related, but if the motion sensor isn’t reporting even with the main SmartThings app, then you may want to reach out to support@smartthings.com to see if they can help.

Edit: I just realized you said your borrowed the motion sensor from down the hall. Did you try taking it back to its original location to see if it checks in? Could be a Z-wave or ZigBee mesh issue if it was borrowed from a different location?

SmartApp Execution and Device Control
Incident Report for SmartThings
New Incident Status: Resolved
This incident has been resolved.
Nov 23, 20:42 EST
PREVIOUS UPDATES
Monitoring
Issues with device control and SmartApp execution should be resolved. SmartThings will continue to monitor the situation and update accordingly. If you continue to experience problems please email support@smartthings.com
Nov 23, 19:29 EST
Investigating
Some users may be experiencing issues with device control and SmartApp execution. We are investigating the problem and will update accordingly.
Nov 23, 18:22 EST
This incident affected: Hub Connectivity (North America, UK), Scheduled SmartApps (North America, UK), Mobile App Connectivity (North America, UK), SmartApps (North America, UK), Device Control (North America, UK), Push Messages (North America, UK), SmartApp Web Services (North America, UK), and Developer Tools, SmartThings.com, Shop.SmartThings.com, Community Site.

1 Like

Well, I moved it back to its original room. After more than an hour, it’s still not reporting movement.
So, I guess I will get a case started.

Thanks, @joshua_lyon

I got it taken care of…
I basically removed it from every SmartApp that it had found its way into, and uninstalled it from the system, re-added it back as a new device and now it’s working correctly again. Well…or at least it was at sleep time last night.

I will do some testing again today just to make sure, but I think it’s all back in good working order now.

Also, it is now a wall-mounted SmartTiles control panel.
The screen turns on when there is movement in the room (It’s in a pretty small room. So, no need for limiting motion detection to a smaller area; like I will probably do for similar panels in kitchen, living room, etc), and then turns off after 30 seconds if no motion.

Of course, it’s still a ways from perfection, since the power cable is still visible, dangling off one side for now, but eventually…

Thanks again, @joshua_lyon

1 Like

@joshua_lyon

UPDATE:
OK, I removed the kiosk app, and SharpTools and the profile I had created in Tasker.
Then, I exported the working profile from the other Android, and imported it into this one, and it sort of works, but it takes a very long time for it to wake the screen,

On the other Android, it wakes the screen after about 6-7 seconds (which, for me, is too long in the first place for ideal scenarios), but on this one, it takes more than 20 seconds.

Any ideas on why it takes so long, and/or what I might be able to tweak to get it to react any faster?

EDIT: Actually, I think I may need to go take another look at System Requirements for Tasker and SharpTools. Perhaps it’s just that I’m asking way too much of this cheap, little tablet I’m trying to get this working on. I just rechecked and although it has a quad core CPU, it only has 1GB RAM. So, unless I hear or find out anything else, I guess I’m going to consider that the problem with the lag.

I would recommend watching the SmartThings Live Logs to see how quickly the platform is triggering the various events (eg. Motion Sensor: motion detected → SharpTools SmartApp: motion event tripped).

It’s possible that the platform is running slow when you are seeing these slow push events. When the platform is running at normal (fast) speeds, I can physically press a switch and get the push event on my phone before my finger has even lifted from the switch. That being said, I’ve experienced slow runs through the platform where things can also take a few seconds like you have experienced.

1 Like

Thanks. I will check the live logging.
However, as for platform speed, this difference between these two devices happens live…

With both Android devices set up with the same Tasker profile, and with screens off…
0 seconds: Motion happens
6-7 seconds: Android1 screen turns on
20-some seconds: Android2 screen turns on

So, I assume the difference between the two devices must just be lag caused on Android2.
It’s sad, because I just bought this cheap little tablet specifically for this purpose. I guess I can’t cheap-out quite this much lol

I would definitely start with the Live Logging… that way you can at least rule-out slowness the first part of the process from the event triggering, getting recognized in the SmartApp, and getting sent to Google Cloud Messaging (GCM).

From there, we could test how long it’s taking for the event to get from the ST Servers (through GCM) and to your device. We would do this by turning on Push Event Debug Notifications in the SharpTools Settings screen so we can see when the event is hitting SharpTools and rule out any slowness with Tasker or other processing. (Turning on this setting will cause a notification to show up on your Android device anytime a push event is received for SharpTools)

Once you have the debug notifications enabled in SharpTools, I would recreate your events and watch the SmartThings Live Logging to see when the message is handed off to GCM and then time how long it takes before the debug notification shows up on your device.

1 Like

EDIT: I think it’s working now.

However, there are so many other ST projects I’m working on and this one is not as high priority.

So, I am just using them in the state they are in…which is…they all turn on after 2-10 seconds, and then turn off after the set delay…most of the time :slight_smile:

EDIT: I eventually added virtual switches to the mix, and use them to get the ‘screen-off’ portion to work better. I assume there’s another way of making it better sometime, but for now, it’s good enough.

If anybody ever wants to see how I did it, I will post more specific details on how I created the various parts of this setup, etc. So, let me know.

LONG DELAYS

Just today (or maybe it started yesterday), the length of time between motion and my Android screen coming on increased dramatically. For months now, it has been at about the same period; averaging about 5 seconds. Now though, it’s more like 25-30 seconds.

I know this could just be a glitch somewhere in my system, but has anybody else noticed anything like this?

1 Like

UPDATE on the LONG DELAYS:

It appears that this delay issue is only happening on one of my mounted dashboards; the others seem to respond more like my ‘normal’ experience.

Same thing this morning. Only having this LONG DELAYS problem on one of my dashboards.
I think I will go post something in one of the SmartTiles threads next…

UPDATE: OK, now I see that the one exhibiting these LONG DELAYS is the only one running the latest version of Sharp Tools. So, I will check in with @joshua_lyon next…just in case it’s related somehow…

So i’ve been trying out your setup - love the idea (until recently have been using camera/motion detector app and turnscreen script) I wanted to start using the motion sensors in the smartthings network instead as the camera option on the tablet itself is limiting in the way you can mount the tablets (soon as you add a frame you need a hole in it for the camera to see etc).
Ive setup SharpTools, which works a treat - nice having a few test buttons directly on the android dash.
I’ve used your setup for turning on the screen via secureSettings. The issue i have run into so far is, after the device goes into sleep mode for a little while it needs two events to wake it rather than one…
I have the devices permanently powered so I was thinking of turning off sleep altogether and just using screen on/off based on motion.

I’ve setup a on/off switch (for testing - which i will rule connect to a motion sensor eventually). Was wondering what command you were using to turn off your screen? and also have you encountered the same double event issue?

If anyone else has a similar setup would be interested to hear your viewpoints or anyone else who has experience with tasker/events that might shed some light.

UPDATED: Ive set up a simple rule that switches a momentary switch once, waits 1 second and a second time. and this seems to work consistently so far.

Cheers in advance
RO

Which device is this for? Some devices from Samsung and other manufacturers tend to have more aggressive sleep and memory management utilities, so sometimes you have to go in and tweak those utilities.

Do you think it’s related to the receiving of the push event or could it perhaps be related to the waking of the device? For example, if you set up an event to simply display a notification when it receives the push event, does it work on first try even when the device is asleep (obviously you’ll have to manually wake the device after sending the push-event to check). If it’s the latter, then perhaps you could add a delay/retry mechanism in Tasker.

For example, on the Samsung tablet I have in my son’s room, I have it set to reboot every day at 3 PM (completely unrelated to SmartThings, but perhaps related to the question at hand). I can’t remember the exact commands I’m running in this setup, but I basically wake the device, show a notification, send a Pushbullet message to another device, then reboot. To get this all to work, I have to send the wake command, wait a second or two and then run my next commands otherwise they wouldn’t always fire. I also had to disable the optimization features in Smart Manager → Battery → App Optimization.

1 Like

Thanks for the response, it’s definitely to do with waking the device, as you say it’s more than likely the device being slow to wake or being overly conscious of power usage.

In my rule I setup in smartthings, my rule sends the same command 3 times with a second delay between each, depending on how long the device has been asleep on either the second or third command it wakes.
I can monitor what commands are being sent and with the device on it’s pretty instant (using an alert print to see when/what is happening). Also turning off the device via the dev actions in secure settings works every time with only a single command.

It’s either sharptools isn’t given enough priority for wake, tasker the same or the device is just slow to wake via wifi. Maybe it requires a minimum amount of data/commands to wake via wifi after sleep.

I’ve turned off most of the optimisations I can find, and using the repeat 3x command setup it’s working very consistently. Just means you’ll have to wait the odd few seconds for the display to come alive when walking into some rooms.

Sill it’s a better solution to using the tablets camera which would fair when it was too dark.

For reference it’s a kindle fire fifth gen tablet, running the slimLP rom.

This may be what you’ve already done, but in Android Settings > Battery > Menu: Battery Optimization you can turn off optimizations for specific apps. I would try disabling it for Tasker and SharpTools. (This may have been introduced in Marshmallow - I can’t recall off the top of my head)

That being said, it sounds like you’ve implemented a workaround that works for you – so perhaps, “if it ain’t broke, don’t fix it” applies here. :smile:

I can’t find the battery optimise options on my droid but as you say it seems to work.
I have them all mounted and they work great, be good to test them tonight, be the first time they might work in the dark :slight_smile:
Will check further for the optimise settings tomorrow.

Appreciate the advice

I am new to this type of tech modification. I have wanted to do something like this for some time now. I came across a 22" android touchscreen tablet that was used as a kiosk at a doctors office which has since been rooted. It is ideal size wise for a home command center. I was looking to have the home page display the family calendar, weather, and other news/info items for general family information. The down side of this unit is that it lacks a camera or battery. I am not to worried about an absence of a battery, but the lack of a camera for the purposes of waking the system/screen when someone triggers a proximity sensor/camera is something that I am trying to work around. I am rather techy in regards to computers, engines, and the like but I am not to familiar with the app/rooting scene. I for the most part, fell that I could get the apps and adjust the settings as needed to produce the desired result, I am just overwhelmed with the options of external camera/sensors and which one would work. The unit has 3 standard usb ports, an older mini-usb port, and a lan line port along with the power port. Not sure if plugging directly into a usb port is going to work or if I should use Bluetooth. I am pretty sure the unit has Bluetooth capability, but at the time of writing this post I have yet to determine this fact. Any insight to which proximity sensor or camera that would help produce the desired result along with any new apps would be much appreciated. The wife was not really on board with this project, but she seems receptive, so I would like to get this going so I don’t hear grief about this unfinished project. Another note, I would like a camera that would allow me to use the tablet while video chatting with family. The tablet will be secured on the kitchen wall and not move so I don’t foresee any issues with cables and the like getting in the way.