I have a very simple sensor that has as a state the days until the SSL cert expires. On that I have an automation that should send out a notification when the value drops below a certain value.
When parsing/reloading the sensor config I get the following error message in my logs:
Because it happens when you reload the command_line sensors it sounds a bit like the sensor disappears from HA for a moment when it reloads. But it that only happens on a reload I would just ignore it.
if the state was already below 90 when you created the automation it wonât trigger the automation because the state has to transition from above 90 to below 90.
to test it you should change the below value to something less that 80 (the current value you report) and see if it triggers when it gets below that value.
And if it does not work when it does fall below, can you check the history of the sensor? If the sensor goes 90 â unavailable â 89 it will probably miss it as well.
Oh thanks. I will check this out. I assumed âchangeâ meant it will check the trigger every time the state value changed. Not that it actually has to cross the threshold. I will set the value now to 100 via developer controls and then within 3 hours the sensor value should update.
Iâll report back.
@finity That was it. I changed it the state value via Developer tools above the threshold and then reloaded the sensor via YAML configuration reloading and it worked. The automation triggered and I got my notification.
@septillion Is onto something as well, since I not only got my notification but also the error message again. So I assume it went through unavailable during the reload of the YAML.
When I look at the history of the entity I only see a graph, so it is hard to see times of when it went through unavailable, but it seems to only pass through unavailable when reloading YAML by hand and not during ânormal operationsâ. (super tiny gap in the graph when I reloaded, but I canât see that gap every 3 hours when the sensor refreshes).
Not super easy to do but when you hoover over it, it will draw a dot for the update. If you also make a graph of just 3 hours instead of 24 you might be able to spot possible unavailable states.
You could also try to make an automation that makes a persistent notification which includes the state and trigger that when the state isnât a number.
Although having said that, the error looks more like the sensor is temporarily removed from HA when itâs reloaded which seems like a bug to me.
Youâre not the first person to make that assumption (and not the last). I have seen, and helped, numerous users understand how the Numeric State Trigger works. I am now convinced they either arenât reading its documentation or donât comprehend the meaning of its very first line:
Fires when the numeric value of an entityâs state (or attributeâs value if using the attribute property) crosses a given threshold.
What do you suggest the documentation say to make it clearer that it only triggers when crossing the threshold and not the way you assumed it would work?
I think it is a mix of both your suggestions and also I give you a 3rd option:
They are new to HA and read like 100 pages of documentation and are a bit swamped in information. I definitely remember being on that page and reading the âNOTEâ box below it. When starting out there is so much to learn/read that not everything can be 100 % parsed correctly. I think I went back to the page when my automation didnât work, but then I definitely didnât read again the first paragraph.
It is a lot of text and 1 single word âcrossesâ needs to be read, parsed and stored correctly. This is very hard to achieve when starting something new.
So my suggestion would be to put it into a NOTE or INFORMATION/CAVEAT box. And maybe have a 2nd sentence that just points to the importance of the meaning of crosses and give an example. The example that is actually in the NOTE below I remember reading and thinking âYeah⌠that is how I expect above/below to behaveâ. So I feel it would make more sense for an example of the threshold than of the normal language behavior of above/below.
The issue is that users appear to be misunderstanding, or ignoring, the significance of the word âcrossesâ. However, if you feel further clarification would help everyone then you are free to add it to the documentation. Anyone with a GitHub account can submit corrections/improvements. Your submission will be vetted by the development team.
Thing is, most people starting out just donât get the difference between a trigger (a single event with no duration) and a condition (a state that can be true for some time). Keeping that in mind for a trigger the âcrossesâ-part is just logical.
Iâm not sure how you could write that more clearly then it is now. Any idea on that as well?