Change your command_line sensor to use curl instead of /usr/bin/curl.
It may still fail because I found a few threads (here’s one) stating that the version of grep used by hass.io does not support all options (you are using -oPm1). Some of these threads are over a year old so this limitation may have been eliminated. Maybe.
I just checked on my system and it appears that curl is located at usr/bin/curl, but grep that comes with hassio doesn’t support the -P option (the other options are):
OK, you’re testing it in ubuntu (a feature-complete installation of Linux) and then mistakenly assuming it will work equally well on Hass.io (a slimmed down installation of Linux). No worries, it’s a common assumption but, as you’ve seen, a bit too optimistic.
Please post the configuration of your command_line sensor.
In ubuntu it returns a number (percentage)
The IP address is my printer and that returns a large XML file with lots of status in it.
I was going to try scrape sensor as I have used on other sites but the webpage has bargraphs of the levels and not text to scrape.
If you included the -P option, it will fail because that’s not supported in Hass.io’s version of grep. If you leave it out, odds are the grep command won’t process the xml file correctly (and produce a result containing more than 255 characters which Home Assistant will reject because that the limit of what it will store in an entity’s state).
This problem was encountered by someone else and they resolved it by employing grep and sed (stream editor).
However, it’s not a simple solution because you have to specify appropriate commands for sed to process the xml correctly.
Here is the value template for the sensor to extract a specified portion of that result:
{% set status = value | regex_findall_index('<motionDetectAlarm>(.*)</motionDetectAlarm>') %}
{% if status == '0' %}
Disabled
{%- elif status == "1" -%}
None
{%- elif status == "2" -%}
Detected
{%- endif -%}
and be aware also that depending on the install method hassio might not be able to natively run curl commands on the host without additional configuration.