Skip to content

Commit

Permalink
Counting warnings and erros in HA system #80
Browse files Browse the repository at this point in the history
  • Loading branch information
BeardedTinker committed Jan 13, 2022
1 parent 39c7950 commit 64c2c5f
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
34 changes: 34 additions & 0 deletions automations/system/ha_log_event_trigger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#####
# Triggers when there is new warning or error
# https://community.home-assistant.io/t/counter-warning-error-issue/85490/11
#####

alias: Count Home Assistant errors
id: 'c057ca2c-ab20-4fe0-a32b-5980c0990fb2'

trigger:
- platform: event
event_type: system_log_event
event_data:
level: ERROR
id: error
- platform: event
event_type: system_log_event
event_data:
level: WARNING
id: warning

action:
- choose:
- conditions:
- condition: trigger
id: warning
sequence:
- service: counter.increment
entity_id: counter.homeassistant_warnings
- conditions:
- condition: trigger
id: error
sequence:
- service: counter.increment
entity_id: counter.homeassistant_errors
9 changes: 9 additions & 0 deletions entities/counter/ha_error_counter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#####
# Counting number of errors in HA
#
#####

homeassistant_errors:
name: Errors
icon: mdi:alert-octagram
restore: false
9 changes: 9 additions & 0 deletions entities/counter/ha_warning_counter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#####
# Counting number of warnings in HA
#
#####

homeassistant_warnings:
name: Warnings
icon: mdi:alert
restore: false
7 changes: 7 additions & 0 deletions integrations/system_log.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#####
# Using this integration to trigger events for log entries
# https://www.home-assistant.io/integrations/system_log/
#####

system_log:
fire_event: true

0 comments on commit 64c2c5f

Please sign in to comment.