Rest command error occured when calling ressource

Hi,

between some days i have some error whith my rest command :
:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:240
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 10:31:46 (1 occurrences)
Last logged: 10:31:46

[547109836736] Client error occurred when calling resource 'http://192.168.1.30/cgi-bin/domo.cgi?cmd=ON%20A1%20P10'
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 966, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/streams.py", line 622, in read
    await self._waiter
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_proto.py", line 224, in data_received
    messages, upgraded, tail = self._parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message:
  Expected HTTP/:

    b'OK'
      ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/rest_command/__init__.py", line 143, in async_service_handler
    async with getattr(websession, method)(
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1194, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 605, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 968, in start
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message="Expected HTTP/:\n\n  b'OK'\n    ^", url=URL('http://192.168.1.30/cgi-bin/domo.cgi?cmd=ON%20A1%20P10')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/rest_command/__init__.py", line 199, in async_service_handler
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Client error occurred when calling resource 'http://192.168.1.30/cgi-bin/domo.cgi?cmd=ON%20A1%20P10'

this is my switch to pass the order in my other box :

- platform: template
  switches:
    volet_cuisine:
      turn_on:
         service: rest_command.volet_cuisine_on
      turn_off:
         service: rest_command.volet_cuisine_off
rest_command:
# Volet Cuisine ON
  volet_cuisine_on:
    url: 'http://192.168.1.30/cgi-bin/domo.cgi?cmd=ON%20A1%20P10'
# Volet Cuisine OFF
  volet_cuisine_off:
     url: 'http://192.168.1.30/cgi-bin/domo.cgi?cmd=OFF%20A1%20P10'

Could you help me please ? I don’t find the solution …

Thanks

Hi, nobody could help me please ?

I’ve been having issues in the last days with one of my restful command. It worked for years and all of a sudden it stopped working. I’m thinking that an update broke it.

url: “http://192.168.0.37/?set=on” - this works
url: “http://192.168.0.37/?set=off” - this does not work anymore - if I access the link in a normal browser the command works

Any ideas? Anyone?

I have exactly the same problem. With a error message in each action…

Strange, someone could help us please ?

Same problem over here but with two restful commands in a row (in the same automation) the first one is well executed (but with an error in the log) and all following commands are neglected.

Same problem after upgrade to 2024.2.3.

Filed bug report

My problem was due to the target device responding with the obsolete HTTP/0.9 protocol. Home Assistant now reports an error on the unexpected response. Adding continue_on_error to the service call resolves the problem, although the log continues to record the error.

hello @BobS

i have the same problem for my switch :grinning:

# ON/OFF OLD RADIO
  - platform: template
    switches:
      old_radio_macro:
        unique_id: old_radio_macro
        turn_on:
          service: switch.turn_on
          target:
            entity_id: switch.on_off_old_radio
        turn_off:
        - service:  rest_command.turn_off_http_old_radio
        - delay: '00:03:00'
        - service: switch.turn_off
          target:
            entity_id: switch.on_off_old_radio

in my case where i add " continue_on_error" ligne please