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:
haakon storm heen 2019-09-02 10:22:59 +02:00 committed by Fabian Affolter
parent 9caf16ac17
commit 7e2b90f782

View File

@ -23,9 +23,8 @@ counter:
```
{% configuration %}
# 'alias' should be replaced by the user for their actual value.
"[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
type: map
keys:
@ -120,3 +119,37 @@ Select <img src='/images/screenshots/developer-tool-services-icon.png' alt='serv
"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
```