-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strikes count sensor for AS3935 #452
Comments
I don't think the AS3935 exposes that data. It mainly only exposes if a lightning storm is nearby and how far away it is. I think the sensor is mainly made for UPS and devices that need to know if there might be power surges. See also the datasheet https://www.embeddedadventures.com/datasheets/AS3935_Datasheet_EN_v2.pdf CC: @TheEggi (do you know if the AS3935 exposes that data?) |
It doesn't, but one could use a global variable increased every time the IRQ is triggered, and reset to 0 after data is sent. |
In that case I would recommend using a separate Edit: looks like the AS3935 implementation already has an interrupt on the IRQ pin. So two things then:
|
Oh, I haven't thought about using the pulse counter. That's a much better idea ! |
Actually, I think the pulse counter solution won't work, as you need to check for every pulse wether it's noise, human-originated or actual lightning. At least, this is how the MOD-1016 works. |
* AS3935 Use normal pin polling for IRQ See also esphome/feature-requests#452 * Fix tests
The binary sensor should only get triggered if there was a real interrupt - but I guess there was still an issue with the handling. Thanks for fixing that @OttoWinter |
@TheEggi No no the previous handling was fine! I just realized when going through the datasheet that the IRQ line gets pulled high until the data is read out. So using a pin interrupt for that was a bit unnecessary, I just switched out the interrupt for a polling mode. |
* AS3935 Use normal pin polling for IRQ See also esphome/feature-requests#452 * Fix tests
* AS3935 Use normal pin polling for IRQ See also esphome/feature-requests#452 * Fix tests
Describe the problem you have/What new integration you would like
It might be nice to have a strikes count sensor for the AS3935.
Please describe your use case for this integration and alternatives you've tried:
Every time the sensor publishes an update, it could also send number of strikes that happened since the last update. It would be reset to 0 after updating corresponding sensor.
Additional context
The text was updated successfully, but these errors were encountered: