core: Somfy : Cannot update devices: 404

The problem

Error when setup Somfy integration with Developper Account : no entities are imported and an error “Cannot update devices: 404” is raised

Environment

  • Home Assistant Core release with the issue: 0.117.0 (same issue on 0.116)
  • Last working Home Assistant Core release (if known): NA
  • Operating environment (OS/Container/Supervised/Core): HassOS 4.15 on Pi3
  • Integration causing this issue: Somfy
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/somfy/

Problem-relevant configuration.yaml

somfy:
  client_id: XXXX
  client_secret: YYYY

Traceback/Error logs

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

Additional information

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.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Thx @BenFR23 I’m working on a fix. Should be easy to do it 😉

@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
}

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 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.

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” } ]

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 ?

Wait for the next release, there was a refactor of the component. Perhaps it will help in your case.