mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-10 19:06:55 +00:00
Add history_stats "type" parameter (#2204)
This commit is contained in:
parent
436d9d48d0
commit
eac242642d
@ -34,6 +34,7 @@ sensor:
|
|||||||
name: Lamp ON today
|
name: Lamp ON today
|
||||||
entity_id: light.my_lamp
|
entity_id: light.my_lamp
|
||||||
state: 'on'
|
state: 'on'
|
||||||
|
type: time
|
||||||
start: '{% raw %}{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}{% endraw %}'
|
start: '{% raw %}{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}{% endraw %}'
|
||||||
end: '{% raw %}{{ now() }}{% endraw %}'
|
end: '{% raw %}{{ now() }}{% endraw %}'
|
||||||
```
|
```
|
||||||
@ -43,6 +44,7 @@ Configuration variables:
|
|||||||
- **entity_id** (*Required*): The entity you want to track
|
- **entity_id** (*Required*): The entity you want to track
|
||||||
- **state** (*Required*): The state you want to track
|
- **state** (*Required*): The state you want to track
|
||||||
- **name** (*Optional*): Name displayed on the frontend
|
- **name** (*Optional*): Name displayed on the frontend
|
||||||
|
- **type** (*Optional*): The type of sensor: `time`, `ratio`, or `count`. Defaults to `time`
|
||||||
- **start**: When to start the measure (timestamp or datetime).
|
- **start**: When to start the measure (timestamp or datetime).
|
||||||
- **end**: When to stop the measure (timestamp or datetime)
|
- **end**: When to stop the measure (timestamp or datetime)
|
||||||
- **duration**: Duration of the measure
|
- **duration**: Duration of the measure
|
||||||
@ -55,6 +57,14 @@ Configuration variables:
|
|||||||
You can use [template extensions](/topics/templating/#home-assistant-template-extensions) such as `now()` or `as_timestamp()` to handle dynamic dates, as shown in the examples below.
|
You can use [template extensions](/topics/templating/#home-assistant-template-extensions) such as `now()` or `as_timestamp()` to handle dynamic dates, as shown in the examples below.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
## {% linkable_title Sensor type %}
|
||||||
|
|
||||||
|
Depending on the sensor type you choose, the `history_stats` component can show different values:
|
||||||
|
|
||||||
|
- **time**: The default value, which is the tracked time, in hours
|
||||||
|
- **ratio**: The tracked time divided by the length of your period, as a percentage
|
||||||
|
- **count**: How many times the component you track was changed to the state you track
|
||||||
|
|
||||||
## {% linkable_title Time periods %}
|
## {% linkable_title Time periods %}
|
||||||
|
|
||||||
The `history_stats` component will execute a measure within a precise time period. You should always provide 2 of the following :
|
The `history_stats` component will execute a measure within a precise time period. You should always provide 2 of the following :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user