Closed DarKOrange75 closed 3 years ago
Yes! This is actually on top of my To-Do list for this project. I will keep this issue open as a reminder and for notifications.
MQTT support is added in commit 595fe3a8. It is not thoroughly tested, so I'd appreciate your feedback.
Awesome, I'll test it as soon as I can!
The serial monitor says that it is connected to MQTT server but nothing is published: 10:43:13.377 -> Calibrated antenna frequency: 499072 Hz 10:43:13.516 -> MDNS responder started 10:43:13.516 -> Server is listening on port 80 10:43:16.535 -> Connected to DKON2 10:43:16.535 -> IP address: 192.168.1.19 10:43:16.535 -> MAC: EC:FA:BC:6E:18:BA 10:43:16.535 -> Successfully connected to MQTT server
The status shows that the sensor was triggered though:
{"lightnings":
[{"age":186,"energy":165851,"distance":6}],"distance":6,"energy":0,"noiseFloorLevel":78,"disturbersPerMinute":7,"watchdogThreshold":0}
is this normal?
if (client.connect("kaminari", MY_MQTT_USER, MY_MQTT_PASSWORD))
Yes... You are supposed to set the correct MQTT credentials in your myWiFi.h
as MY_MQTT_USER
and MY_MQTT_PASSWORD
. If you don't need to authenticate, set both to NULL
.
I was able to receive lightning events in Mosquitto, so it should work in general. Errors while publishing were not logged, so if there was an error, it would go unnoticed. I've added error logging in commit be4ef1d6. The error codes are documented here. Can you check if you get an error instead of a lightning event message?
I meant is "kaminari" normal or is it a leftover of your tests in the code ?
It's the client ID. But you are right, it should be configurable as well.
OK that's weird, it worked only once, I got a notification in mosquito, deleted it and now nothing is published anymore...
After some tests, nothing is wrong with the MQTT connection, it looks like this condition is preventing the publishing of the lightning alert:
if (!detector.getLastLightningDetection(0, ledLightning))
Strange, I could get lightning events that way. I will have a look at it in the next days.
I'm sorry for the delay. I had a hardware issue with my sensor that is hopefully fixed now.
No problem Richard
Hopefully @gubiq's patch has fixed the MQTT status problem. If not, feel free to reopen this issue. But I will also keep on looking into this issue while I try to get my hardware fixed. (It still does not detect any lightnings any more, not even false positives.)
Hi, thank you for your nice work! I would like to integrate your sensor into my Home Assistant setup. Could you please add MQTT support when you have time? This would be awesome. Thank you!