Home Assistant release with the issue:
0.92.0
Last working Home Assistant release (if known):
0.91.4
Operating environment (Hass.io/Docker/Windows/etc.):
Python venv on Debian
Component/platform:
logi_circle
Description of problem:
I've configured the yaml with the client_id, api_key, client_secret and redirect_uri. I requested these from Logitech some weeks ago. I can start the configuration flow in the UI; I hit the link, get redirected, log-in and get redirected back to my HA instance with the token in the URL and a body that says "{"message": "Authorisation code saved"}". However when I return to HA to complete the configuration it says "Please follow the link and authenticate before pressing Submit."
Looking at home_assistant log in debug I can see a message saying "PermissionError: [Errno 13] Permission denied: '.logi_cache.pickle'". I had an existing pickle file from the previous circle integration so I tried deleting it, restarting HA and trying again with the same result. I also tried deleting the file entirely and restarting. My HA configuration directory is writable by HA.
Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):
# Logi Circle
logi_circle:
api_key: <my_api_key>
client_id: <my_client_id>
client_secret: <my_secret>
redirect_uri: https://<my_url>:8123/api/logi_circle
Traceback (if applicable):
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/data_entry_flow.py", line 64, in async_init
return await self._async_handle_step(flow, flow.init_step, data)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/data_entry_flow.py", line 98, in _async_handle_step
result = await getattr(flow, method)(user_input) # type: Dict
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/logi_circle/config_flow.py", line 141, in async_step_code
return await self._async_create_session(code) File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/logi_circle/config_flow.py", line 164, in _async_create_session await logi_session.authorize(code) File "/srv/homeassistant/lib/python3.6/site-packages/logi_circle/auth.py", line 67, in authorize
await self._authenticate(authorize_payload)
File "/srv/homeassistant/lib/python3.6/site-packages/logi_circle/auth.py", line 118, in _authenticate
self._save_token()
File "/srv/homeassistant/lib/python3.6/site-packages/logi_circle/auth.py", line 130, in _save_token
with open(self.cache_file, 'wb') as pickle_db:
PermissionError: [Errno 13] Permission denied: '.logi_cache.pickle'
2019-04-24 20:00:36 DEBUG
Additional information:
Hey, sorry for the trouble.
My HA configuration directory is writable by HA.
It may not write the token cache there. I just span up a venv to try and replicate your issue and it wrote the token cache to the app root folder. Can you check permissions there and try again?
No trouble. Thanks for your work. My venv lives at /srv/homeassistant, while my config lives at /home/homeassistant/.homesassistant. Both were already 755 but I made them 777 to test. I had the same error writing .logi_cache.pickle though. Here's the ls output. Am I looking in the right place?
/srv/homeassistant$ ls -al
total 36
drwxrwxrwx 8 homeassistant homeassistant 4096 Mar 2 14:21 .
drwxr-xr-x 4 root root 4096 Feb 11 11:00 ..
drwxr-xr-x 3 homeassistant homeassistant 4096 Apr 24 15:15 bin
drwxr-xr-x 2 homeassistant homeassistant 4096 Feb 3 16:51 include
drwxr-xr-x 3 homeassistant homeassistant 4096 Feb 3 16:51 lib
lrwxrwxrwx 1 homeassistant homeassistant 3 Feb 3 16:51 lib64 -> lib
drwxr-xr-x 3 homeassistant homeassistant 4096 Mar 2 14:21 man
-rw-r--r-- 1 homeassistant homeassistant 69 Feb 3 16:51 pyvenv.cfg
drwxr-xr-x 3 homeassistant homeassistant 4096 Mar 2 12:49 selenium
drwxr-xr-x 4 homeassistant homeassistant 4096 Feb 3 16:56 share
I stand corrected - hass writes token caches to the working directory hass is launched from, or at least it does in my case.
How do you start hass?
I use systemd. Your mention of working directory led me add the WorkingDirectory directive below. The configurator works now and the camera is available.
Thank you. Really appreciate it.
Description=Home Assistant
After=network-online.target mysql.service
[Service]
Type=simple
WorkingDirectory=/home/homeassistant/.homeassistant
User=homeassistant
ExecStartPre=/bin/sleep 15
ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"
[Install]
WantedBy=multi-user.target
Excellent! :tada:
Is this solved?
Yes. Sorry. Closing. Thank you.