I recently purchased a Dome Mouser z-wave electric mouse trap on Ebay (unopened box).
It is designed to send a notification when a mouse has been trapped so you can take care of the poor mouse once trap does its business.
Unfortunately, when a mouse is exterminated, non of the entities with that z-wave device change (although by the instructions, there is a “tripped” entity, but it isn’t changing. It only changes when you turn the power on and off.
Looking at the z-wave log for this device, I do see the following message when a mouse is caught:
Logbook
December 6, 2024
Basement Mouse Trap fired Notification CC 'notification' event 'Pest Control': 'Pest exterminated'
9:49:17 AM - 44 minutes ago
I thought device logs are stored in the system log file (home-assistant log), but I am not seeing this message there. Is there another place it is located, and is there a way to trip an automation when the above message comes in?
I saw under the system_log integration, you can create a trigger based on a message. in the description, the following is used as an example:
automation:
- alias: "Create notifications for 'action' errors"
triggers:
- trigger: event
event_type: system_log_event
conditions:
- condition: template
value_template: '{{ "action" in trigger.event.data.message[0] }}'
actions:
- action: persistent_notification.create
data:
title: "Something bad happened"
message: "{{ trigger.event.data.message[0] }}"
With me changing the above to be the following for my situation:
alias: Mouse Trap Tripped
description: ""
triggers:
- trigger: event
event_type: system_log_event
conditions:
- condition: state
entity_id: input_boolean.manual_override
state: "off"
- condition: template
value_template: "{{ \"Pest exterminated\" in event.data.message[0] }}"
actions:
- action: persistent_notification.create
data:
title: "Mouse has been caught"
message: "{{ trigger.event.data.message[0] }}"
mode: single
(I actually am doing something different than above for the action, but am keeping it the same to match the example)
the above isn’t working since I am not noticing this log entry message for the device being stored there. Possibly because of the configuration I have for log files in configuration.yaml:
logger:
default: warning
logs:
homeassistant.components.media_player: error
homeassistant.components.ring: error
homeassistant.loader: error
denonavr.soundmode: error
custom_components.hacs: error
If I change the logging for z-wave devices to be all, I am concerned that I would be getting too many messages. If not, would the proper syntax be:
homeassistant.components.z-wave_js: info
???
Is there a better way to act on a log message being reported by a particular z-wave device than I am outlining above (that would work)?
Any help would be much appreciated.