Hi,
I’m stuck with setting up a notification automation.
I want the notification only to be send when the new state of the external ip is not the same as the one before. I set up a helper input text entity and configured it to update the external ip at the end of the automation to save the last state.
In the conditions i set the state to not match the helpers entity state. Only then i want to receive the notification.
the yaml of the condition:
condition: not
conditions:
- condition: state
entity_id: sensor.fritzbox21_external_ip
state: "{{states('input_text.saved_external_home_ip')}}"
enabled: false
- condition: state
entity_id: input_text.saved_external_home_ip
state: "{{states('sensor.fritzbox21_external_ip')}}"
I’ve tried both ways, of checking. It always says the state does not match and then fires the notification.
Is there anything I am not thinking of here?
Here is the complete yaml of the automation:
alias: Notify when IP changes
description: ""
trigger:
- platform: state
entity_id:
- sensor.fritzbox21_external_ip
attribute: state
condition:
- condition: not
conditions:
- condition: state
entity_id: sensor.fritzbox21_external_ip
state: unavailable
- condition: not
conditions:
- condition: state
entity_id: input_text.saved_external_home_ip
state: "{{states('sensor.fritzbox21_external_ip')}}"
- condition: not
conditions:
- condition: state
entity_id: sensor.fritzbox21_external_ip
state: unknown
action:
- service: notify.wolfgangs_notification_devices
data_template:
title: IP Adresse
message: "Neue IP Adresse ist: {{states('sensor.fritzbox21_external_ip')}}"
- service: input_text.set_value
data:
value: "{{states('sensor.fritzbox21_external_ip')}}"
target:
entity_id: input_text.saved_external_home_ip
mode: single
Would appreciate any help and hints
Thank you!