Difference between revisions of "Sudoroom Door Shortcut for iPhone"

Jump to navigation Jump to search
 
(17 intermediate revisions by one other user not shown)
Line 1: Line 1:
.




.
== Recreate the iPhone shortcut that opens the sudoroom door with a widget on your phone. ==
==== Recreate the iPhone shortcut that opens the sudoroom door with a widget on your phone. ====
 


== Keep your credentials private! ==
== Keep your credentials private! ==
Line 10: Line 7:
Once you’ve built the shortcut, the password is stored in it in readable form. Don’t share the shortcut file (the Share button exports the password along with it). Point people to this guide instead.
Once you’ve built the shortcut, the password is stored in it in readable form. Don’t share the shortcut file (the Share button exports the password along with it). Point people to this guide instead.


This guide walks you through building an Apple Shortcut that asks the sudoroom server to open the door. You don’t need any technical background: follow the numbered steps and you’ll be done in about five minutes. If you’re curious about what’s actually happening, the blue Under the hood boxes explain each piece. Skip them if you just want it working.
This guide walks you through building an Apple Shortcut that asks the sudoroom server to open the door. You don’t need any technical background: follow the numbered steps and you’ll be done in about five minutes. If you’re curious about what’s actually happening, the "Under the hood" section at the end explains each step.  


== How it Works: ==
== How it Works: ==
Line 32: Line 29:
Add a Text action. Type the username, a colon, and the password, all on one line with no spaces:
Add a Text action. Type the username, a colon, and the password, all on one line with no spaces:
USERNAME:PASSWORD
USERNAME:PASSWORD
[[File:1 text action.png|frame|left]]


=== Step 2: ===
=== Step 2: ===


Encode: convert it to Base64
Add an "Encode" action directly below the Text action. Make sure it says Encode Text with base64, then tap to expand it and set Line Breaks to None.
Add an Encode action directly below the Text action. Make sure it says Encode Text with base64, then tap to expand it and set Line Breaks to None.
 
[[File:2 encode base64.png|frame|left]]


=== Step 3: ===
=== Step 3: ===


Set Variable: name the result b64creds
Add a "Set Variable" action. Name the variable b64creds. It should automatically show Base64 Encoded as its value; if not, tap the value and choose the Base64 Encoded result from Step 2.
Add a Set Variable action. Name the variable b64creds. It should automatically show Base64 Encoded as its value; if not, tap the value and choose the Base64 Encoded result from Step 2.
 
[[File:3 set variable.png|frame|left]]


=== Step 4: ===
=== Step 4: ===


Get Contents of URL: send the request
Add a "Get Contents of URL" action. This is the step that actually contacts sudoroom.
Add a Get Contents of URL action. This is the step that actually contacts sudoroom.


===== Configure it like this: =====
===== Configure it like this: =====
Line 56: Line 56:


To add the header, tap Headers, then Add new header. In the value field type Basic and a space, then tap the variable bar above the keyboard and pick b64creds. It should appear as an orange variable bubble, as in the screenshot.
To add the header, tap Headers, then Add new header. In the value field type Basic and a space, then tap the variable bar above the keyboard and pick b64creds. It should appear as an orange variable bubble, as in the screenshot.
[[File:4 get contents of url.png|frame|left]]


===== Common mistake: =====
===== Common mistake: =====
Line 70: Line 72:


Tap the ▶ play button to test it. If the door responds, you’re done.
Tap the ▶ play button to test it. If the door responds, you’re done.
Optional: add a Show Result action at the end. It will pop up whatever the server sends back, which is very handy when something isn’t working.
 
 
===== Optional: =====
Add a Show Result action at the end. It will pop up whatever the server sends back, which is very handy when something isn’t working.
 
 
[[File:5 full shortcut.png|frame|left]]


== Make it one tap ==
== Make it one tap ==
Line 78: Line 86:
* Home Screen: long-press the shortcut in the Shortcuts app → Share → Add to Home Screen. (Here “Share” only adds an icon; it doesn’t send the shortcut to anyone.)
* Home Screen: long-press the shortcut in the Shortcuts app → Share → Add to Home Screen. (Here “Share” only adds an icon; it doesn’t send the shortcut to anyone.)
* Siri: say “Hey Siri,” followed by the shortcut’s name.
* Siri: say “Hey Siri,” followed by the shortcut’s name.
* Lock Screen, Control Center, or Action button: add it as a Shortcut control in your iPhone settings for those features.
* Lock Screen, Control Center, or Widget pull-down menu


== Troubleshooting: ==
== Troubleshooting: ==
Line 85: Line 93:


* the URL
* the URL
* that the credentials are entered as USERNAME:PASSWORD
* that the credentials are entered as username:password (all lowercase!)
* that Base64 uses no line breaks
* that Base64 uses no line breaks
* and that the Authorization header contains the word Basic followed by a space and the b64creds variable
* and that the Authorization header contains the word Basic followed by a space and the b64creds variable

Navigation menu