datenschuft / SMA-EM

SMA Energymeter measurement
GNU General Public License v2.0
95 stars 39 forks source link

can't get feature influxdb2 to work #91

Open wolfgangr opened 1 month ago

wolfgangr commented 1 month ago

SMA-EM demon works fine with features=simplefswriter mqtt
(I just retrieve data from home manager, not from the inverters)

I can write data to influx 2.7 via mqtt and telegraf at 60 s interval.
But I'd prefer the direct way for a shorter log interval (1 ... 5s).

When I try to activate influxdb2 feature, demon won't start, but delivers the dreaded

Oct 02 23:25:18 homeserver systemd[1]: smaemd.service: Start request repeated too quickly.
Oct 02 23:25:18 homeserver systemd[1]: smaemd.service: Failed with result 'start-limit-hit'.
Oct 02 23:25:18 homeserver systemd[1]: Failed to start smaemd.service - SMA Energymeter measurement daemon.

So I tried it directly from the command line:

wrosner@homeserver:/etc/smaemd$ sudo systemctl stop smaemd.service 
wrosner@homeserver:/etc/smaemd$ python3 /opt/smaemd/sma-daemon.py start_systemd
config
import simplefswriter.py
simplefswriter: feature enabled
import mqtt.py
mqtt: feature enabled
import influxdb2.py
Dependency problem: No module named 'influxdb_client'

System is a debian bookworm, so I tried
$ sudo apt-get install python3-influxdb
no success.

dpkg --listfiles python3-influxdb reveals that there is no file named influxdb_client in this package at all.

May it be that there are different flavours of python clients for influx?
see https://pypi.org/project/influxdb-client/

pipx install 'influxdb-client' - no success

pip install 'influxdb-client' --break-system-packages
at least changes the image:

  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f5d4dda5550>: Failed to establish a new connection: [Errno -2] Name or service not known

I tried to change localhost to hostname, FQDN, hostname.domain:port - no difference.

Ginving up?
häng on - failure is not an option :innocent: