Google Assistant append sheet, and auto open garage using wifi connection?

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
phunkodelic
Posts: 1
Joined: 12 Jan 2020 15:53

Google Assistant append sheet, and auto open garage using wifi connection?

Post by phunkodelic » 18 Jan 2020 16:36

Two things I want automagic to do... can they be done?

1. Use voice input to append a google sheet that has a date column , meal name column, and description column. Date would be auto filled and generated by getting the current date, meal name could be auto filled with some logic as to when it was filled, or voice input. Meal name would be voice input. I need to keep a diary of what I eat for medical reason and am looking for a way to automate this.

2. Open my garage door using geofencing and/or when I connect to my WIFI while running Strava. Stava is a fitness app that I use to track runs an rides. Would like to set up a system that when I pull into my driveway my garage door auto opens based on connecting to WIFI and if Strava is running. I am using Meross WIFI garage door opener which has an app and is integrated with my google assistant.

I am a system engineer by trade so I do some scripting and coding so the tech side does not bother me.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Google Assistant append sheet, and auto open garage using wifi connection?

Post by Desmanto » 19 Jan 2020 18:34

1. Automagic doesn't directly support Google spreadsheet API. There is tasker plugin that can do that, Spreadsheet Tasker Plugin; it should be able to work with Automagic too. But the app hasn't been update for 2 years, the API might be deprecated already. Google now strongly recommended everyone to move to the google spreadsheet API v4. https://developers.google.com/sheets/api

W̶h̶i̶l̶e̶ ̶i̶t̶ ̶i̶s̶ ̶p̶o̶s̶s̶i̶b̶l̶e̶ ̶t̶o̶ ̶s̶t̶u̶d̶y̶ ̶t̶h̶e̶ ̶A̶P̶I̶ ̶a̶n̶d̶ ̶t̶h̶e̶n̶ ̶u̶s̶e̶ ̶t̶h̶a̶t̶ ̶u̶s̶i̶n̶g̶ ̶H̶T̶T̶P̶ ̶r̶e̶q̶u̶e̶s̶t̶ ̶i̶n̶ ̶A̶u̶t̶o̶m̶a̶g̶i̶c̶ (can't do it because require Oauth 2.0), I find it will takes more time. I suggest another workaround, by saving the data locally first using csv file. You can do exactly like you want, and then concatenate the lines to a csv file. Once a week or a month, you can copy paste it into your spreadsheet. Or you can also upload the csv to your gdrive for backup.

Current date can be easily retrieved using {triggertime} or getDate(). Meal name can be calculated using the time range. Meal description would use action input speech to get your voice input. Then finally combine all into a single csv line and append it to the file.

2. This seems more complicated and require more test. You can read my index at the geofencing section, or maybe my Wifi geofencing flow : viewtopic.php?f=3&t=7326
Wifi detection can be easily done, but maybe there will be latency as it depends on android wifi scan (you can make it faster but drain more battery). To detect Strava is running, can be done using Trigger App Task Started. The Meross Wifi garage is the one I am not familiar with. If It can be controlled using google assistant (Gass), you can use Autaomagic to send command to it and tell it to open the garage. But maybe Meross support some API or Automation which can be done directly without going thru Gass. If it supports HTTP post just like my sonoff Tasmota firmware, then it can be done using action HTTP request.
Last edited by Desmanto on 20 Jan 2020 17:41, edited 1 time in total.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.


User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Google Assistant append sheet, and auto open garage using wifi connection?

Post by Desmanto » 20 Jan 2020 17:39

@coconutxyz : That's awesome tutorial from João. But Automagic seems doesn't support Oauth 2.0 yet, as requested by anuraag : viewtopic.php?f=5&t=8251
So we can't do that yet now, I should retract my first point above.

I usually think locally first, so I prefer to write to local files. Only if I need it to be online, then I use other mean to copy the file. One of the method can be leveraging MiXplorer copy menu, which can be started using action Send Broadcast.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Google Assistant append sheet, and auto open garage using wifi connection?

Post by anuraag » 20 Jan 2020 23:55

oauth2 can be done through some post requests. Once we get refresh_token then we can go with api.

Post Reply