Saving trips across the wire


#1

I’ve been looking for ways to cut down on how many times tasker has to make network calls. So I maintain subscriptions for only devices I need to. But what I was wondering, if you do a get of a thing/mode/SHM and you have those subscibed, does the get action call to smarthings for the current state or does it cache the value from the last event and return that to tasker?


#2

Thanks for posting, Brian!

All of the ‘Get’ actions in the SharpTools Tasker plugins always make a call to SmartThings to retrieve the current state. While the event driven approach is ephemeral in nature (eg. one-time, event driven), you can cache the status of those events with Tasker variables (see further below).

As you noted, there are pros and cons to using an event based approach vs using a query based approach. Each approach along with the pros and cons are discussed in the following article:

You have the option of ‘caching’ the event status in Tasker global variables and then can use those global variables in other Profiles/Tasks. You can find more details in the following article:


#3

Thanks, Josh
I had started a project in tasker to handle caching pushes. I have a profile that response to any subscribed device/attrib push then scans an array for the device attribute combination. If it finds the combination in the array, it updates the value. If it doesn’t find the combination, it inserts the name/attrib and value into the array as a new element.
So a few things to do, like garbage collection, ie aging out old records. And what to do with devices I need the value of but don’t know if they are subscribed or not at the time I’m getting them, etc. But I just wanted to be sure that Sharptools wasn’t already caching which would make my efforts redundant.