mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 07:17:14 +00:00
sensor.command_line: Round example CPU temperature value (#5032)
* sensor.command_line: Round example CPU temperature value multiply returns a float, which is inexact and sometimes gets rendered with a lot of decimal places. Round additionally to get cleaner result. * Move raw
This commit is contained in:
parent
338eeb2295
commit
f8393f0659
@ -61,6 +61,7 @@ sensor:
|
|||||||
|
|
||||||
Thanks to the [`proc`](https://en.wikipedia.org/wiki/Procfs) file system, various details about a system can be retrieved. Here the CPU temperature is of interest. Add something similar to your `configuration.yaml` file:
|
Thanks to the [`proc`](https://en.wikipedia.org/wiki/Procfs) file system, various details about a system can be retrieved. Here the CPU temperature is of interest. Add something similar to your `configuration.yaml` file:
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
sensor:
|
sensor:
|
||||||
@ -69,8 +70,9 @@ sensor:
|
|||||||
command: "cat /sys/class/thermal/thermal_zone0/temp"
|
command: "cat /sys/class/thermal/thermal_zone0/temp"
|
||||||
# If errors occur, remove degree symbol below
|
# If errors occur, remove degree symbol below
|
||||||
unit_of_measurement: "°C"
|
unit_of_measurement: "°C"
|
||||||
value_template: '{% raw %}{{ value | multiply(0.001) }}{% endraw %}'
|
value_template: '{{ value | multiply(0.001) | round(1) }}'
|
||||||
```
|
```
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
### {% linkable_title Monitoring failed login attempts on Home Assistant %}
|
### {% linkable_title Monitoring failed login attempts on Home Assistant %}
|
||||||
|
|
||||||
@ -149,11 +151,13 @@ sensor:
|
|||||||
|
|
||||||
[Templates](/docs/configuration/templating/) are supported in the `command:` configuration variable. This could be used if you want to include the state of a specific sensor as an argument to your external script.
|
[Templates](/docs/configuration/templating/) are supported in the `command:` configuration variable. This could be used if you want to include the state of a specific sensor as an argument to your external script.
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
sensor:
|
sensor:
|
||||||
- platform: command_line
|
- platform: command_line
|
||||||
name: wind direction
|
name: wind direction
|
||||||
command: 'sh /home/pi/.homeassistant/scripts/wind_direction.sh {% raw %}{{ states.sensor.wind_direction.state }}{% endraw %}'
|
command: 'sh /home/pi/.homeassistant/scripts/wind_direction.sh {{ states.sensor.wind_direction.state }}'
|
||||||
unit_of_measurement: "Direction"
|
unit_of_measurement: "Direction"
|
||||||
```
|
```
|
||||||
|
{% endraw %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user