Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netatmo integration - Error when changing preset option of a valve #79980

Closed
giulio12 opened this issue Oct 10, 2022 · 15 comments · Fixed by #80700
Closed

Netatmo integration - Error when changing preset option of a valve #79980

giulio12 opened this issue Oct 10, 2022 · 15 comments · Fixed by #80700
Assignees

Comments

@giulio12
Copy link

giulio12 commented Oct 10, 2022

The problem

Error 400 is returned when I try to change the preset function of a Netatmo valve:
Options available are
-Scheduled
-Boost
-Away
-Frost Guard

When I select Away and Frost Guard I get the error reported in the log below, Boost is working and schedule is not doing anything (e.g.: after set to bost, if scheduled is selected the status will remain to boost).

What version of Home Assistant Core has the issue?

2022.10.2

What was the last working version of Home Assistant Core?

unknown

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Netatmo

Link to integration documentation on our website

No response

Diagnostics information

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.10.2",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Zurich",
    "os_name": "Linux",
    "os_version": "5.15.61-v8",
    "supervisor": "2022.09.1",
    "host_os": "Home Assistant OS 9.0",
    "docker_version": "20.10.17",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "alexa_media": {
      "version": "4.0.3",
      "requirements": [
        "alexapy==1.26.1",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "adaptive_lighting": {
      "version": "1.1.0",
      "requirements": []
    },
    "hacs": {
      "version": "1.25.5",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    }
  },
  "integration_manifest": {
    "domain": "netatmo",
    "name": "Netatmo",
    "documentation": "https://www.home-assistant.io/integrations/netatmo",
    "requirements": [
      "pyatmo==7.1.1"
    ],
    "after_dependencies": [
      "cloud",
      "media_source"
    ],
    "dependencies": [
      "application_credentials",
      "webhook"
    ],
    "codeowners": [
      "@cgtobi"
    ],
    "config_flow": true,
    "homekit": {
      "models": [
        "Healty Home Coach",
        "Netatmo Relay",
        "Presence",
        "Welcome"
      ]
    },
    "iot_class": "cloud_polling",
    "loggers": [
      "pyatmo"
    ],
    "supported_brands": {
      "legrand": "Legrand",
      "bubendorff": "Bubendorff",
      "smarther": "Smarther",
      "bticino": "BTicino"
    },
    "is_built_in": true
  },
  "data": {
    "info": {
      "entry_id": "bbea786bdeb552df2726d69aa1abe46f",
      "version": 1,
      "domain": "netatmo",
      "title": "Home Assistant Cloud",
      "data": {
        "auth_implementation": "cloud",
        "token": {
          "scope": [
            "access_camera",
            "access_presence",
            "read_bubendorff",
            "read_camera",
            "read_carbonmonoxidedetector",
            "read_homecoach",
            "read_magellan",
            "read_mx",
            "read_presence",
            "read_smarther",
            "read_smokedetector",
            "read_station",
            "read_thermostat",
            "write_bubendorff",
            "write_camera",
            "write_magellan",
            "write_mx",
            "write_presence",
            "write_smarther",
            "write_thermostat"
          ],
          "access_token": "**REDACTED**",
          "expires_in": 10800,
          "expire_in": 10800,
          "refresh_token": "**REDACTED**",
          "restricted_access_token": "**REDACTED**",
          "restricted_refresh_token": "**REDACTED**",
          "service": "netatmo",
          "expires_at": 1665389410.8327055
        },
        "webhook_id": "**REDACTED**",
        "cloudhook_url": "**REDACTED**"
      },
      "options": {},
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": "netatmo",
      "disabled_by": null,
      "webhook_registered": false
    },
    "data": {
      "account": {
        "homes": [
          {
            "id": "6237674dd81bcf32e350fdb8",
            "name": "**REDACTED**",
            "altitude": 274,
            "coordinates": "**REDACTED**",
            "country": "CH",
            "timezone": "Europe/Zurich",
            "rooms": [
              {
                "id": "1860811843",
                "name": "**REDACTED**",
                "type": "bathroom",
                "module_ids": [
                  "09:00:00:17:d7:99"
                ]
              },
              {
                "id": "1863566932",
                "name": "**REDACTED**",
                "type": "bathroom",
                "module_ids": [
                  "09:00:00:16:55:ab"
                ]
              },
              {
                "id": "2171462406",
                "name": "**REDACTED**",
                "type": "bathroom",
                "module_ids": [
                  "09:00:00:04:f1:81",
                  "09:00:00:15:bd:f9"
                ]
              },
              {
                "id": "1759922165",
                "name": "**REDACTED**",
                "type": "custom",
                "module_ids": [
                  "09:00:00:04:f1:54"
                ]
              },
              {
                "id": "4056484137",
                "name": "**REDACTED**",
                "type": "bathroom",
                "module_ids": [
                  "09:00:00:15:e0:ce"
                ]
              },
              {
                "id": "756056718",
                "name": "**REDACTED**",
                "type": "bathroom",
                "module_ids": [
                  "09:00:00:15:be:c6"
                ]
              },
              {
                "id": "3325801443",
                "name": "**REDACTED**",
                "type": "bathroom",
                "module_ids": [
                  "09:00:00:15:f4:6d"
                ]
              }
            ],
            "modules": [
              {
                "id": "70:ee:50:79:be:0a",
                "type": "NAPlug",
                "name": "**REDACTED**",
                "setup_date": 1647798093,
                "modules_bridged": [
                  "09:00:00:17:d7:99",
                  "09:00:00:04:f1:81",
                  "09:00:00:04:f1:54",
                  "09:00:00:15:bd:f9",
                  "09:00:00:16:55:ab",
                  "09:00:00:15:e0:ce",
                  "09:00:00:15:be:c6",
                  "09:00:00:15:f4:6d"
                ]
              },
              {
                "id": "09:00:00:17:d7:99",
                "type": "NRV",
                "name": "**REDACTED**",
                "setup_date": 1647798097,
                "room_id": "1860811843",
                "bridge": "70:ee:50:79:be:0a"
              },
              {
                "id": "09:00:00:04:f1:81",
                "type": "NRV",
                "name": "**REDACTED**",
                "setup_date": 1647811991,
                "room_id": "2171462406",
                "bridge": "70:ee:50:79:be:0a"
              },
              {
                "id": "09:00:00:04:f1:54",
                "type": "NRV",
                "name": "**REDACTED**",
                "setup_date": 1647812086,
                "room_id": "1759922165",
                "bridge": "70:ee:50:79:be:0a"
              },
              {
                "id": "09:00:00:15:bd:f9",
                "type": "NRV",
                "name": "**REDACTED**",
                "setup_date": 1649708736,
                "room_id": "2171462406",
                "bridge": "70:ee:50:79:be:0a"
              },
              {
                "id": "09:00:00:16:55:ab",
                "type": "NRV",
                "name": "**REDACTED**",
                "setup_date": 1665094965,
                "room_id": "1863566932",
                "bridge": "70:ee:50:79:be:0a"
              },
              {
                "id": "09:00:00:15:e0:ce",
                "type": "NRV",
                "name": "**REDACTED**",
                "setup_date": 1665095127,
                "room_id": "4056484137",
                "bridge": "70:ee:50:79:be:0a"
              },
              {
                "id": "09:00:00:15:be:c6",
                "type": "NRV",
                "name": "**REDACTED**",
                "setup_date": 1665095180,
                "room_id": "756056718",
                "bridge": "70:ee:50:79:be:0a"
              },
              {
                "id": "09:00:00:15:f4:6d",
                "type": "NRV",
                "name": "**REDACTED**",
                "setup_date": 1665095231,
                "room_id": "3325801443",
                "bridge": "70:ee:50:79:be:0a"
              }
            ],
            "temperature_control_mode": "heating",
            "therm_mode": "schedule",
            "therm_setpoint_default_duration": 180,
            "schedules": [
              {
                "timetable": "**REDACTED**",
                "zones": "**REDACTED**",
                "name": "",
                "default": false,
                "away_temp": 12,
                "hg_temp": 7,
                "id": "6237674dd81bcf32e350fdb9",
                "selected": true,
                "type": "therm"
              }
            ]
          }
        ],
        "errors": []
      }
    }
  }
}

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.websocket_api.http.connection
Source: components/netatmo/climate.py:318 
Integration: Home Assistant WebSocket API (documentation, issues) 
First occurred: 8:08:14 AM (3 occurrences) 
Last logged: 8:10:24 AM

