Curl command_line integration fails

Hi,
I am running HA OS on a pi4
I have various other command_line integrations that call a curl:

If I call this from the HA command line, it works fine

In the logs, it often does not - but frustratingly sometimes it works fine

Logger: homeassistant.components.command_line.switch
Source: components/command_line/switch.py:133
Integration: command_line (documentation, issues)
First occurred: 07:15:15 (2 occurrences)
Last logged: 17:15:15
Command failed: curl --retry 5 http://various_urls

Any ideas? I can see this question has come up in the past, but not sure it was ever resolved…

I suppose that curl is not installed in the “homeassitant container”.
You could turn to pyscript, appdaemon, netdaemon to run in a container where you can install extra packets including curl.

I used AppDaemon recently to install all the stuff needed to run python using selenium with chromium in the Alpine Linux based container.

Thanks
this post:

Suggests that curl likely is available

However, this post looks like I can debug the problem:

I did a quick implementation of how this can work with AppDaemon:

It’s a generic AppDaemon module that you can use to call pretty much any command available in AppDaemons container. The script.yaml file shows two examples with an ls on different directories and outputting to different logs.

With the following AppDaemon configuration you should have access to curl.

init_commands: []
python_packages: []
system_packages:
  - curl

Note: you can add an ‘event’ parameter to provide an event name such as ‘call_script1’ and then add an automation:

alias: DemoScript1
description: ''
trigger:
  - platform: time_pattern
    minutes: '45'
    hours: '1'
condition: []
action:
  - event: call_script1
    event_data: {}
mode: single
1 Like

Thanks!
I tried the details here:

This seemed to confirm that curl should work…but I will definitely give your idea a look as well - thanks very much!