core: Netatmo integration - Error when changing preset option of a valve

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 15 (4 by maintainers)

Most upvoted comments

@cgtobi Thx for fixing 😃

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