hi,
i have wrote this automation (a copy of one of my own, what runs successfully),
permanent notification is dismissed successfully, but the notify.notify is not cleared? but why?
i had copied it from another of mine, what runs successfully?
instead of clearing the message, it shows the message text “clear_notification”?
where is the error? pls help!
and a second question please: in my first automation, i had also used the tag feature in data: section , but i dont know what it is for? can i delete it?
and a third question please: is a time sensor.last_boot a good (save) option for triggering an automation? i wonder if in booting it take a couple of secons/minutes until hassio and all proeccessesare still running. could it be in this short period automation could not be triggered by any fault, or doesn´t it matter and i have to many complaints?
thank you in advance?
br
Frank
here mmy automation.
note: timepattern 6 second is only for debugging…
alias: Disc Usage Warning v2
description: ""
trigger:
- platform: time
at: sensor.last_boot
- platform: time_pattern
seconds: "6"
enabled: false
condition: []
action:
- service: notify.notify
data:
title: |
{% if states('sensor.disk_use_percent_config') | float > 80 %}
WARNING! Disk Usage is {{states('sensor.disk_use_percent_config')}} !!
{% else %}
{% endif %}
message: |
{% if states('sensor.disk_use_percent_config') | float > 80 %}
WARNING! Disk Usage is {{states('sensor.disk_use_percent_config')}} !!
{% else %}
clear_notification
{% endif %}
data:
ttl: 0
priority: high
tag: |
{% if states('sensor.disk_use_percent_config') | float > 80 %}
pnotify_disc_space_warning
{% endif %}
color: red
- service: persistent_notification.create
data:
title: |-
{% if states('sensor.disk_use_percent_config') | float > 80 %}
WARNING! Disk Usage is {{states('sensor.disk_use_percent_config')}} !!
{% else %}
nix
{% endif %}
message: |-
{% if states('sensor.disk_use_percent_config') | float > 80 %}
WARNING! Disk Usage is {{states('sensor.disk_use_percent_config')}} !!
{% else %}
{% endif %}
notification_id: pnotify_disc_space_warning
- service: persistent_notification.dismiss
data:
notification_id: |-
{% if states('sensor.disk_use_percent_config') | float < 80 %}
pnotify_disc_space_warning
{% endif%}
mode: single
hi,
examining my “source of copy” automation, i realized, that i hadn´t understood how an notification can be cleared… it shows the same behavior when runed with run command, but not in real environment…
but i think i have found my “missing-gap”…
somewhere in google i found the documentation, what says, that a notify.notify notification can only be cleared, when it has a tag…
so i changed my autom. as followed and it “seems” to run as expected…
now i´m struggling to use a variable or constand withing the automation for the disk-limit i want to monitor for (not still included in the example below), but if i will not get this running, i will start a new post…
thanx…
br
Frank
alias: Disc Usage Warning v2
description: ""
trigger:
- platform: time
at: sensor.last_boot
- platform: time_pattern
seconds: "6"
enabled: false
condition: []
action:
- service: notify.notify
data:
title: |
{% if states('sensor.disk_use_percent_config') | float > 80 %}
WARNING! Disk Usage is {{states('sensor.disk_use_percent_config')}} !!
{% else %}
Disk Usage is lower than 80% ({{states('sensor.disk_use_percent_config')}}) !!
{% endif %}
message: |
{% if states('sensor.disk_use_percent_config') | float > 80 %}
WARNING! Disk Usage is {{states('sensor.disk_use_percent_config')}} !!
{% else %}
clear_notification
{% endif %}
data:
ttl: 0
priority: high
tag: |
{% if states('sensor.disk_use_percent_config') | float > 80 %}
pnotify_disc_space_warning
{% else %}
pnotify_clear_warning
{% endif %}
color: red
- service: persistent_notification.create
data:
title: |-
{% if states('sensor.disk_use_percent_config') | float > 80 %}
WARNING! Disk Usage is {{states('sensor.disk_use_percent_config')}} !!
{% else %}
nix
{% endif %}
message: |-
{% if states('sensor.disk_use_percent_config') | float > 80 %}
WARNING! Disk Usage is {{states('sensor.disk_use_percent_config')}} !!
{% else %}
{% endif %}
notification_id: pnotify_disc_space_warning
- service: persistent_notification.dismiss
data:
notification_id: |-
{% if states('sensor.disk_use_percent_config') | float < 80 %}
pnotify_disc_space_warning
{% endif%}
mode: single
for testing purposes i had changed value states('sensor.disk_use_percent_config') from 80 to 38 (because actual disc usage is 40%), to test the notifications…
i enabled the second trigger, what fires each minute…
it creates a notification on mobile phone.
when i change he value back to 80 and save my automation, only the perstant note if dismissed, but the notify.notify stays?
do i already have an mistake in my automation, or could it be, that the scope of an notification tag, does not longer exist, when same automation is edited and saved once again?
sorry my statement about variable/constants was offtopic… for a next step i had tried to replace the ... float > 80 %} with an variable like ... float > {{variable}} %} to make changes for testing much more easier/faster… but i got an error about someting like “string not allowed or wrong…blablabla”… so i skipped this and tested by changing this value manually in code…
thanx , i know the usage of a number helper, but i see it much complicated to define a “global” helper “somewhere” else then the automation-script, just to use a variable or constant only for such automation?
i had expected something simple like in a declaration of variables in VB “Dim strVariable as String” whatever… .honestly i need more a constant than a variable… but only withing this automation…
i had tried to use something like described here…
variables:
var_disklimit: 40
to reuse var_disklimit in code… but it fails even by saving automation with the following error
i had tired the following as well, but with same error… declaration:
var_disklimit: ‘40’
var_disklimit: 40 usage:
{{var_disklimit}}
{{var_disklimit}} | float
@Didgeridrew’s point is a good one. not the cause of the error you’re asking about now… but it might slyly become an error down the road and might be hard to detect why… a good thing to clean up now…
sorry if I’m annoying, but i recognized, by automation never triggers by itself, although i restart hassio everyday?
i created this trigger via gui visual editor
for the automation in this thread i could simply use a fix time instead, but what is wrong with the last_boot trigger? couldn´t this be used as a trigger for automation anyhow, or i would have to use a last_boot +5minutes to get it run?
this is a totally different question than what you created this thread with right?
you should really start a new thread (and also pick the post that gave you the solution and mark it as “solution” … doing this will help your fellow community members.
on this particular new question… you are trying to trigger something on home assistant boot? if so, use something like this:
trigger:
- platform: homeassistant
event: start
your trigger should never happen… because sensor.last_boot always writes a past time… after it’s booted, it writes the time. since the time is always in the past, the trigger will never encounter it until it learns how to travel back in time…
sorry @armedad i wanna be impolite, it would be better i had started thread “help me with my automation”, to get all my upcoming questions in.
as i had answered my “initially” post starting question by myself with my second post, i should had to mark this as solution, or?.. i hesitated doing this, especially the thread had two questions and solutions (at the end three)…
nevertheless thanx for great help and inputs! I promise to do better now…
br Frank
no worries … generally best to ask a bunch of individual more specific questions., this is a resource for others … so if you ask a specific question and someone else has the same they may find their answer by seeing yours. If you have a very generic “help me with my 10 things” it becomes less useful for others.