Rest_command erreur

le noob que je suis ne sais pas vider les appels et vérifier les journaux…

pour voir les journaux c’est dans
Paramètres → système → journaux
Tout en bas tu as un bouton « nettoyer » pour vider tout. Ensuite tu active ton switch pour provoquer l’erreur et tu reviens sur les journaux et si rien n’est affiché tu cliques sur la flèche circulaire en haut a droite

Merci pour le tuyau

Désolé les journaux sont énormes même après nettoyage, j’éspère ne pas m’être trompé

voici les journaux :

pour la première erreur :

Enregistreur: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:239
intégration: Home Assistant WebSocket API (documentation, problèmes)
S’est produit pour la première fois: 15:17:21 (1 occurrences)
Dernier enregistrement: 15:17:21

[140019313345856] Client error occurred when calling resource ‹ http://192.168.0.28/plugins/max2play_settings/controller/Basic.php?action=shutdown ›
Traceback (most recent call last):
File « /usr/src/homeassistant/homeassistant/components/rest_command/init.py », line 142, 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 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
aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected

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 239, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File « /usr/src/homeassistant/homeassistant/core.py », line 2319, in async_call
response_data = await coro
^^^^^^^^^^
File « /usr/src/homeassistant/homeassistant/core.py », line 2356, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File « /usr/src/homeassistant/homeassistant/helpers/service.py », line 905, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File « /usr/src/homeassistant/homeassistant/helpers/service.py », line 975, in _handle_entity_call
result = await task
^^^^^^^^^^
File « /usr/src/homeassistant/homeassistant/components/template/switch.py », line 168, in async_turn_off
await self.async_run_script(self._off_script, context=self._context)
File « /usr/src/homeassistant/homeassistant/components/template/template_entity.py », line 562, in async_run_script
await script.async_run(
File « /usr/src/homeassistant/homeassistant/helpers/script.py », line 1600, in async_run
return await asyncio.shield(run.async_run())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File « /usr/src/homeassistant/homeassistant/helpers/script.py », line 435, in async_run
await self._async_step(log_exceptions=False)
File « /usr/src/homeassistant/homeassistant/helpers/script.py », line 487, in _async_step
self._handle_exception(
File « /usr/src/homeassistant/homeassistant/helpers/script.py », line 512, in _handle_exception
raise exception
File « /usr/src/homeassistant/homeassistant/helpers/script.py », line 485, in _async_step
await getattr(self, handler)()
File « /usr/src/homeassistant/homeassistant/helpers/script.py », line 723, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File « /usr/src/homeassistant/homeassistant/helpers/script.py », line 685, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File « /usr/src/homeassistant/homeassistant/core.py », line 2319, in async_call
response_data = await coro
^^^^^^^^^^
File « /usr/src/homeassistant/homeassistant/core.py », line 2356, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File « /usr/src/homeassistant/homeassistant/components/rest_command/init.py », line 198, in async_service_handler
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Client error occurred when calling resource ‹ http://192.168.0.28/plugins/max2play_settings/controller/Basic.php?action=shutdown ›

Pour la deuxième :

Enregistreur: homeassistant.helpers.script.old_radio_macro
Source: helpers/script.py:1805
S’est produit pour la première fois: 15:17:21 (1 occurrences)
Dernier enregistrement: 15:17:21

old_radio_macro: Error executing script. Error for call_service at pos 1: Client error occurred when calling resource ‹ http://192.168.0.28/plugins/max2play_settings/controller/Basic.php?action=shutdown ›

Voir section Restful :wink:

Merci Krull

j’avais vu ce truc de « continue_on_error » mais tu connais mon niveau basique, je ne serais même pas ou l’intégrer et à quelle ligne … :smirk:

Dans un script ou une automation :thinking: Du coup je ne sais pas ^^’
@Krull56 peux-tu nous dire? Est-il possible de le mettre directement dans la config du switch ?

Aucune idée malheureusement.
Faut tester :wink:

Je l’ajouterai bien après turn on et turn off avant la ligne service :

Ou sinon tu revois le code de ton esp radio pour qu’il utilise le bon protocole web :grin:

J’avais déjà regardé de ce côté, mais impossible, le software n’est plus mis à jour depuis plus de quatre ans malheureusement.
C’est une base Linux installé sur un Pi0 pour du Multi Room, tu sais la fameuse old radio :joy:

Oh que oui que je m’en souviens :rofl:

Fais des essais avec le continue on error.

Surtout n’oublie pas de lancer une vérif de la configuration avant de redémarrer :wink:

je galère chaque ligne est en erreur sur la verif de configuration :upside_down_face:

# 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

je viens de faire un test en ajoutant le continue on error sur un switch fictif et pas d’erreur de validation ( mais je ne sais pas si ça fonctionne :wink: )

switch:
  - platform: template
    switches:
      testswitch:
        turn_on:
          continue_on_error: true
          service: switch.turn_on
          target:
            entity_id: switch.inter_bibli
        turn_off:
          continue_on_error: true
          service: switch.turn_off
          target:
            entity_id: switch.inter_bibli

je dois être un gros poissard moi :sweat_smile:


Bon j’ai trouvé, enfin cela a fonctionné

Merci @Frosh et @Krull56

Voici le script utilisé

# 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
          continue_on_error: true
          data: {}
        - delay: '00:03:00'
        - service: switch.turn_off
          target:
            entity_id: switch.on_off_old_radio

je me suis aidé via ce topic :

1 « J'aime »

Donc la piste était bonne :grin:

Bonne fin de weekend petit scarabée :wink:

Merci encore , mieux que bonne … je dirais efficace :wink:

Et tu vas pouvoir donner la réponse sur l’autre post :grin:

Excellente nouvelle !!! :wink:

Carrément… merci encore pour ton aide

1 « J'aime »