Simple App to call a particle function

Hi,
I created an simple app that exposes a button to call a particle function.

My motivation was to have a quick and simple way to open my garage door.

I published the code as open source and the app is available on Google Play as “Particle Buttons”.

You can create multiple buttons to call your particle functions. More info here.
Looking forward for your feedback :slight_smile:

p.s: if you are interested to have it on iOS, let’s chat (It’s ready to publish as it was written in Xamarin, but Apple charges a significant fee to publish).

3 Likes

As far as the Apple side:

I had the same need (and frustration - from Particle not releasing a generic “remote control” like app, or any Apple watch support back a few years ago), and then moved to SmartThings which was “ok”, but required extra steps. At the time, with a real “force touch”, you could force touch the SmartThings icon and call your shortcuts.

Eventually when Siri Automations (“Shortcuts”) came out, started using that and have not looked back. Mentioning this because for Apple you can create the “app” functionality for free in a matter of minutes with things like full REST/JSON calls and parsing, and automatically control it from an icon/“app” or voice action (very significant).

At this point I have 10+ automations that are all voice driven and they each drive anything from simple pin/toggle actions on Photons, to complicated 50+ step evaluations/decision trees.

Hope this is helpful.

4 Likes

@ventz,
I am very interested in what you have done. Any chance you can share details or point me to resources to replicate what you have done?

2 Likes

What do you want to know. Very happy to share more details. Are you interested in knowing the App side or the device side that connects to the Garage door opener ?

@tiagonmas ,
Thank you Tiago, I have briefly looked at your GitHub repository and will dig in later to see what you have done. Looks awesome. Seems you have shared enough and I appreciate your sharing. :wink:
My request for more details was directed at Ventz as I am interested in his Siri integration as well.

1 Like

@Farkologist Here is the “simplest” example within “Shortcuts”
1.) Create a “new”
2.) Give it a name ABC (this becomes the “Hey Siri ABC”) - in this case “Garage” -> this becomes the “Hey Siri Garage” call
3.) Give it the API url (for a function call - use POST)
4.) Give it the Particle Device ID (1st red block)
5.) Give it the Function name (same one you would call from the particle CLI)
6.) Give it Particle API access token as “access_token” in the Request Body param, and make sure it’s “Form” (vs JSON)

You can add parameters to your function the same way. If you are using “GET”, you can do function?key=value (ex: /garage?name=front), or you can post as “POST” params.

More Advanced - get data back, parse it, do something:

  • If you need to retrieve any content, you will most likely want to switch to JSON, you can add a “Get dictionary from” and give it the “Contents of URL” parameter.
  • Along with "Get Value (for json fields) with the json root path from “Dictory”
    (full ex: "Get Value for “data.some.jason.path” in “Dictionary”)
  • You can set a variable with the above
  • You can Speak the value or do math on it (ex: round it down, etc)

Hope this helps.

7 Likes

Congrats on successful project!

There happens to be an existing Particle Photon based open-source garage door controller with free iOS and Android apps. Firmware and mobile apps source can be found here, binaries here. Home grown clones are welcome.

And yeah, you also get IFTTT, Alexa, Google Home, SmartThings, LAN MQTT and more.

[end of the shameless plug] :wink:

@ventz, I love this post! Like many others, I created a garage door opening and door status device and I created an app via Thunkable to allow me to easily control the doors. However, your Shortcuts post makes it even easier by being able to verbally ask for the door to open/close. Thanks!

I now want to create a shortcut so I can ask the status of the doors for those times I leave the house and can’t remember if I closed the door. That will be handy, too.

I this community forum is amazing!

@ctmorrison Awesome - I struggled with the same issues for quite a while, so I am glad people are finding this useful.

I don’t want to hijack @tiagonmas’s thread or Android work, so if others have questions/want examples, I can definitely create an “Apple Particle Automation” thread or something like that.

3 Likes

This might be old news, but on the Android side I use HTTP Request Shortcuts.
It can make GET and POST requests to get/push variables. I like the horizontal scroll tabs to organize different shortcut types.

1 Like

I'd say go for it, many people will be grateful if you do.
Cheers

1 Like

Love it. thanks for sharing.

I tried to download the app on my android phone and it is not showing up in the playstore. Is it still available?

In the mean time, I downloaded "HTTP Request Shortcuts" as it looks like a solution. Unfortunately, I don't know enough about how to input the needed parameters to communicate with the particle photon through the app. I have the needed information in my particle console and I can send the 2 commands from there to control the photon (for example I send a "2" to the device through the console to open the vent and a "1" to close it), but I can't figure out what I need to enter in the "HTTP Request Shortcuts" app to do the job.

Any help or guidance is appreciated.

I have that app working for a number of Photons. I haven't created new shortcuts for a while and the app has changed quite a bit.
You will need your access token and the ID of your Photon.
The token can be found using the CLI program (search forum, let me know if no clue).
The ID is a long sequence of digits that you can get from the WebIDE or console.
You can store these values as variables in the app (select Variables in the settings, which is the three dots on top right corner). Then you don't have to type them again.

Now create a new Regulat HTTP Shortcut, give it a name and description. Then change these entries:
Click on Basic Request Settings:
Method = POST
URL = https://api.particle.io/v1/devices/PHOTON_ID/FUNCTION_NAME
Click on Request Body / Parameters:
Request Body Type = Parameter (x-www....... third on the list)
args = whatever you need to send to your function, like 2
Click on Authentication
Method needs to be Bearer Authentication
Token = YOUR TOKEN

That should be all you need to call a function. You need a new shortcut for every parameter value the function can handle.
There are way more things you can do with this app, like how to handle the response and scripting.
Hopefully this gets you started.

2 Likes