Thank you for this great project.
I use a Raspberry 3b
I tried to follow your instructions step by step,
The wiring for the sensor ist correct and I can detect the lightning sensor adress with i2cdetect.
I created and edit the config.ini file in the following path:
/opt/ISP-lightning-mqtt-daemon
But at the section "Execution", where I can test the code, I get this error:
no matter whether I specify the directory for the config file ("--config" ) or not
pi@raspi3:~ $ python3 /opt/ISP-lightning-mqtt-daemon/ISP-lightning-mqtt-daemon.py --config /opt/ISP-lightning-mqtt-daemon
[2021-07-12 10:43:05] - * init mqtt_client_connected=[False]
Traceback (most recent call last):
File "/opt/ISP-lightning-mqtt-daemon/ISP-lightning-mqtt-daemon.py", line 155, in
config.read_file(config_file)
File "/usr/lib/python3.7/configparser.py", line 717, in read_file
self._read(f, source)
File "/usr/lib/python3.7/configparser.py", line 1079, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: '/opt/ISP-lightning-mqtt-daemon/config.ini', line: 1
'\ufeff# Configuration file for lightning-detector-MQTT2HA-Daemon\n'
My config.ini file code is here:
Configuration file for lightning-detector-MQTT2HA-Daemon
Hello, I was able to find the solution to the problem. I had to remove BOM from the config.ini file.
It seems like the editor put this in without my knowledge.
Hello
Thank you for this great project. I use a Raspberry 3b
I tried to follow your instructions step by step, The wiring for the sensor ist correct and I can detect the lightning sensor adress with i2cdetect. I created and edit the config.ini file in the following path: /opt/ISP-lightning-mqtt-daemon
But at the section "Execution", where I can test the code, I get this error: no matter whether I specify the directory for the config file ("--config" ) or not
pi@raspi3:~ $ python3 /opt/ISP-lightning-mqtt-daemon/ISP-lightning-mqtt-daemon.py --config /opt/ISP-lightning-mqtt-daemon [2021-07-12 10:43:05] - * init mqtt_client_connected=[False] Traceback (most recent call last): File "/opt/ISP-lightning-mqtt-daemon/ISP-lightning-mqtt-daemon.py", line 155, in
config.read_file(config_file)
File "/usr/lib/python3.7/configparser.py", line 717, in read_file
self._read(f, source)
File "/usr/lib/python3.7/configparser.py", line 1079, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: '/opt/ISP-lightning-mqtt-daemon/config.ini', line: 1
'\ufeff# Configuration file for lightning-detector-MQTT2HA-Daemon\n'
My config.ini file code is here:
Configuration file for lightning-detector-MQTT2HA-Daemon
Source: https://github.com/ironsheep/lightning-detector-MQTT2HA-Daemon
#
Uncomment and adapt all settings as needed.
Some settings can be configured by environment variables.
If an env variable is set, it takes precedence over settings in this file
[General]
[Daemon]
Enable or Disable an endless execution loop (Default: true)
enabled = true
[MQTT]
The hostname or IP address of the MQTT broker to connect to (Default: localhost)
Also read from the MQTT_HOSTNAME environment variable
hostname = localhost
The TCP port the MQTT broker is listening on (Default: 1883)
Also read from the MQTT_PORT environment variable
port = 1883
Maximum period in seconds between ping messages to the broker. (Default: 60)
keepalive = 60
NOTE: The MQTT topic used for this device is constructed as:
{base_topic}/{sensor_name}
#
The MQTT base topic to publish the Lightning detector sensor data topics under.
base_topic = home/nodes
The MQTT name for this Lightning detector sensor
sensor_name = lightningdetector
The MQTT broker authentification credentials (Default: no authentication)
Will also read from MQTT_USERNAME and MQTT_PASSWORD environment variables
username = dani
password = pwd123
Enable TLS/SSL on the connection
tls = false
Path to CA Certificate file to verify host
tls_ca_cert =
Path to TLS client auth key file
tls_keyfile =
Path to TLS client auth certificate file
tls_certfile =
Broker connection-failure recovery
Rety connection attempts [default 5]
retry_count = 5
Retry after waiting N seconds [default 30]
retry_wait_in_seconds = 30
[Behavior]
This script accumulates detections into buckets (rings if you will) for this period of time [2-10] in minutes [Default: 5]
period_in_minutes = 5
This script accumulates values into [3-7] rings [Default: 5]
number_of_rings = 5
This script can report distances in miles or kilometers (mi, km) [Default: km]
distance_as = km
This script determines that a storm has ended after this period of time [10-60] in minutes [Default: 30]
end_storm_after_minutes = 30
[Sensor]
decribe how your sensor is hooked up to your RPi
use values 'I2C' or 'SPI' - default is 'I2C'
sensor_attached = I2C
GPIO pin used for interrupts
intr_pin = 17
The SPI bus and device numbers come from the device file being used.
e.g., /dev/spidev0.0 would be bus=0, device=0
The defaults are 0 and 0 (SPI0 which appears at the GPIO 40pin header)
spi_bus = 0
spi_device = 0
Rev. 1 Raspberry Pis should leave bus set at 0, while rev. 2 Pis should set
bus equal to 1. The address should be changed to match the address of the
sensor.
i2c_bus = 1 i2c_address = 0x03
Value to use for your board
Internal Tuning Capacitors (from 0 to 120pF in steps of 8pf) - A value of [0-15]
run the script with a --tune paramater to determine value for your board
NOTE: this runs for 3 minutes so be patient! Then record your best value here.
tuning_capacitor = 0x1
Indoors (True) = more sensitive (can miss very strong lightnings)
Outdoors (False) = less sensitive (can miss far away lightnings)
detector_afr_gain_indoor = false
detector_noise_floor = 1
Prevent single isolated strikes from being logged => interrupts begin after
this number of strikes (def: 5, value 1,5,9,16), then are fired normally.
detector_min_strikes = 5
The mqtt connection fails.
Does someone have a idea, what could be the problem ?
Kind regards Daniel