Been scratching my head with this one for a while, and it’s time to ask for help.
Put simply, I’ve got an ESP8266 with a laser receiver board connected, and I’ve got the pulse width sensor component reading it in ESPHome and reporting to HA fine.
The problem is: I have a custom flat laser beam remote that has two different PWM’s (10ms and 50ms, both with 50% duty cycle) and I want ESPhome to report what the PWM of the laser beam that just passed over it was. At the moment, if the 10ms laser passes over the sensor, the ESPHome node waits until the interval time (up to 60s at the moment) and then tells HA that value. AND it reports that exact same value every 60s for the rest of time.
I would like this node to only send the pulse width of the last laser beam it saw, and only report instantly after it happens. So if I shine the 10ms pulse at it, it tells HA it saw the 10ms pulse, and if 10 minutes later I shine the same 10ms pulse at it, it does the same thing again. And if 30 minutes later I shine the 50ms pulse at it, it reports it just saw the 50ms pulse.
Can you use the pulse counter to tell when there was a detectable pulse on the time interval and then create a template sensor that does what you want?
Sorry for being impatient. Being in the UK on Covid lockdown is a bit boring.
I would like the sensor to tell HA instantly the pulse width of the laser beam that just passed over it, and then HA when no laser beam has passed over it.
Imagine this sensor as two separate momentary push button switches. When the 10ms laser passes over the switch, one output is triggered. when the 50ms laser passes over it, the other switch triggers. And also, these output needs to be momentary, which is what I’m struggling with. At the moment if the 50ms laser passes over the sensor, the sensor tells HA every 60s seconds about that same event. It doesn’t reset to “no pulse detected in the last 5 seconds” for example.
Use it to detect an actual signal then use the pulse width sensor to tell which signal it was. I’m not sure if you can be sure these sensors will have the same update schedule however.
In that case it seems like the logical approach would be to just use the pulse width sensor, but work out how to have it only report that pulse width instantly, and only only once. Surely that’s possible?