Error when setup Somfy integration with Developper Account : no entities are imported and an error "Cannot update devices: 404" is raised
configuration.yaml
somfy:
client_id: XXXX
client_secret: YYYY
2020-10-28 22:02:54 INFO (MainThread) [homeassistant.components.somfy.config_flow] Successfully authenticated
2020-10-28 22:02:58 WARNING (MainThread) [homeassistant.components.somfy] Cannot update devices: 404
I have a Connexoon bridge.
I tried manually to call Somfy API from https://developer.somfy.com/somfy-open-api/apis/get/site and I successfully accessed to my Sites and Devices :
GET https://api.somfy.com/api/v1/site
[
{
"id": "XXX",
"label": "Maison XXX"
},
{
"id": "YYYY",
"label": "Maison YYY"
},
{
"id": "ZZZ",
"label": "Connexoon"
}
]
GET https://api.somfy.com/api/v1/site/ZZZZ/device
[
{
"id": "AAAAAA",
"type": "roller_shutter_positionable_stateful_rs100",
"parent_id": "BBBBB",
"categories": [
"actuator",
"roller_shutter"
],
"states": [
{
"name": "position",
"value": 100,
"type": "integer"
}
],
etc...
I have 6 Roller Shutter available in Somfy API.
Hey there @tetienne, mind taking a look at this issue as its been labeled with an integration (somfy
) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)
@totothekiller Can you try using the native Home Assistant Somfy credentials by removing the Somfy entry in your configuration?
I鈥檝e just try on 0.117 and was able to import my devices.
@tetienne I removed Somfy entry in configuration.yml. Then retry to add Somfy integration. I successfully enter my credential for OAuth then I finally land on https://account-link.nabucasa.com/authorize_callback?state=XXXX
On HA side, I have the Integrations card "Somfy Home Assistant Cloud" but still no entities and same error 404 in logs
2020-10-30 08:39:22 INFO (MainThread) [homeassistant.components.somfy.config_flow] Successfully authenticated
2020-10-30 08:39:26 WARNING (MainThread) [homeassistant.components.somfy] Cannot update devices: 404
I do have the same issue. I am using the embedeed/native feature but I got the 404 error.
Hey!
Same issue there, it worked fine, and (don't ask me why) I deleted the somfy integration, I tried to add it again and got the same issue.
WARNING (MainThread) [homeassistant.components.somfy] Cannot update devices: 404
Wait for the next release, there was a refactor of the component. Perhaps it will help in your case.
I've just tried on https://developer.somfy.com/somfy-open-api/apis/ and I got this famous error 404 when I want to retrieve my devices. So the issue is clearly on Somfy side, again.
I've just tried on https://developer.somfy.com/somfy-open-api/apis/ and I got this famous error 404 when I want to retrieve my devices. So the issue is clearly on Somfy side, again.
same here
Same problem for me 馃憤
yes mee too, but yesturday it worked.
Where we must complain against somfy ? :)
I contacted their support. Usually, they answer me when there is an issue.
@totothekiller Issue has been fixed on Somfy side. You can now close this ticket if you can confirm it works for you. On my side, it's good.
Same :)
it works on https://developer.somfy.com/somfy-open-api/apis/ for me : HTTP/1.1 200 OK
but still 404 on HA
Logger: homeassistant.components.somfy
Source: components/somfy/__init__.py:182
Integration: Somfy (documentation, issues)
First occurred: 17:29:02 (1 occurrences)
Last logged: 17:29:02
Cannot update devices: 404
Hello,
I have updated to HA 0.117.5, deleted the Somfy, and retry to add... still same issue
Logger: homeassistant.components.somfy
Source: components/somfy/__init__.py:182
Integration: Somfy (documentation, issues)
First occurred: 10:55:45 AM (2 occurrences)
Last logged: 11:04:59 AM
Cannot update devices: 40
Same as @BenFR23 , it's working on developer.somfy.com
It is possible to show the exact URL that raise the 404 error ?
Ok I have found the cause. It's related to the pymfy lib.
I have tested this lib with my credential according to the example usage and I get the same error 404.
devices = api.get_devices(category=Category.ROLLER_SHUTTER)
File "/Users/totothekiller/PycharmProjects/somfy/venv/lib/python3.9/site-packages/pymfy/api/somfy_api.py", line 65, in get_devices
response.raise_for_status()
File "/Users/totothekiller/PycharmProjects/somfy/venv/lib/python3.9/site-packages/requests/models.py", line 941, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.somfy.com/api/v1/site/XXXXX/device
My analysis :
I have multiple _siteId_ in my account. But I don't have devices available for all sites.
So the request GET /site/XXXXX/device fails with a 404 error. But the pymfy lib stops and raise this 404 error. (See here).
@tetienne I think that is an issue with pymfy lib ? Do you want me to create an issue on the lib side ?
@totothekiller oh nice catch. An issue on the pymfy repository would be welcome indeed.
Can you in this issue attached the results you get on the Somfy developer website, I will use them to enhance the tests.
@tetienne here is the result from developer website :
GET /api/v1/site/XXXX-XXXXX-XXXXX-XXXXX/device HTTP/1.1
HTTP/1.1 404 Not Found
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 67
Content-Type: application/json; charset=utf-8
Date: Sun, 08 Nov 2020 11:48:13 GMT
Etag: xxxxxx
{
"uid": "XXXXX",
"message": "definition_not_found",
"data": null
}
Same here, 2 sites ID, one without device.
@totothekiller Can you tell me what's the UID value is? It's the site id or another thing?
for me it's the side Id we get when we use the site API GetAllUserSite
this API returns to me the two sites (tahoma + alarm)
[
{
"id": "XXXXXXXXXXXXXXXXXX",
"label": "TaHoma"
},
{
"id": "YYYYYYYYYYYYYYYYYY",
"label": "Alarme"
}
]
Thx @BenFR23 I'm working on a fix. Should be easy to do it ;)
can we push your commit in home assistant before the official update ? (I use Hassio)
@BenFR23 I don't know if this possible, but I guess you can create a custom component that just update the manifest file. You can see my fix here.
Most helpful comment
Thx @BenFR23 I'm working on a fix. Should be easy to do it ;)