Unable Configure a new Simplisafe Integration
The problem
I've been trying to configure the Simplisafe integration but I keep getting authentication error. I've installed the simplisafe-python utilities and followed the documentation. Once I receive the code in step 6, I received the multi-factor authorization code according to documentation: com.simplisafe.mobile://auth.simplisafe.com/ios/com.simplisafe.mobile/callback?code=XXXXXXXXXXXXXXXXXXXX
When I paste it into the "Authorization Code" field of the "Configure" button of the Simplisafe automation I see a "Invalid Authorization" error in the interface. I also tried the "Code Verifier" code, but the UI displayed an error that that code wasn't the right length.
What version of Home Assistant Core has the issue?
core-2023.4.6
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
Simplisafe
Link to integration documentation on our website
https://www.home-assistant.io/integrations/simplisafe#getting-an-authorization-code
Diagnostics information
The automation didn't have an option to download diagnostic data.
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
Hey there @bachya, mind taking a look at this issue as it has been labeled with an integration (simplisafe) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of simplisafe can trigger bot actions by commenting:
-
@home-assistant closeCloses the issue. -
@home-assistant rename Awesome new titleRenames the issue. -
@home-assistant reopenReopen the issue. -
@home-assistant unassign simplisafeRemoves the current integration label and assignees on the issue, add the integration domain after the command.
(message by CodeOwnersMention)
simplisafe documentation simplisafe source (message by IssueLinks)
To confirm, are you pasting just the code (represented as XXXXXXXXXXXXXXXXXXXX in your example) into HASS?
Yes I just cleaned all my browser cache and tried again. I'm using Chromium Version 112.0.5615.121 (Official Build) built on Debian 11.6, running on Debian 11.6 (64-bit). I receive the log from Chromium: mfa-sms-challenge:1 Launched external handler for 'com.simplisafe.mobile://auth.simplisafe.com/ios/com.simplisafe.mobile/callback?code=XXXXXXXXXXXXXXXXXXX'.
I copy just the hexadecimal key above after the equals sign and before the single quote into the "Authorization Code" field of the window that displays when you hit "Configure" of the SimpliSafe Integration.
Set up debug-level logs:
logger:
default: info
logs:
homeassistant.components.simplisafe: debug
simplipy: debug
...and try again. Assuming it fails once more, paste back any homeassistant.components.simplisafe and simplipy logs (taking care to remove any sensitive information you don't want posted).
I added the debug-level lines to my configuration.yaml and restarted HA. When I paste in the code to the web UI I get the following debug in home-assistant.log:
2023-05-03 21:10:37.095 DEBUG (MainThread) [simplipy] Data received from /oauth/token: {'error': 'invalid_grant', 'error_description': 'Failed to verify code verifier'}
After running simplisafe-python's script/auth command in the (.venv), I get the following output where "AUTHCODE" is the code I received from the web browser and "VERCODE" is a different key that is output from the script (No errors that I could tell):
Press <ENTER> to be taken to the SimpliSafe login page... Enter the code received from the SimpliSafe auth webpage: AUTHCODE
You are now ready to use the SimpliSafe API! Authorization Code: AUTHCODE Code Verifier: VERCODE
On Mon, May 1, 2023 at 9:18 PM Aaron Bach @.***> wrote:
Set up debug-level logs:
logger: default: info logs: homeassistant.components.simplisafe: debug simplipy: debug
...and try again. Assuming it fails once more, paste back any homeassistant.components.simplisafe and simplipy logs (taking care to remove any sensitive information you don't want posted).
— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/92314#issuecomment-1530742229, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7G5WIQ5H5QOF374N5RQVADXEBOIFANCNFSM6AAAAAAXRGUDVU . You are receiving this because you authored the thread.Message ID: @.***>
I figured out how to get the integration to work! When I clicked on the "Configure" button in the integration section of the web UI, I was instructed to refer to documentation @ https://www.home-assistant.io/integrations/simplisafe/.
When I read the instructions it said to "refer to step 6" in a second set of instructions @ https://simplisafe-python.readthedocs.io/en/latest/usage.html#authentication . I didn't know how to get the simplisafe pop-up window to display, so I followed steps 1-5 in the second set of instructions. I cloned the GIT repo, created a venv, etc. However, I went back in the integration window and noticed there's a link to bring up the Simplisafe login right from the web UI's "Configure" dialog. I tried this link, received my code, and after pasting this code into the Simplisafe integration UI it worked.
In summary, the command "script/auth" to grab a MFA key according to https://simplisafe-python.readthedocs.io/en/latest/usage.html#authentication steps 1-5 launched a SimpliSafe login window to get a MFA key. This method did not work. Instead I just clicked on the "Configure" button in the Simplisafe integration. Inside this pop-up dialog I clicked on the second link to login to Simplisafe and once entering my credentials the code here worked.
On Wed, May 3, 2023 at 9:18 PM Phillip Boone @.***> wrote:
I added the debug-level lines to my configuration.yaml and restarted HA. When I paste in the code to the web UI I get the following debug in home-assistant.log:
2023-05-03 21:10:37.095 DEBUG (MainThread) [simplipy] Data received from /oauth/token: {'error': 'invalid_grant', 'error_description': 'Failed to verify code verifier'}
After running simplisafe-python's script/auth command in the (.venv), I get the following output where "AUTHCODE" is the code I received from the web browser and "VERCODE" is a different key that is output from the script (No errors that I could tell):
Press <ENTER> to be taken to the SimpliSafe login page... Enter the code received from the SimpliSafe auth webpage: AUTHCODE
You are now ready to use the SimpliSafe API! Authorization Code: AUTHCODE Code Verifier: VERCODE
On Mon, May 1, 2023 at 9:18 PM Aaron Bach @.***> wrote:
Set up debug-level logs:
logger: default: info logs: homeassistant.components.simplisafe: debug simplipy: debug
...and try again. Assuming it fails once more, paste back any homeassistant.components.simplisafe and simplipy logs (taking care to remove any sensitive information you don't want posted).
— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/92314#issuecomment-1530742229, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7G5WIQ5H5QOF374N5RQVADXEBOIFANCNFSM6AAAAAAXRGUDVU . You are receiving this because you authored the thread.Message ID: @.***>
Glad you got it working. I just tried via the integration (without using simplipy's auth script) and it worked fine, so I'm not sure what's going on—both routes use the same underlying mechanism...
Sorry for the confusion, but I think the problem has been version control on my end. I assumed there'd be an update to home assistant and I haven't updated the simplify-python utility. I think this is why it worked from the main UI and not the local git repo for the auth script. All I was missing was a pull from:
https://github.com/bachya/simplisafe-python.git
Thank you for helping and creating an excellent integration. I have been setting up my security control cards and love the whole setup!
Thanks again, Phillip
On Wed, May 3, 2023 at 11:35 PM Aaron Bach @.***> wrote:
Glad you got it working. I just tried via the integration (without using simplipy's auth script) and it worked fine, so I'm not sure what's going on—both routes use the same underlying mechanism...
— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/92314#issuecomment-1534046980, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7G5WIWCW7NTQ77IZBILHQDXEMPXBANCNFSM6AAAAAAXRGUDVU . You are receiving this because you authored the thread.Message ID: @.***>