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.
Here’s the very basic code I’ve got so far:
sensor: - platform: pulse_width pin: D1 name: Pulse Width Sensor