ironsheep / lightning-detector-MQTT2HA-Daemon

Linux script to monitor AS3935 lightning detector and report detections to MQTT
GNU General Public License v3.0
34 stars 7 forks source link

Not running on a RPi! #25

Open WirthmU opened 3 months ago

WirthmU commented 3 months ago

Checklist:

Release with the issue:

Last working release (if known):

Hardware, Operating System, Python version: I am running the code on a Raspberry PI 4B with 8GB

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian

Description of problem: When I start the daemon it works fine initially but then the code runs into an error:

pi@lightning:/opt/ISP-lightning-mqtt-daemon $ python3 /opt/ISP-lightning-mqtt-daemon/ISP-lightning-mqtt-daemon.py
[2024-06-24 16:24:15] - * init mqtt_client_connected=[False]
[2024-06-24 16:24:15] * Sensor on I2C bus
[2024-06-24 16:24:15] - log: Sending CONNECT (u1, p1, wr1, wq0, wf1, c1, k60) client_id=b''
[2024-06-24 16:24:15] - log: Sending PUBLISH (d0, q0, r0, m1), 'b'home/as3935/sensor/lightningdetector/status'', ... (6 bytes)
[2024-06-24 16:24:15] - * Wait on mqtt_client_connected=[False]
[2024-06-24 16:24:15] - log: Received CONNACK (0, 0)
[2024-06-24 16:24:15] MQTT connection established
[2024-06-24 16:24:15] 
[2024-06-24 16:24:15] - on_connect() mqtt_client_connected=[True]
[2024-06-24 16:24:16] - - stopped MQTT timer
[2024-06-24 16:24:16] - - started MQTT timer - every 60 seconds
[2024-06-24 16:24:16] - - ip=[192.168.1.83], mac[dc:a6:32:ae:98:62], interface=[eth0], uniq-id=[AS3935-dca632ae9862]
[2024-06-24 16:24:16] Announcing Lightning Detection device to MQTT broker for auto-discovery ...
[2024-06-24 16:24:16] - log: Sending PUBLISH (d0, q1, r1, m2), 'b'homeassistant/sensor/lightningdetector/last/config'', ... (537 bytes)
[2024-06-24 16:24:16] - log: Sending PUBLISH (d0, q1, r1, m3), 'b'homeassistant/sensor/lightningdetector/energy/config'', ... (302 bytes)
[2024-06-24 16:24:16] - log: Sending PUBLISH (d0, q1, r1, m4), 'b'homeassistant/sensor/lightningdetector/distance/config'', ... (337 bytes)
[2024-06-24 16:24:16] - log: Sending PUBLISH (d0, q1, r1, m5), 'b'homeassistant/sensor/lightningdetector/count/config'', ... (299 bytes)
[2024-06-24 16:24:16] - log: Sending PUBLISH (d0, q1, r1, m6), 'b'homeassistant/sensor/lightningdetector/settings/config'', ... (419 bytes)
[2024-06-24 16:24:16] - log: Sending PUBLISH (d0, q1, r1, m7), 'b'homeassistant/sensor/lightningdetector/crings/config'', ... (407 bytes)
[2024-06-24 16:24:16] - log: Sending PUBLISH (d0, q1, r1, m8), 'b'homeassistant/sensor/lightningdetector/prings/config'', ... (404 bytes)

Python errors shown in the logs (if applicable):

Traceback (most recent call last):
  File "/opt/ISP-lightning-mqtt-daemon/ISP-lightning-mqtt-daemon.py", line 950, in <module>
    GPIO.setup(interrupt_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
RuntimeError: Not running on a RPi!

And also:

pi@lightning:/opt/ISP-lightning-mqtt-daemon $ python3 /opt/ISP-lightning-mqtt-daemon/ISP-lightning-mqtt-daemon.py --calc_tuning_cap
[2024-06-24 16:45:32] * Mode: Calculate Tuning Cap value and exit
[2024-06-24 16:45:32] - * init mqtt_client_connected=[False]
[2024-06-24 16:45:32] * Sensor on I2C bus
[2024-06-24 16:45:32] - - ip=[192.168.1.83], mac[dc:a6:32:ae:98:62], interface=[eth0], uniq-id=[AS3935-dca632ae9862]
Traceback (most recent call last):
  File "/opt/ISP-lightning-mqtt-daemon/ISP-lightning-mqtt-daemon.py", line 950, in <module>
    GPIO.setup(interrupt_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
RuntimeError: Not running on a RPi!

Additional information: