iOS shortcut (web authentication)

  • While this is flagged as a UNI, I think it applies to any relay.

    Aim: A iOS (siri) shortcut that will trigger a relay on a UNI that has web authentication

    Problem: When sending the URL string to activate the relay in the format http://user:pass@IPaddress/relay/0?turn=on Safari on iOS (and Mac) throws up a login screen for userid and password with a warning that it will be sent unencrypted. On chrome (Mac) it works like it should and triggers the relay.

    Is there a way to prevent the popup login? Or some other workaround?

    Will the shelly app itself on iOS work with shortcuts in the future (which would have the benefit of being able to trigger the relay by voice command from outside the house)

    Thanks

  • OK, with help from talk.automators.fm I have the solution to using iOS Shortcuts with a shelly that has web authentication turned on:

    How To:

    Create a new shortcut on iOS giving it an appropriate name that is easy to say and won’t confuse Siri

    • Text block containing the username and password in the format
      • Username:password
    • Base64 Encode Block
      • Encode [Text] with base64
    • URL Block
    • Get contents of block
      • Get Contents of [URL]
      • Touch the arrow to open the options for the action
      • Add a Header
        • Key = Authorization (check the spelling has a Z )
        • Text = Basic [space] [then touch the select variables and choose the output of the Base64 Encode Block]
        • Optional - Long touch the inserted variable (Base64 Encoded) and rename it to something useful like ‘Credentials’

    The first time you use the shortcut it will ask you for permission to contact the IP address, after that it should just work provided you are connected to your local network and your iDevice can reach the ip address of the shelly.