I have an ESP8266 connected to a photo resistor counting the pulses on a gate light status indicator,
Here are the statuses:
Fast flickering - closing
Slow flickering - opening
Off - closed
On - open
And a few others
With pulse counter I can get the closing and opening, but when it comes to open/closed, it registers as 0. I tried to use a duty meter, but then I can only get open and closed because the other 2 is always 50%.
Tried using both at the same time but then only one updates.
Does anyone have a suggestion?
Posting current code or what you tried is good to post. Even if its wrong, it may be fixable and it helps give us a glimpse into how you are thinking about the project. You really havnt given any useful details like the config and/or pictures of the gate/installation space to see what else is in there rhat may be usefull.
A picture of the gate or hardware would be helpful. Im struggling to figure out why you’re trying to use an led to track the 4 possible states the gate can be in and get it to track reliable. It may be doable but, im really not sure, thats kind of an odd one ive never seen anyone try. Is there no other wiring or ways to track the gate, like reed switches? Those are very reliable. If you have access to the gate motor, your could put a Shelly2.5 on it and then it can detect based on current, whether the gate is opening/closing/open/closed and anywhere in between those states because you’d set it up as a gate cover and then see in HA thr state in real time with a % open/closed as it moves and it even does power monitoringfor you… Thats arguably the best way to go if it will work on your gate motor.