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

WRONG_THERMOSTAT_GROUP_MODE when setting temperature using script #180

Open
klemmchr opened this issue May 12, 2024 · 0 comments
Open

WRONG_THERMOSTAT_GROUP_MODE when setting temperature using script #180

klemmchr opened this issue May 12, 2024 · 0 comments

Comments

@klemmchr
Copy link

I have a script that sets the target temperature using values provided in fields.

alias: Apply Heating Schedule
sequence:
  - service: climate.set_temperature
    metadata: {}
    data:
      temperature: >-
        {{ states(high_temperature) if states(schedule) else
        states(low_temperature) }}
      hvac_mode: heat
    target:
      device_id: "{{ climate }}"
mode: single
icon: mdi:heating-coil
fields:
  climate:
    selector:
      device: {}
    name: Climate
    required: true
  schedule:
    selector:
      entity: {}
    name: Schedule
    required: true
  low_temperature:
    selector:
      entity: {}
    name: Low Temperature
    required: true
  high_temperature:
    selector:
      entity: {}
    name: High Temperature
    required: true

I trigger this using an automation

action:
  - service: script.apply_heating_schedule
    metadata: {}
    data:
      climate: dde7b091df566b25ebe905be81d3265e
      schedule: schedule.buro_heating_schedule
      low_temperature: input_number.buro_heating_low
      high_temperature: input_number.buro_heating_high

Upon execution I get an error from the integration

Logger: homeassistant.helpers.script.websocket_api_script
Source: helpers/script.py:501
First occurred: 11:36:31 PM (3 occurrences)
Last logged: 11:38:15 PM

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: SHC Error (message: API call returned non-OK result (code 400)!: b'{"@type":"JsonRestExceptionResponseEntity","errorCode":"WRONG_THERMOSTAT_GROUP_MODE","statusCode":400}')
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 654, in _service_handler
    response = await self._async_start_run(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 612, in _async_start_run
    script_result = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 643, in _async_run
    return await self.script.async_run(script_vars, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1731, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 503, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 533, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 913, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 713, in async_set_temperature
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/bosch_shc/climate.py", line 167, in set_temperature
    self._device.setpoint_temperature = float(round(temperature * 2.0) / 2.0)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/boschshcpy/models_impl.py", line 517, in setpoint_temperature
    self._roomclimatecontrol_service.setpoint_temperature = temperature
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/boschshcpy/services_impl.py", line 74, in setpoint_temperature
    self.put_state_element("setpointTemperature", value)
  File "/usr/local/lib/python3.12/site-packages/boschshcpy/device_service.py", line 58, in put_state_element
    self.put_state({key: value})
  File "/usr/local/lib/python3.12/site-packages/boschshcpy/device_service.py", line 51, in put_state
    self._api.put_device_service_state(
  File "/usr/local/lib/python3.12/site-packages/boschshcpy/api.py", line 184, in put_device_service_state
    self._put_api_or_fail(api_url, state_update)
  File "/usr/local/lib/python3.12/site-packages/boschshcpy/api.py", line 102, in _put_api_or_fail
    self._process_nok_result(result)
  File "/usr/local/lib/python3.12/site-packages/boschshcpy/api.py", line 123, in _process_nok_result
    raise SHCSessionError(
boschshcpy.exceptions.SHCSessionError: SHC Error (message: API call returned non-OK result (code 400)!: b'{"@type":"JsonRestExceptionResponseEntity","errorCode":"WRONG_THERMOSTAT_GROUP_MODE","statusCode":400}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant