External Routine Passing Parameters to a Smartapp

I have an external routine (PHP and Tasker) that computes the actual distance from my current location to my “Home” location. This routine is called, via a ST Smartapp, only once Life360 says I have “arrived home”. The routine calculates the actual distance from my current location to my “home” location and once the distance is less than a particular setting, turns on a ST virtual switch. So far this is working quite well. But…

A “nice to have” feature would be to pass the calculated distances from the external routine to the Smartapp. I know I can pass external parameters to a device with something like path("/switches/:id/:command") however, I would like to avoid using a device if possible (i.e. pass parameter to am app State var). Is this possible? Any examples??

There’s nothing unique about the path("/switches/:id/:command") endpoint you noted… it just happens to be handled by a method that uses the id and command to control a device.

Just create a path specific to your needs and create a method to do whatever you want with the input data. eg path("/distance/:myvalue") and in your method, take the myvalue parameter and add it to the state map.


Works like a charm. Thank you so much