mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-08-02 14:08:30 +00:00
Update counter.markdown (#10273)
* Update counter.markdown Added details for getting counters to work when counting errors, with example configuration. * ✏️ Tweak * ✏️ Tweak
This commit is contained in:
parent
9caf16ac17
commit
7e2b90f782
@ -23,9 +23,8 @@ counter:
|
|||||||
```
|
```
|
||||||
|
|
||||||
{% configuration %}
|
{% configuration %}
|
||||||
# 'alias' should be replaced by the user for their actual value.
|
|
||||||
"[alias]":
|
"[alias]":
|
||||||
description: Alias for the counter. Multiple entries are allowed.
|
description: Alias for the counter. Multiple entries are allowed. `alias` should be replaced by the user for their actual value.
|
||||||
required: true
|
required: true
|
||||||
type: map
|
type: map
|
||||||
keys:
|
keys:
|
||||||
@ -120,3 +119,37 @@ Select <img src='/images/screenshots/developer-tool-services-icon.png' alt='serv
|
|||||||
"entity_id": "counter.my_custom_counter"
|
"entity_id": "counter.my_custom_counter"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Counting Home Assistant errors
|
||||||
|
|
||||||
|
To use a counter to count errors as caught by Home Assistant, you need to add `fire_event: true` to your `configuration.yaml`, like so:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Example configuration.yaml entry
|
||||||
|
system_log:
|
||||||
|
fire_event: true
|
||||||
|
```
|
||||||
|
|
||||||
|
### Error counting - example configuration
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Example configuration.yaml entry
|
||||||
|
automation:
|
||||||
|
- id: 'errorcounterautomation'
|
||||||
|
alias: Error Counting Automation
|
||||||
|
trigger:
|
||||||
|
platform: event
|
||||||
|
event_type: system_log_event
|
||||||
|
event_data:
|
||||||
|
level: ERROR
|
||||||
|
action:
|
||||||
|
service: counter.increment
|
||||||
|
entity_id: counter.error_counter
|
||||||
|
|
||||||
|
counter:
|
||||||
|
error_counter:
|
||||||
|
name: Errors
|
||||||
|
icon: mdi:alert
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user