Illuminance criteria not working in an automation

Wish I could figure out how to quote a previous reply …

Anyway, Ben, good tip, and so I just looked. However, the lux value for that sensor does not appear to be noisy, it just appears to be wrong sometimes.

For example, yesterday was a decently bright day, cloudy but bright. The history shows a lux value of zero from 6:00 PM onwards. It was LIGHT at 6:00 PM.

But I don’t think my … problem … is related to a noisy sensor. Twice now (that I’ve noticed), the automation trace said “Too bright, not turning the light on” and then the light turned on anyway.

So I’ve decided to ignore it. The purpose of the condition is to not needlessly turn on these lights during daytime, wasting pennies worth of power and dollars worth of lifespan. MOST of the time, the automation works fine, so I’ll just ignore the odd glitch.

Taras, thank you for your reply.

I suspect there may well be something else out there that’s 100% reliable. But I first looked for software that supported most of the devices I needed (key being “need”) and didn’t find anything except HA, so I stopped looking.

Not doing what I want, but doing it perfectly, is not really that useful.

Please don’t misunderstand my feelings. I’ve been using HA for five years now, and am up to 110 devices. By and large, it’s worked extremely well, extremely well. And when it hasn’t, most of the blame can be placed on cheap Chinese devices.

(Indeed, some of these devices remind me of a Samuel Johnson saying. “It’s like seeing a dog walk on its hind legs. It is not done well; but you are surprised to find it done at all.” It’s hard to imagine how much clever tech could be packed in for such few dollars.)

But there are glitches that seem to be entirely HA related, and here’s an example.

I live in a rural property with a septic field and a septic pump. Being originally a city boy … with actual sewers … I didn’t give it much thought.

Until the pump failed, unbeknownst to me.

Unbeknownst for a while, until the ground around the tanks seemed moist all the time, even mid summer, and the area seemed even smellier than usual abd I finalky investigated.

So, when the pump was replaced, I took some serious action. I started with an alarm, a switch on a float at a very high effluent level, higher than should ever be reached, that sets off a LOUD screamer. (So loud that when testing it, my neighbours from a quarter mile away came to investigate.)

Then I built a two switch pump control system … simple relay logic … to replace the original single float switch system.

With a single switch, the pump probably came on each time a toilet was flushed, hands were washed and so on. It could easily be 50 short cycles a day, each cycle but two or three seconds long.

Since pump motors fail more often due to start stop cycles than hours of use, a single switch is a bad idea. In the two switch system, there’s a high and low switch. The pump does not turn on until the high switch closes and stays on until the low switch opens. In my system, these two are about 100 gallons apart, meaning my pump turns on every 36 to 48 hours and stays on for two or three minutes.

This scheme is now standard in most every septic installation and the controllers are readily available. But they were all hundreds of dollars for little more than two $10 relays, so I built my own. (I have an electronics background, this system was easier to build than buttering my morning toast.)

But I’m also mindful of the old saying, “Once bitten, twice shy” and, if the truth be told, I’m a bit paranoid, so I built something else alongside. I built an ESPHome device to monitor the state of the switches and then added some automations.

One automation sends an email when the pump turns on, another sends an email when the pump turns off.

A third sends an email and flashes every light in the house if the very very high switch is tripped (just in case I can’t hear the screaming loud alarm).

And a fourth sends an email if the ESPHome device is offline for more than 15 minutes. I’m always worried … does no email mean no pumping? Or does it mean no monitoring?

There’s another quote that sticks in my mind, “quis custodiet ipsos custodes”. (Did I mention paranoia?) So I have a script running on my desktop computer that does a port query on the ESPHome device every five minutes, again emailing me if the ESPHome device doesn’t respond.

The computer has never emailed me to say that the ESPHome device is offline (except for those times I’m screwing around with the WiFi, which is a decent test of the cron job).

But every four or five days, HA does email saying the device is offline, even though the log file on the computer says all is well.

It’s just a glitch of some sort, so I just ignore these as well, paying more attention to the messages from the computer.

From this, and other such little niggles (most also dealing with offline devices that aren’t actually offline), I derive my opinion, not 100%, just spectacularly good beta.

I’m really concerned your email may not be reliable? Clearly on the critical path. I mean, even FaceBoob was down earlier, an abject disaster for some.

I have almost exactly the same setup with a Philips Hue motion detector and an automation triggering the light on motion if lux is below 50. I have never noticed it triggering incorrectly. I just checked it and yep, today had some motion detected when lux was above and then when it was below 50. Light was only turned on when it was dark.

But then it’s clear to me you were looking at the wrong trace (it’s different time, that literally screamed to me when I read your posts), so we’ll never know what has actually happened.

If you would like to investigate it further, I suggest you increase the amount of stored traces. The default is 5 I think, and that’s probably not enough for a busy motion detector.

Fanful,

I can’t help the different timestamps, and it may well be a symptom of the problem.

At 7:17, the light’s history said it was turned on by the automation. At 7:19 (later), the trace for the automation said “Too bright, no light.”

But there was no automation trace at 7:17! The trace before this one was 3 hours earlier!

One explanation is that HA decided that 70 really is less than 50 AND that False means True, then went back in time and turned the light on. I’m not so sure about this one, but frankly, it’s an explanation that fits the facts.

An alternate explanation might have been some sort of race/busy/resource depleted condition where the automation made a mistake and turned the light on at 7:17, but didn’t actually get around to logging things until two minutes later.

I really don’t know.

What I do know is what I saw with my own eyes, twice in the last week. It was bright outside and the light turned on and the light’s history said the automation turned it on and the nearest in time automation trace said it didn’t.

I also know that most of the time it does work. Examining the light’s history, I see no other occasions where it turned on when it shouldn’t.

So I’m not going to worry about it. I don’t want to burn these superbright LEDs out early, but an unneeded 5 minutes once or twice a week is not enough to stress over.

What I do stress over a bit are a couple of other automations, one of which I mentioned in a previous post. Here I’m sent a message telling me something has been offline for more than 15 minutes when in fact it hasn’t been offline at all. I may move that monitoring to some other device … maybe one of the older RPIs I have around.

Do, do you have an automation trace about that issue? Or is the issue that the entity really went offline in HA?