[547654574688] 400 - Bad request - Invalid mode (21) when accessing 'https://api.netatmo.com/api/setroomthermpoint'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 202, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 207, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/netatmo/climate.py", line 318, in async_set_preset_mode
    await self._room.async_therm_set(PRESET_MAP_NETATMO[preset_mode])
  File "/usr/local/lib/python3.10/site-packages/pyatmo/room.py", line 111, in async_therm_set
    await self._async_set_thermpoint(mode, temp, end_time)
  File "/usr/local/lib/python3.10/site-packages/pyatmo/room.py", line 165, in _async_set_thermpoint
    await self.home.auth.async_post_api_request(
  File "/usr/local/lib/python3.10/site-packages/pyatmo/auth.py", line 351, in async_post_api_request
    return await self.async_post_request(
  File "/usr/local/lib/python3.10/site-packages/pyatmo/auth.py", line 389, in async_post_request
    raise ApiError(
pyatmo.exceptions.ApiError: 400 - Bad request - Invalid mode (21) when accessing 'https://api.netatmo.com/api/setroomthermpoint'

Additional information

No response

@homeassistant
Copy link
Contributor

Hey there @cgtobi, mind taking a look at this issue as it has been labeled with an integration (netatmo) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)


netatmo documentation
netatmo source
(message by IssueLinks)

@cgtobi
Copy link
Contributor

cgtobi commented Oct 10, 2022

Thanks for reporting. I'll take a look ASAP.

@maga80
Copy link

maga80 commented Oct 11, 2022

The same for 2022.10.3

@ArthurGarnier
Copy link

Can confirm, same issue here.
Screenshot_20221012-221825_Home Assistant

Seems to happen only with ''Frost Guard'' and ''Away'' presets.

@Toggz
Copy link

Toggz commented Oct 14, 2022

Same problem with me (UK). Unable to switch Presets (away, Frost Guard) and will not exit preset when forcing Schedules. Schedules do change though.

@sergiobrzs
Copy link

Hi,
Same problem with me (IT).

@stijink
Copy link

stijink commented Oct 15, 2022

Same here. @cgtobi Is there any way to help you on the issue ?

@stijink
Copy link

stijink commented Oct 15, 2022

It seems the API has changed. From what i can see in the API Documentation the /setroomtermpoint now only accepts the following parameters:

  • manual
  • max
  • home

See: https://dev.netatmo.com/apidocumentation/energy#setthermmode

Using the "manual" mode you could try to emulate the now missing modes. The away and frostguard modes now only seem to work for the whole house using /settermmode.

@sergiobrzs
Copy link

I've read the new API documentation.
But how can I integrate them into Home Assistant?

@maga80
Copy link

maga80 commented Oct 15, 2022

In 2022.9 all is correct, so maybe no API issue

@Toggz
Copy link

Toggz commented Oct 15, 2022

In 2022.9 all is correct, so maybe no API issue

Thanks Maga80! Hopefully a fix in 2022.10.5.... [fingers crossed]

@cgtobi
Copy link
Contributor

cgtobi commented Oct 15, 2022

Same here. @cgtobi Is there any way to help you on the issue ?

Thanks for the offer. I just haven't had time to investigate.

@maga80
Copy link

maga80 commented Oct 20, 2022

Hi @cgtobi , is there any update of the issue? Thnx a lot,

@cgtobi
Copy link
Contributor

cgtobi commented Oct 20, 2022

No, sorry, I haven't had time to work on this.

@stijink
Copy link

stijink commented Oct 21, 2022

@cgtobi Thx for fixing :-)

@github-actions github-actions bot locked and limited conversation to collaborators Nov 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants