HI,
using this automation
automation:
- alias: 'Send notification upon failed login attempt'
id: 'Send notification upon failed login attempt'
initial_state: 'on'
trigger:
platform: state
entity_id: persistent_notification.httplogin
condition:
- condition: template
value_template: >
{{ trigger.to_state.state != 'off' and
trigger.to_state.state == 'notifying'}}
- condition: template
value_template: >
{{ is_state('input_boolean.notify_system', 'on')}}
action:
service: notify.notify
data_template:
message: >
{% set message = states.persistent_notification.httplogin.attributes.message %}
{{ as_timestamp(now()) | timestamp_custom('%d %b: %X') }}: {{ message }}
Track offending ip on http://www.ip-tracker.org/locator/ip-lookup.php?ip={{ message.split('from ')[1] }}
title: >
{% set title = states.persistent_notification.httplogin.attributes.title %}
{{ title }}
tried the template with trigger.to_state:
data_template:
message: >
{% set message = trigger.to_state.attributes.message %}
{{ as_timestamp(now()) | timestamp_custom('%d %b: %X') }}: {{ message }}
Track offending ip on http://www.ip-tracker.org/locator/ip-lookup.php?ip={{ message.split('from ')[1] }}
title: >
{% set title = trigger.to_state.attributes.title %}
{{ title }}
or the state_attr():
data_template:
message: >
{% set message = state_attr('persistent_notification.httplogin','message') %}
{{ as_timestamp(now()) | timestamp_custom('%d %b: %X') }}: {{ message }}
Track offending ip on http://www.ip-tracker.org/locator/ip-lookup.php?ip={{ message.split('from ')[1] }}
title: >
{% set title = state_attr('persistent_notification.httplogin','title') %}
{{ title }}
but using that won’t fire the action…
isn’t that possible with persistent notifications?
secondly Id like to have the url as clickable link in the notification, right now the full url is displayed.
Id like it to show as
click[here](http://www.ip-tracker.org/locator/ip-lookup.php?ip={{ message.split('from ')[1] }}) to track the offender
but that won’t even work in this editor …:
please have a look?