mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 17:27:19 +00:00
Clarify command_line runtime environment (#19150)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
599653d89f
commit
1230df26a3
@ -74,6 +74,18 @@ command_timeout:
|
|||||||
default: 15
|
default: 15
|
||||||
{% endconfiguration %}
|
{% endconfiguration %}
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
The `command` is executed within the [configuration directory](/docs/configuration/).
|
||||||
|
|
||||||
|
<div class='note'>
|
||||||
|
|
||||||
|
If you are using [Home Assistant Operating System](https://github.com/home-assistant/operating-system), the commands are executed in the `homeassistant` container context. So if you test or debug your script, it might make sense to do this in the context of this container to get the same runtime environment.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
With a `0` exit code, the output (stdout) of the command is used as `value`. In case a command results in a non `0` exit code or is terminated by the `command_timeout`, the result is only logged to Home Assistant log and the sensors value is not updated.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
In this section you find some real-life examples of how to use this sensor.
|
In this section you find some real-life examples of how to use this sensor.
|
||||||
|
@ -56,6 +56,18 @@ json_attributes:
|
|||||||
type: [string, list]
|
type: [string, list]
|
||||||
{% endconfiguration %}
|
{% endconfiguration %}
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
The `command` is executed within the [configuration directory](/docs/configuration/).
|
||||||
|
|
||||||
|
<div class='note'>
|
||||||
|
|
||||||
|
If you are using [Home Assistant Operating System](https://github.com/home-assistant/operating-system), the commands are executed in the `homeassistant` container context. So if you test or debug your script, it might make sense to do this in the context of this container to get the same runtime environment.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
With a `0` exit code, the output (stdout) of the command is used as `value`. In case a command results in a non `0` exit code or is terminated by the `command_timeout`, the result is only logged to Home Assistant log and the value of the sensor is not updated.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
In this section you find some real-life examples of how to use this sensor.
|
In this section you find some real-life examples of how to use this sensor.
|
||||||
@ -189,3 +201,4 @@ sensor:
|
|||||||
```
|
```
|
||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
|
@ -39,6 +39,16 @@ Any service data passed into the service call to activate the shell command will
|
|||||||
|
|
||||||
`stdout` and `stderr` output from the command are both captured and will be logged by setting the [log level](/integrations/logger/) to debug.
|
`stdout` and `stderr` output from the command are both captured and will be logged by setting the [log level](/integrations/logger/) to debug.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
|
||||||
|
The `command` is executed within the [configuration directory](/docs/configuration/).
|
||||||
|
|
||||||
|
<div class='note'>
|
||||||
|
If you are using [Home Assistant operating system](https://github.com/home-assistant/operating-system), the commands are executed in the `homeassistant` container context. So if you test or debug your script, it might make sense to do this in the context of this container to get the same runtime environment.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
With a `0` exit code, the output (stdout) of the command is used as `value`. In case a command results in a non `0` exit code or is terminated by the `command_timeout`, the result is only logged to Home Assistant log and the value of the sensor is not updated.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
### Defining multiple shell commands
|
### Defining multiple shell commands
|
||||||
|
Loading…
x
Reference in New Issue
Block a user