datenschuft / SMA-EM

SMA Energymeter measurement
GNU General Public License v2.0
93 stars 38 forks source link

Pvdata where is it? #63

Closed broke23 closed 3 years ago

broke23 commented 3 years ago

Now all is working but how does the config work like @Tommi2Day

yes, i contributed originaly this module, but there was more changes afterwards from others. For me its absolutly stable. You should have your raspberry within the same network as the inverter image

Your config looks a little bit different than mine, maybe i am running an older version than now. My config for SMA STL-10000

[FEATURE-influxdb]
# influx
host=influxdb
port=8086
db=SMA
measurement=SMAEM
timeout=5
user=
password=
ssl=
#fields=pregard,psurplus,p1regard,p2regard,p3regard,p1surplus,p2surplus,p3surplus
fields=pconsume,psupply,p1consume,p2consume,p3consume,p1supply,p2supply,p3supply

# How frequently to send updates over (defaults to 20 sec)
min_update=30

debug=0

pvmeasurement=SMAWR
pvfields=AC Power,AC Voltage,grid frequency,DC Power,DC input voltage,daily yield,total yield,Power L1,Power L2,Power L3

[FEATURE-pvdata]

# How frequently to send updates over (defaults to 20 sec)
min_update=30

#debug output
debug=0

#inverter connection
inv_host = 192.168.120.120
inv_port = 502
inv_modbus_id = 3
inv_manufacturer = SMA

registers = [
    ['30057', 'U32', 'RAW', 'serial', ''],
    ['30201','U32','ENUM','Status',''],
    ['30051','U32','ENUM','DeviceClass',''],
    ['30053','U32','ENUM','DeviceID',''],
    ['40631', 'STR32', 'UTF8', 'Device Name', ''],
    ['30775', 'S32', 'FIX0', 'AC Power', 'W'],
    ['30813', 'S32', 'FIX0', 'AC apparent power', 'VA'],
    ['30977', 'S32', 'FIX3', 'AC current', 'A'],
    ['30783', 'S32', 'FIX2', 'AC voltage', 'V'],
    ['30803', 'U32', 'FIX2', 'grid frequency', 'Hz'],
    ['30773', 'S32', 'FIX0', 'DC power', 'W'],
    ['30771', 'S32', 'FIX2', 'DC input voltage', 'V'],
    ['30777', 'S32', 'FIX0', 'Power L1', 'W'],
    ['30779', 'S32', 'FIX0', 'Power L2', 'W'],
    ['30781', 'S32', 'FIX0', 'Power L3', 'W'],
    ['30953', 'S32', 'FIX1', u'device temperature', u'\xb0C'],
    ['30517', 'U64', 'FIX3', 'daily yield', 'kWh'],
    ['30513', 'U64', 'FIX3', 'total yield', 'kWh'],
    ['30521', 'U64', 'FIX0', 'operation time', 's'],
    ['30525', 'U64', 'FIX0', 'feed-in time', 's'],
    ['30975', 'S32', 'FIX2', 'intermediate voltage', 'V'],
    ['30225', 'S32', 'FIX0', 'Isolation resistance', u'\u03a9']
    ]

You have pvmeasurement option. Is it created for you cause for me it seems not. I was under the impression to see many fields of the inverter itsself

Tommi2Day commented 3 years ago

The original idea for smaemd was to capture the broadcasted data from SMA Energy Monitor. This because is the the naming "smaemd" here. I am running the successor SMA Homemanager 2 along with the inverter STL-10000. The SMA EM/HM and the inverter usually broadcasting values via multicast (therefore the multicast address ip has to be provided not the device ip) and bound to their serial.

The feature-pvdata will direct query the inverter ip register by register via modbus tcp to get additional data. "pvfields" are mapped by Name to modbus registers (set in registers[]).

Influxdb feature ( and mqqt in my case), have access to both, the the received broadcast data and the modbus data to log them at once. In my influxdb config the measurement SMAEM belongs to the broadcasted data for the serial given in {SMA-EM] section - the HM, the measurement SMAWR to the queried inverter data.

HTH

broke23 commented 3 years ago

I get that completely. But for me I tried the same as you, though nowhere to find the output of the inverter. None of the fields from pv is found in database

Tommi2Day commented 3 years ago

you may activate debug on both, to pvdata and influx feature to see what happens. Also sometimes there is a field type mismatch causing influxdb to reject the data. In this case you may have to drop this measure and let them recreate with the right type (usually INT vs. FLOAT) there is a global pvdata array which should be filled up by the inverter within pvdata feature

Tommi2Day commented 3 years ago

are you sure the modbus tcp ouitput has been activated by the person which has the inverter installed? Its not the default and requires the installation password

broke23 commented 3 years ago

Hmm. Good one about modbus. Need to check that one! That might be the issue. I once asked this before but got no answer. Thx! Ah and debug needs to be active on both? I I only tried each separately...

Tommi2Day commented 3 years ago

Only the inverter. see Manual and Modbus Inteface Description Chapter 4

broke23 commented 3 years ago

OK. So it was set on already. Changed ip on inverter as well to fixed. No clue where data is going.

I reloaded daemon. Looked on grafana to find data from influx. Nothing.

I do see packets coming from inverter I think. See underneath.

But the error at the bottom is what I get as well when I try to run the Damon manually with run. I think don't know how to stop daemon correctly? (is still running?)

ElectricPI:~ $ sudo tcpdump -i eth0 -s0 -vv -e host 192.168.1.22
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
20:28:28.696593 00:40:ad:9a:73:f2 (oui Unknown) > 01:00:5e:0c:ff:fe (oui Unknown), ethertype IPv4 (0x0800), length 60: (tos 0x0, ttl 1, id 0, offset 0, flags [none], proto IGMP (2), length 32, options (RA))
    192.168.1.22 > 239.12.255.254: igmp v2 report 239.12.255.254
20:28:31.461682 00:40:ad:9a:73:f2 (oui Unknown) > 01:00:5e:0c:00:8a (oui Unknown), ethertype IPv4 (0x0800), length 60: (tos 0x0, ttl 1, id 0, offset 0, flags [none], proto IGMP (2), length 32, options (RA))
    192.168.1.22 > 239.12.0.138: igmp v2 report 239.12.0.138
20:28:35.509814 00:40:ad:9a:73:f2 (oui Unknown) > 01:00:5e:0c:ff:ff (oui Unknown), ethertype IPv4 (0x0800), length 60: (tos 0x0, ttl 1, id 0, offset 0, flags [none], proto IGMP (2), length 32, options (RA))
    192.168.1.22 > 239.12.255.255: igmp v2 report 239.12.255.255
20:30:33.752704 00:40:ad:9a:73:f2 (oui Unknown) > 01:00:5e:0c:ff:ff (oui Unknown), ethertype IPv4 (0x0800), length 60: (tos 0x0, ttl 1, id 0, offset 0, flags [none], proto IGMP (2), length 32, options (RA))
    192.168.1.22 > 239.12.255.255: igmp v2 report 239.12.255.255
20:30:36.763802 00:40:ad:9a:73:f2 (oui Unknown) > 01:00:5e:0c:ff:fe (oui Unknown), ethertype IPv4 (0x0800), length 60: (tos 0x0, ttl 1, id 0, offset 0, flags [none], proto IGMP (2), length 32, options (RA))
    192.168.1.22 > 239.12.255.254: igmp v2 report 239.12.255.254
20:30:39.978901 00:40:ad:9a:73:f2 (oui Unknown) > 01:00:5e:0c:00:8a (oui Unknown), ethertype IPv4 (0x0800), length 60: (tos 0x0, ttl 1, id 0, offset 0, flags [none], proto IGMP (2), length 32, options (RA))
    192.168.1.22 > 239.12.0.138: igmp v2 report 239.12.0.138
^C
6 packets captured
6 packets received by filter
0 packets dropped by kernel
pi@ElectricPI:~ $ sudo /opt/smaemd/sma-daemon.py stop
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 37, in <module>
    parser.read(['/etc/smaemd/config','config'])
  File "/usr/lib/python3.7/configparser.py", line 696, in read
    self._read(fp, filename)
  File "/usr/lib/python3.7/configparser.py", line 1091, in _read
    fpname, lineno)
configparser.DuplicateOptionError: While reading from 'config' [line 51]: option 'fields' in section 'FEATURE-influxdb' already exists
datenschuft commented 3 years ago

I have no sma inverter, but i can see 2 problems.

DuplicateOptionError in your config' [line 51]: 'fields' already selected.

According to my opinion, modbus should communicate via udp or tcp but not via igmp. Maybe the tcpdump shows something else. Is 192.168.1.22 the ip-address of the inverter ?

and yes, you can enable dbug on nearly every feature seperatly

broke23 commented 3 years ago

Same config as tommi2day no?


[SMA-EM]
# serials of sma-ems the daemon should take notice
# separated by space
serials=1900254537
# features could filter serials to, but wouldn't see serials if these serials was not defines in SMA-EM serials
# list of features to load/run
#features=simplefswriter sample pvdata ediplugs mqtt remotedebug symcon influxdb
features=influxdb pvdata

[DAEMON]
pidfile=/run/smaemd.pid
# listen on an interface with the given ip
# use 0.0.0.0 for any interface
ipbind=0.0.0.0
# multicast ip and port of sma-datagrams
# defaults
mcastgrp=239.12.255.254
mcastport=9522
statusdir=

[FEATURE-influxdb]
# influx
host=localhost
port=8086
ssl=
db=SMA
timeout=5
user=
password=
min_update=3

debug=0
#emdata
measurement=SMAEM
fields=pconsume,psupply,p1consume,p2consume,p3consume,p1supply,p2supply,p3supply

#pvdata
pvmeasurement=SMAZP
pvfields=AC Power,AC Voltage,grid frequency,DC Power,DC input voltage,daily yield,total yield

[FEATURE-pvdata]
#Reads data from SMA inverter via Modbus.
#Enable the mqtt feature to publish the data to a mqtt broker (features=pvdata mqtt),
#and/or stored the data to a influx database (features=pvdata influxdb), and/or symcom ...

# How frequently to send updates over (defaults to 20 sec)
min_update=5
# debug output
debug=0

# inverter connection
# ['host', 'port', 'modbus_id', 'manufacturer']
inverters = ['192.168.1.22', '502', '3', 'SMA']

# For Modbus registers, see e.g. https://www.google.com/search?q=SMA_Modbus-TI-en-23.xlsx
# ['Modbus register address', 'Type', 'Format', 'Name', 'Unit']
# If the mqtt feature is used, 'Name' is included in the MQTT JSON payload as tag name.
registers = [
# Don't change names in this section as they are used by some features/*.py files
# Alternatives for AC Power & daily yield in MQTT: 'SMA-EM/status/30028xxxxx/pvsum' & 'SMA-EM/status/30028xxxxx/pvdaily'
# Also note that the daily yield register is broken for some inverters
    ['30057', 'U32', 'RAW', 'serial', ''],
    ['30201', 'U32', 'ENUM', 'Status',''],
    ['30051', 'U32', 'ENUM', 'DeviceClass',''],
    ['30053', 'U32', 'ENUM', 'DeviceID',''],
#    ['40631', 'STR32', 'UTF8', 'Device_Name', ''],
    ['30775', 'S32', 'FIX0', 'AC Power', 'W'],
    ['30517', 'U64', 'FIX3', 'daily yield', 'kWh'],
#################################################### 
#    ['30813', 'S32', 'FIX0', 'AC_Power_Apparent', 'VA'],
    ['30977', 'S32', 'FIX3', 'AC_Current', 'A'],
#    ['30783', 'S32', 'FIX2', 'AC_Voltage_L1', 'V'],
#    ['30785', 'S32', 'FIX2', 'AC_Voltage_L2', 'V'],
#    ['30787', 'S32', 'FIX2', 'AC_Voltage_L3', 'V'],
#    ['30777', 'S32', 'FIX0', 'AC_Power_L1', 'W'],
#    ['30779', 'S32', 'FIX0', 'AC_Power_L2', 'W'],
#    ['30781', 'S32', 'FIX0', 'AC_Power_L3', 'W'],
    ['30803', 'U32', 'FIX2', 'Grid_Frequency', 'Hz'],
    ['30773', 'S32', 'FIX0', 'DC_Input1_Power', 'W'],
    ['30771', 'S32', 'FIX2', 'DC_Input1_Voltage', 'V'],
    ['30769', 'S32', 'FIX3', 'DC_Input1_Current', 'A'],
    ['30961', 'S32', 'FIX0', 'DC_Input2_Power', 'W'],
    ['30959', 'S32', 'FIX2', 'DC_Input2_Voltage', 'V'],
    ['30957', 'S32', 'FIX3', 'DC_Input2_Current', 'A'],
    ['30953', 'S32', 'FIX1', 'Device_Temperature', u'\xb0C'],
    ['30513', 'U64', 'FIX3', 'Total_Yield', 'kWh'],
    ['30521', 'U64', 'FIX0', 'Operating_Time', 's'],
    ['30525', 'U64', 'FIX0', 'Feed-in_Time', 's'],
    ['30975', 'S32', 'FIX2', 'Intermediate_Circuit_Voltage', 'V'],
    ['30225', 'S32', 'FIX0', 'Isolation_Resistance', u'\u03a9']
    ]

registers_batt = [
# Don't change names in this section as they are used by some features/*.py files
    ['30057', 'U32', 'RAW', 'serial', ''],
    ['30201', 'U32', 'ENUM', 'Status',''],
    ['30051', 'U32', 'ENUM', 'DeviceClass',''],
    ['30053', 'U32', 'ENUM', 'DeviceID',''],
#    ['40631', 'STR32', 'UTF8', 'Device Name', ''],
    ['30775', 'S32', 'FIX0', 'AC Power', 'W'],
    ['30517', 'U64', 'FIX3', 'daily yield', 'kWh'],
#################################################### 
    ['30953', 'S32', 'FIX1', 'Device_Temperature', u'\xb0C'],
    ['30849', 'S32', 'FIX1', 'BatteryTemp', u'\xb0C'],
    ['30843', 'S32', 'FIX3', 'BatteryAmp', 'A'],
    ['30851', 'U32', 'FIX2', 'BatteryVolt', 'V'],
    ['30845', 'U32', 'FIX0', 'BatteryCharge', u'\u0025'],
    ['30955', 'U32', 'ENUM', 'BatteryState', ''],
    ['31391', 'U32', 'ENUM', 'BatteryHealth', ''],
    ['30813', 'S32', 'FIX0', 'AC apparent power', 'VA'],
    ['30803', 'U32', 'FIX2', 'Grid_Frequency', 'Hz'],
#    ['30777', 'S32', 'FIX0', 'Power L1', 'W'],
#    ['30779', 'S32', 'FIX0', 'Power L2', 'W'],
#    ['30781', 'S32', 'FIX0', 'Power L3', 'W'],
    ['30513', 'U64', 'FIX3', 'Total_Yield', 'kWh'],
    ['30521', 'U64', 'FIX0', 'Operating_Time', 's'],
    ['30525', 'U64', 'FIX0', 'Feed-in_Time', 's'],
    ]
datenschuft commented 3 years ago

Try to change the features order to features=pvdata influxdb because inflixdb uses values of pvdata feature (should not matter, maybe you pvdata are one run below.)

enabeling debug on pvdata should report unknown device_classes

you could also try to set min_update on pvdata to the same value of min_update in section influxdb.

otherwise you have to add some debug-lines to the pvdata feature, to see whats happening.

maybe you have to drop your influx measurements in case of an type mismatch - linke Tommi2Day wrote earlyer.

broke23 commented 3 years ago

Changed order pvdata influxdb and both min update to 3s, no avail. Both debug set.

Still complaining about field duplicate. Don't get it why... @Tommi2Day got the same no? See first post

But drop what measurements. There is only SMA-EM measurement. Nothing else

pi@ElectricPI:~ $ influx
Connected to http://localhost:8086 version 1.8.9
InfluxDB shell version: 1.8.9
> SHOW MEASUREMENTS ON SMA
name: measurements
name
----
SMAEM
>

you mean drop the measurements that are already in place, could be type mismatch even without having the separate measurement noted (see above) ?

> show field keys FROM SMAEM
name: SMAEM
fieldKey     fieldType
--------     ---------
p1consume    float
p1supply     float
p2consume    float
p2supply     float
p3consume    float
p3supply     float
pbattery     float
pconsume     float
pdirectusage float
phouse       float
psupply      float
pusage       float
pvpower      float
> show field keys FROM SMAZP
>

The config of influxdb2 seems the same style as the one tommi2day has for influxdb <v2 so might be its v2 stuff mixed up here?

And how do the fields get created as I don't see it linking to pvmeasurement name anywhere? Or did I miss that one?

Tommi2Day commented 3 years ago

your tcp dump shows only multicast records, but no traffic on port 502 as i explained above. At least the modbus request from your pi to the inverter should be there.
maybe refresh 5s too fast

broke23 commented 3 years ago

Setting update to default 20 seconds gives same result. Still ending up in duplicate for fields on line 51.

Is this acting different from your setup then or? I thought reverting to your config would end up working with me not seems not?

Tommi2Day commented 3 years ago

I cant see in your config duplicate fields. pls activate debug in run mode to see where it stops InfluxDB measurements will be created from the first data record

Tommi2Day commented 3 years ago

There are the same addresses queried for the battery registers (eg AC Power and daily yield. I dont know about this battery code part. Can you comment out this part entirely for now?

broke23 commented 3 years ago

Debug is set up but I keep getting to this. Commented out battery parts

pi@ElectricPI:~ $ sudo /opt/smaemd/sma-daemon.py run
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 37, in <module>
    parser.read(['/etc/smaemd/config','config'])
  File "/usr/lib/python3.7/configparser.py", line 696, in read
    self._read(fp, filename)
  File "/usr/lib/python3.7/configparser.py", line 1091, in _read
    fpname, lineno)
configparser.DuplicateOptionError: While reading from 'config' [line 51]: option 'fields' in section 'FEATURE-influxdb' already exists

Don't I need to stop daemon, if so how?

Tommi2Day commented 3 years ago

can you double check your config in /etc/smaemd/config for fields=

Terminate running the foreground process as usal with CTRL-C

broke23 commented 3 years ago

There is twice like in your config see here. Still the same apart from uncommented battery part

[SMA-EM]
# serials of sma-ems the daemon should take notice
# separated by space
serials=1900254537
# features could filter serials to, but wouldn't see serials if these serials was not defines in SMA-EM serials
# list of features to load/run
#features=simplefswriter sample pvdata ediplugs mqtt remotedebug symcon influxdb
features=pvdata influxdb

[DAEMON]
pidfile=/run/smaemd.pid
# listen on an interface with the given ip
# use 0.0.0.0 for any interface
ipbind=0.0.0.0
# multicast ip and port of sma-datagrams
# defaults
mcastgrp=239.12.255.254
mcastport=9522
statusdir=

[FEATURE-influxdb]
# influx
host=localhost
port=8086
ssl=
db=SMA
timeout=5
user=
password=
min_update=3

debug=1
#emdata
measurement=SMAEM
fields=pconsume,psupply,p1consume,p2consume,p3consume,p1supply,p2supply,p3supply

#pvdata
pvmeasurement=SMAZP
pvfields=AC Power,AC Voltage,grid frequency,DC Power,DC input voltage,daily yield,total yield

[FEATURE-pvdata]
#Reads data from SMA inverter via Modbus.
#Enable the mqtt feature to publish the data to a mqtt broker (features=pvdata mqtt),
#and/or stored the data to a influx database (features=pvdata influxdb), and/or symcom ...

# How frequently to send updates over (defaults to 20 sec)
min_update=20
# debug output
debug=1

# inverter connection
# ['host', 'port', 'modbus_id', 'manufacturer']
inverters = ['192.168.1.22', '502', '3', 'SMA']

# For Modbus registers, see e.g. https://www.google.com/search?q=SMA_Modbus-TI-en-23.xlsx
# ['Modbus register address', 'Type', 'Format', 'Name', 'Unit']
# If the mqtt feature is used, 'Name' is included in the MQTT JSON payload as tag name.
registers = [
# Don't change names in this section as they are used by some features/*.py files
# Alternatives for AC Power & daily yield in MQTT: 'SMA-EM/status/30028xxxxx/pvsum' & 'SMA-EM/status/30028xxxxx/pvdaily'
# Also note that the daily yield register is broken for some inverters
    ['30057', 'U32', 'RAW', 'serial', ''],
    ['30201', 'U32', 'ENUM', 'Status',''],
    ['30051', 'U32', 'ENUM', 'DeviceClass',''],
    ['30053', 'U32', 'ENUM', 'DeviceID',''],
#    ['40631', 'STR32', 'UTF8', 'Device_Name', ''],
    ['30775', 'S32', 'FIX0', 'AC Power', 'W'],
    ['30517', 'U64', 'FIX3', 'daily yield', 'kWh'],
#################################################### 
#    ['30813', 'S32', 'FIX0', 'AC_Power_Apparent', 'VA'],
    ['30977', 'S32', 'FIX3', 'AC_Current', 'A'],
#    ['30783', 'S32', 'FIX2', 'AC_Voltage_L1', 'V'],
#    ['30785', 'S32', 'FIX2', 'AC_Voltage_L2', 'V'],
#    ['30787', 'S32', 'FIX2', 'AC_Voltage_L3', 'V'],
#    ['30777', 'S32', 'FIX0', 'AC_Power_L1', 'W'],
#    ['30779', 'S32', 'FIX0', 'AC_Power_L2', 'W'],
#    ['30781', 'S32', 'FIX0', 'AC_Power_L3', 'W'],
    ['30803', 'U32', 'FIX2', 'Grid_Frequency', 'Hz'],
    ['30773', 'S32', 'FIX0', 'DC_Input1_Power', 'W'],
    ['30771', 'S32', 'FIX2', 'DC_Input1_Voltage', 'V'],
    ['30769', 'S32', 'FIX3', 'DC_Input1_Current', 'A'],
    ['30961', 'S32', 'FIX0', 'DC_Input2_Power', 'W'],
    ['30959', 'S32', 'FIX2', 'DC_Input2_Voltage', 'V'],
    ['30957', 'S32', 'FIX3', 'DC_Input2_Current', 'A'],
    ['30953', 'S32', 'FIX1', 'Device_Temperature', u'\xb0C'],
    ['30513', 'U64', 'FIX3', 'Total_Yield', 'kWh'],
    ['30521', 'U64', 'FIX0', 'Operating_Time', 's'],
    ['30525', 'U64', 'FIX0', 'Feed-in_Time', 's'],
    ['30975', 'S32', 'FIX2', 'Intermediate_Circuit_Voltage', 'V'],
    ['30225', 'S32', 'FIX0', 'Isolation_Resistance', u'\u03a9']
    ]

#registers_batt = [
# Don't change names in this section as they are used by some features/*.py files
#    ['30057', 'U32', 'RAW', 'serial', ''],
#    ['30201', 'U32', 'ENUM', 'Status',''],
#    ['30051', 'U32', 'ENUM', 'DeviceClass',''],
#    ['30053', 'U32', 'ENUM', 'DeviceID',''],
#    ['40631', 'STR32', 'UTF8', 'Device Name', ''],
#    ['30775', 'S32', 'FIX0', 'AC Power', 'W'],
#    ['30517', 'U64', 'FIX3', 'daily yield', 'kWh'],
#################################################### 
#    ['30953', 'S32', 'FIX1', 'Device_Temperature', u'\xb0C'],
#    ['30849', 'S32', 'FIX1', 'BatteryTemp', u'\xb0C'],
#    ['30843', 'S32', 'FIX3', 'BatteryAmp', 'A'],
#    ['30851', 'U32', 'FIX2', 'BatteryVolt', 'V'],
#    ['30845', 'U32', 'FIX0', 'BatteryCharge', u'\u0025'],
#    ['30955', 'U32', 'ENUM', 'BatteryState', ''],
#    ['31391', 'U32', 'ENUM', 'BatteryHealth', ''],
#    ['30813', 'S32', 'FIX0', 'AC apparent power', 'VA'],
#    ['30803', 'U32', 'FIX2', 'Grid_Frequency', 'Hz'],
#    ['30777', 'S32', 'FIX0', 'Power L1', 'W'],
#    ['30779', 'S32', 'FIX0', 'Power L2', 'W'],
#    ['30781', 'S32', 'FIX0', 'Power L3', 'W'],
#    ['30513', 'U64', 'FIX3', 'Total_Yield', 'kWh'],
#    ['30521', 'U64', 'FIX0', 'Operating_Time', 's'],
#    ['30525', 'U64', 'FIX0', 'Feed-in_Time', 's'],
#    ]
Tommi2Day commented 3 years ago

pvfields and fields should be different options. otherwise the config parser goes wrong. more i cant see

broke23 commented 3 years ago

Line 51 is the pvfields line... But the options are different though?

But if I uncomment it makes no difference either. But that would mean it won't take the fields from modbus and write em to influx right?

broke23 commented 3 years ago

Grrr... Utf8 again?!

pi@ElectricPI:/etc/smaemd $ sudo iconv -f UTF-8 config -o /dev/null     pi@ElectricPI:/etc/smaemd $ sudo systemctl daemon-reload
pi@ElectricPI:/etc/smaemd $ sudo /opt/smaemd/sma-daemon.py run
config
import pvdata.py
pvdata: feature enabled
import influxdb.py
influxdb: feature enabled
Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/pvdata.py", line 79, in run
    host, port, modbusid, manufacturer = inv
ValueError: too many values to unpack (expected 4)

InfluxDB: em data published 21:15:27:[{'measurement': 'SMAEM', 'time': '2021-09-14T19:15:27Z', 'tags': {'serial': 1900254537}, 'fields': {'pconsume': 381.5, 'psupply': 0.0, 'pdirectusage': 0.0, 'pvpower': 0.0, 'pusage': 381.5, 'pbattery': 0.0, 'phouse': 381.5}}]
InfluxDB: pv data published 21:15:27:[]
^XInfluxDB: em data published 21:15:31:[{'measurement': 'SMAEM', 'time': '2021-09-14T19:15:31Z', 'tags': {'serial': 1900254537}, 'fields': {'pconsume': 382.5, 'psupply': 0.0, 'pdirectusage': 0.0, 'pvpower': 0.0, 'pusage': 382.5, 'pbattery': 0.0, 'phouse': 382.5}}]
InfluxDB: pv data published 21:15:31:[]
^CTraceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 162, in <module>
    daemon.run()
  File "/opt/smaemd/sma-daemon.py", line 132, in run
    emparts=decode_speedwire(sock.recv(608))
KeyboardInterrupt
broke23 commented 3 years ago

Different error now that debug is running

Tommi2Day commented 3 years ago

This inverter array is also not my stuff. maybe it should be better with [['192.168.1.22', '502', '3', 'SMA']]

broke23 commented 3 years ago

God damn I removed those [] because I thought it was to separate the double inverters in config where I only have 1...

Getting somewhere!

pi@ElectricPI:/etc/smaemd $ sudo /opt/smaemd/sma-daemon.py run
config
import pvdata.py
pvdata: feature enabled
import influxdb.py
influxdb: feature enabled
PV:{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'AC Power': None, 'daily yield': 16.077, 'AC_Current': None, 'Grid_Frequency': None, 'DC_Input1_Power': None, 'DC_Input1_Voltage': None, 'DC_Input1_Current': None, 'DC_Input2_Power': None, 'DC_Input2_Voltage': None, 'DC_Input2_Current': None, 'Device_Temperature': None, 'Total_Yield': 37564.051, 'Operating_Time': 74982817, 'Feed-in_Time': 74425754, 'Intermediate_Circuit_Voltage': None, 'Isolation_Resistance': -1, 'timestamp': 1631647987.7754073}
Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t)
KeyError: 'Device Name'

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t)
KeyError: 'serial'

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t)
KeyError: 'serial'

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t)
KeyError: 'serial'

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t)
KeyError: 'serial'

^CTraceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 162, in <module>
    daemon.run()
  File "/opt/smaemd/sma-daemon.py", line 132, in run
    emparts=decode_speedwire(sock.recv(608))
KeyboardInterrupt
Tommi2Day commented 3 years ago

OK, this is also code which came from others, which lloks like errornous in your configuration. There are some fields hardcoded, which are not in your data set. Marked line will cause the exception. maybe @sellth can help

actual influxdb from line 199

   pvmeasurement = config.get('pvmeasurement')
    if None in [pvfields, pv_data, pvmeasurement]: return

    influx_data = []
    datapoint = {
            'measurement': pvmeasurement,
            'time': now,
            'tags': {},
            'fields': {}
    }
    taglist = ['serial', 'DeviceID', 'Device Name']
    tags = {}
    fields = {}

    if pv_data is not None:
        for inv in pv_data:
            # add tag columns and remove from data list
            for t in taglist:
                tags[t] = inv.get(t)
                inv.pop(t) #<--

            for f in pvfields.split(','):
                fields[f] = inv.get(f, 0)

            datapoint['tags'] = tags.copy()
            datapoint['fields'] = fields.copy()
            influx_data.append(datapoint.copy())

my original version which runs for me

    pvmeasurement = config.get('pvmeasurement')
    if None in [pvfields, pv_data, pvmeasurement]: return

    influx_data = {}
    data = {}
    influx_data['measurement'] = pvmeasurement
    influx_data['time'] = now
    influx_data['tags'] = {}
    # unly if we have values
    if pv_data is not None:
        for f in pvfields.split(','):
            data[f] = pv_data.get(f)
            if data[f] is None or data[f]==0: data[f]=0.0
        pvserial = pv_data.get('serial')
        influx_data['tags']["serial"] = pvserial

    influx_data['fields'] = data
    points = [influx_data]
broke23 commented 3 years ago

@Tommi2Day If i change to your config of influxdb.py it runs like this:

pi@ElectricPI:/etc/smaemd $ sudo /opt/smaemd/sma-daemon.py run
config
import pvdata.py
pvdata: feature enabled
import influxdb.py
influxdb: feature enabled
PV:{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'AC Power': None, 'daily yield': 0.0, 'AC_Current': None, 'Grid_Frequency': None, 'DC_Input1_Power': None, 'DC_Input1_Voltage': None, 'DC_Input1_Current': None, 'DC_Input2_Power': None, 'DC_Input2_Voltage': None, 'DC_Input2_Current': None, 'Device_Temperature': None, 'Total_Yield': 37564.051, 'Operating_Time': 74982817, 'Feed-in_Time': 74425754, 'Intermediate_Circuit_Voltage': None, 'Isolation_Resistance': -1, 'timestamp': 1631685549.2184803}
Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 210, in run
    data[f] = pv_data.get(f)
AttributeError: 'list' object has no attribute 'get'

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 210, in run
    data[f] = pv_data.get(f)
AttributeError: 'list' object has no attribute 'get'

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 210, in run
    data[f] = pv_data.get(f)
AttributeError: 'list' object has no attribute 'get'

^CTraceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 162, in <module>
    daemon.run()
  File "/opt/smaemd/sma-daemon.py", line 132, in run
    emparts=decode_speedwire(sock.recv(608))
KeyboardInterrupt

It just ends up going wrong bit further now :) i'll wait for @sellth to comment on this

sellth commented 3 years ago

This line shouldn't be commented out and the field name should be 'Device Name' with a space, not an underscore: https://github.com/datenschuft/SMA-EM/blob/aef650662d71dce8a6da6d7133b81dfa2e771e4b/config.sample#L205

Not sure about the following KeyErrors regarding 'serial' though, as that field clearly is present in your data. Maybe the first error causes the following ones? Cleary the error handling can be improved here...

broke23 commented 3 years ago

I uncommended that line and it stays rather the same ...

pi@ElectricPI:/etc/smaemd $ sudo /opt/smaemd/sma-daemon.py run
config
import pvdata.py
pvdata: feature enabled
import influxdb.py
influxdb: feature enabled
PV:{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device_Name': 'SB 5000TL-21 209', 'AC Power': 1364, 'daily yield': 5.979, 'AC_Current': 5.808, 'Grid_Frequency': 50.02, 'DC_Input1_Power': 834, 'DC_Input1_Voltage': 487.39, 'DC_Input1_Current': 1.713, 'DC_Input2_Power': 566, 'DC_Input2_Voltage': 342.49, 'DC_Input2_Current': 1.655, 'Device_Temperature': 42.4, 'Total_Yield': 37570.033, 'Operating_Time': 75003167, 'Feed-in_Time': 74446633, 'Intermediate_Circuit_Voltage': 510.08, 'Isolation_Resistance': 3000000, 'timestamp': 1631706977.5165908}
Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t) #<--
KeyError: 'Device Name'

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t) #<--
KeyError: 'serial'

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t) #<--
KeyError: 'serial'

^CTraceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 162, in <module>
    daemon.run()
  File "/opt/smaemd/sma-daemon.py", line 132, in run
    emparts=decode_speedwire(sock.recv(608))
KeyboardInterrupt
sellth commented 3 years ago

You haven't removed the underscore. It should be like this: ['40631', 'STR32', 'UTF8', 'Device Name', ''],

broke23 commented 3 years ago

aw my bad!

pi@ElectricPI:/etc/smaemd $ sudo /opt/smaemd/sma-daemon.py run
config
import pvdata.py
pvdata: feature enabled
import influxdb.py
influxdb: feature enabled
PV:{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1167, 'daily yield': 6.079, 'AC_Current': 5.009, 'Grid_Frequency': 49.98, 'DC_Input1_Power': 760, 'DC_Input1_Voltage': 490.67, 'DC_Input1_Current': 1.55, 'DC_Input2_Power': 445, 'DC_Input2_Voltage': 338.06, 'DC_Input2_Current': 1.318, 'Device_Temperature': 42.1, 'Total_Yield': 37570.13, 'Operating_Time': 75003458, 'Feed-in_Time': 74446924, 'Intermediate_Circuit_Voltage': 510.63, 'Isolation_Resistance': 3000000, 'timestamp': 1631707268.4149702}
Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 227, in run
    influx_data['fields'] = data
TypeError: list indices must be integers or slices, not str

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t) #<--
KeyError: 'serial'

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t) #<--
KeyError: 'serial'

^CTraceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 162, in <module>
    daemon.run()
  File "/opt/smaemd/sma-daemon.py", line 132, in run
    emparts=decode_speedwire(sock.recv(608))
KeyboardInterrupt
sellth commented 3 years ago

This is weird, as this line shouldn't exist:

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 227, in run
    influx_data['fields'] = data
TypeError: list indices must be integers or slices, not str

Are you still running @Tommi2Day 's code in your file? Please make sure that your influxdb.py is the same as the current master.

broke23 commented 3 years ago

you are correct, there was still one line left, which I removed now, we're back to line 218 => inv.pop(t)

pi@ElectricPI:/etc/smaemd $ sudo /opt/smaemd/sma-daemon.py run
config
import pvdata.py
pvdata: feature enabled
import influxdb.py
influxdb: feature enabled
PV:{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 3025, 'daily yield': 7.054, 'AC_Current': 12.667, 'Grid_Frequency': 49.98, 'DC_Input1_Power': 1918, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 3.837, 'DC_Input2_Power': 1216, 'DC_Input2_Voltage': 354.46, 'DC_Input2_Current': 3.445, 'Device_Temperature': 41.5, 'Total_Yield': 37571.11, 'Operating_Time': 75005310, 'Feed-in_Time': 74448776, 'Intermediate_Circuit_Voltage': 519.95, 'Isolation_Resistance': 3000000, 'timestamp': 1631709120.992137}
Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t) #<--
KeyError: 'serial'

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t) #<--
KeyError: 'serial'

Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 218, in run
    inv.pop(t) #<--
KeyError: 'serial'

I double checked if it was an encoding issue, but result stays the same, so it wasn't this time ...

sellth commented 3 years ago

I cannot reproduce this behaviour. Could you change this part at line 214 to see what's up?

for inv in pv_data:
    print(inv) # < add this
    # add tag columns and remove from data list
broke23 commented 3 years ago

I found another glitch from me it seems (no more editing from cellphone from now on!), I added your code:

pi@ElectricPI:/etc/smaemd $ sudo /opt/smaemd/sma-daemon.py run
config
import pvdata.py
pvdata: feature enabled
import influxdb.py
influxdb: feature enabled
PV:{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1165, 'daily yield': 10.155, 'AC_Current': 5.004, 'Grid_Frequency': 49.99, 'DC_Input1_Power': 744, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.488, 'DC_Input2_Power': 456, 'DC_Input2_Voltage': 355.17, 'DC_Input2_Current': 1.285, 'Device_Temperature': 41.2, 'Total_Yield': 37574.208, 'Operating_Time': 75010925, 'Feed-in_Time': 74454391, 'Intermediate_Circuit_Voltage': 519.93, 'Isolation_Resistance': 3000000, 'timestamp': 1631714736.6415825}
{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1165, 'daily yield': 10.155, 'AC_Current': 5.004, 'Grid_Frequency': 49.99, 'DC_Input1_Power': 744, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.488, 'DC_Input2_Power': 456, 'DC_Input2_Voltage': 355.17, 'DC_Input2_Current': 1.285, 'Device_Temperature': 41.2, 'Total_Yield': 37574.208, 'Operating_Time': 75010925, 'Feed-in_Time': 74454391, 'Intermediate_Circuit_Voltage': 519.93, 'Isolation_Resistance': 3000000, 'timestamp': 1631714736.6415825}
{'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'AC Power': 1165, 'daily yield': 10.155, 'AC_Current': 5.004, 'Grid_Frequency': 49.99, 'DC_Input1_Power': 744, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.488, 'DC_Input2_Power': 456, 'DC_Input2_Voltage': 355.17, 'DC_Input2_Current': 1.285, 'Device_Temperature': 41.2, 'Total_Yield': 37574.208, 'Operating_Time': 75010925, 'Feed-in_Time': 74454391, 'Intermediate_Circuit_Voltage': 519.93, 'Isolation_Resistance': 3000000, 'timestamp': 1631714736.6415825}
Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 219, in run
    inv.pop(t)
KeyError: 'serial'

{'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'AC Power': 1165, 'daily yield': 10.155, 'AC_Current': 5.004, 'Grid_Frequency': 49.99, 'DC_Input1_Power': 744, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.488, 'DC_Input2_Power': 456, 'DC_Input2_Voltage': 355.17, 'DC_Input2_Current': 1.285, 'Device_Temperature': 41.2, 'Total_Yield': 37574.208, 'Operating_Time': 75010925, 'Feed-in_Time': 74454391, 'Intermediate_Circuit_Voltage': 519.93, 'Isolation_Resistance': 3000000, 'timestamp': 1631714736.6415825}
Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 219, in run
    inv.pop(t)
KeyError: 'serial'

{'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'AC Power': 1165, 'daily yield': 10.155, 'AC_Current': 5.004, 'Grid_Frequency': 49.99, 'DC_Input1_Power': 744, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.488, 'DC_Input2_Power': 456, 'DC_Input2_Voltage': 355.17, 'DC_Input2_Current': 1.285, 'Device_Temperature': 41.2, 'Total_Yield': 37574.208, 'Operating_Time': 75010925, 'Feed-in_Time': 74454391, 'Intermediate_Circuit_Voltage': 519.93, 'Isolation_Resistance': 3000000, 'timestamp': 1631714736.6415825}
Daemon: Exception occured
Traceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/influxdb.py", line 219, in run
    inv.pop(t)
KeyError: 'serial'

config part :

    pvmeasurement = config.get('pvmeasurement')
    if None in [pvfields, pv_data, pvmeasurement]: return

    influx_data = []
    datapoint = {
            'measurement': pvmeasurement,
            'time': now,
            'tags': {},
            'fields': {}
    }
    taglist = ['serial', 'DeviceID', 'Device Name']
    tags = {}
    fields = {}

    if pv_data is not None:
        for inv in pv_data:
            print(inv) #
            # add tag columns and remove from data list
            for t in taglist:
                tags[t] = inv.get(t)
                inv.pop(t)

            for f in pvfields.split(','):
                fields[f] = inv.get(f, 0)

            datapoint['tags'] = tags.copy()
            datapoint['fields'] = fields.copy()
            influx_data.append(datapoint.copy())
sellth commented 3 years ago

Oh, this might be because of different values for the min_update in FEATURE-pvdata and FEATURE-influxdb. Basically the influxdb.py tries to send over values every 3 seconds but pvdata.py only refreshes every 20 seconds (if your settings remain as above). This is definitely a case influxdb.py should consider.

broke23 commented 3 years ago

should I put it at 3 seconds as well to test ?

sellth commented 3 years ago

Yes, I use 5 but as long as they're the same it should be fine.

broke23 commented 3 years ago

3s result:

pi@ElectricPI:/etc/smaemd $ sudo /opt/smaemd/sma-daemon.py run
config
import pvdata.py
pvdata: feature enabled
import influxdb.py
influxdb: feature enabled
PV:{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1351, 'daily yield': 10.955, 'AC_Current': 5.8, 'Grid_Frequency': 49.99, 'DC_Input1_Power': 880, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.76, 'DC_Input2_Power': 512, 'DC_Input2_Voltage': 349.23, 'DC_Input2_Current': 1.467, 'Device_Temperature': 41.6, 'Total_Yield': 37575.008, 'Operating_Time': 75012809, 'Feed-in_Time': 74456275, 'Intermediate_Circuit_Voltage': 519.93, 'Isolation_Resistance': 3000000, 'timestamp': 1631716620.1804874}
{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1351, 'daily yield': 10.955, 'AC_Current': 5.8, 'Grid_Frequency': 49.99, 'DC_Input1_Power': 880, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.76, 'DC_Input2_Power': 512, 'DC_Input2_Voltage': 349.23, 'DC_Input2_Current': 1.467, 'Device_Temperature': 41.6, 'Total_Yield': 37575.008, 'Operating_Time': 75012809, 'Feed-in_Time': 74456275, 'Intermediate_Circuit_Voltage': 519.93, 'Isolation_Resistance': 3000000, 'timestamp': 1631716620.1804874}
PV:{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1360, 'daily yield': 10.957, 'AC_Current': 5.837, 'Grid_Frequency': 50.0, 'DC_Input1_Power': 878, 'DC_Input1_Voltage': 497.27, 'DC_Input1_Current': 1.766, 'DC_Input2_Power': 512, 'DC_Input2_Voltage': 352.01, 'DC_Input2_Current': 1.451, 'Device_Temperature': 41.6, 'Total_Yield': 37575.009, 'Operating_Time': 75012812, 'Feed-in_Time': 74456278, 'Intermediate_Circuit_Voltage': 517.78, 'Isolation_Resistance': 3000000, 'timestamp': 1631716623.4906366}
{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1360, 'daily yield': 10.957, 'AC_Current': 5.837, 'Grid_Frequency': 50.0, 'DC_Input1_Power': 878, 'DC_Input1_Voltage': 497.27, 'DC_Input1_Current': 1.766, 'DC_Input2_Power': 512, 'DC_Input2_Voltage': 352.01, 'DC_Input2_Current': 1.451, 'Device_Temperature': 41.6, 'Total_Yield': 37575.009, 'Operating_Time': 75012812, 'Feed-in_Time': 74456278, 'Intermediate_Circuit_Voltage': 517.78, 'Isolation_Resistance': 3000000, 'timestamp': 1631716623.4906366}
PV:{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1350, 'daily yield': 10.957, 'AC_Current': 5.81, 'Grid_Frequency': 50.0, 'DC_Input1_Power': 878, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.757, 'DC_Input2_Power': 511, 'DC_Input2_Voltage': 351.97, 'DC_Input2_Current': 1.455, 'Device_Temperature': 41.7, 'Total_Yield': 37575.011, 'Operating_Time': 75012816, 'Feed-in_Time': 74456282, 'Intermediate_Circuit_Voltage': 519.93, 'Isolation_Resistance': 3000000, 'timestamp': 1631716627.0957444}
{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1350, 'daily yield': 10.957, 'AC_Current': 5.81, 'Grid_Frequency': 50.0, 'DC_Input1_Power': 878, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.757, 'DC_Input2_Power': 511, 'DC_Input2_Voltage': 351.97, 'DC_Input2_Current': 1.455, 'Device_Temperature': 41.7, 'Total_Yield': 37575.011, 'Operating_Time': 75012816, 'Feed-in_Time': 74456282, 'Intermediate_Circuit_Voltage': 519.93, 'Isolation_Resistance': 3000000, 'timestamp': 1631716627.0957444}
PV:{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1348, 'daily yield': 10.959, 'AC_Current': 5.8, 'Grid_Frequency': 50.0, 'DC_Input1_Power': 878, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.756, 'DC_Input2_Power': 510, 'DC_Input2_Voltage': 357.62, 'DC_Input2_Current': 1.437, 'Device_Temperature': 41.7, 'Total_Yield': 37575.012, 'Operating_Time': 75012819, 'Feed-in_Time': 74456285, 'Intermediate_Circuit_Voltage': 519.93, 'Isolation_Resistance': 3000000, 'timestamp': 1631716630.4008582}
{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1348, 'daily yield': 10.959, 'AC_Current': 5.8, 'Grid_Frequency': 50.0, 'DC_Input1_Power': 878, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.756, 'DC_Input2_Power': 510, 'DC_Input2_Voltage': 357.62, 'DC_Input2_Current': 1.437, 'Device_Temperature': 41.7, 'Total_Yield': 37575.012, 'Operating_Time': 75012819, 'Feed-in_Time': 74456285, 'Intermediate_Circuit_Voltage': 519.93, 'Isolation_Resistance': 3000000, 'timestamp': 1631716630.4008582}
PV:{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1348, 'daily yield': 10.961, 'AC_Current': 5.8, 'Grid_Frequency': 49.99, 'DC_Input1_Power': 877, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.755, 'DC_Input2_Power': 510, 'DC_Input2_Voltage': 353.42, 'DC_Input2_Current': 1.446, 'Device_Temperature': 41.6, 'Total_Yield': 37575.013, 'Operating_Time': 75012822, 'Feed-in_Time': 74456288, 'Intermediate_Circuit_Voltage': 519.13, 'Isolation_Resistance': 3000000, 'timestamp': 1631716633.7060308}
{'serial': 2130432209, 'Status': 'OK', 'DeviceClass': 'Solar Inverter', 'DeviceID': 'SB 5000TL-21', 'Device Name': 'SB 5000TL-21 209', 'AC Power': 1348, 'daily yield': 10.961, 'AC_Current': 5.8, 'Grid_Frequency': 49.99, 'DC_Input1_Power': 877, 'DC_Input1_Voltage': 499.97, 'DC_Input1_Current': 1.755, 'DC_Input2_Power': 510, 'DC_Input2_Voltage': 353.42, 'DC_Input2_Current': 1.446, 'Device_Temperature': 41.6, 'Total_Yield': 37575.013, 'Operating_Time': 75012822, 'Feed-in_Time': 74456288, 'Intermediate_Circuit_Voltage': 519.13, 'Isolation_Resistance': 3000000, 'timestamp': 1631716633.7060308}
^CTraceback (most recent call last):
  File "/opt/smaemd/sma-daemon.py", line 162, in <module>
    daemon.run()
  File "/opt/smaemd/sma-daemon.py", line 139, in run
    featurelist[featurenr]['feature'].run(emparts,featurelist[featurenr]['config'])
  File "/opt/smaemd/features/pvdata.py", line 84, in run
    mdata = get_pv_data(host, int(port), int(modbusid), relevant_registers)
  File "/opt/smaemd/features/smamodbus.py", line 458, in get_pv_data
    received = client.read_input_registers(address=addr, count=modbusdatatype[dt], unit=int(modbusid))
  File "/usr/local/lib/python3.7/dist-packages/pymodbus/client/common.py", line 125, in read_input_registers
    return self.execute(request)
  File "/usr/local/lib/python3.7/dist-packages/pymodbus/client/sync.py", line 109, in execute
    return self.transaction.execute(request)
  File "/usr/local/lib/python3.7/dist-packages/pymodbus/transaction.py", line 178, in execute
    broadcast=broadcast
  File "/usr/local/lib/python3.7/dist-packages/pymodbus/transaction.py", line 293, in _transact
    result = self._recv(response_length, full)
  File "/usr/local/lib/python3.7/dist-packages/pymodbus/transaction.py", line 325, in _recv
    read_min = self.client.framer.recvPacket(min_size)
  File "/usr/local/lib/python3.7/dist-packages/pymodbus/framer/__init__.py", line 49, in recvPacket
    return self.client.recv(size)
  File "/usr/local/lib/python3.7/dist-packages/pymodbus/client/sync.py", line 89, in recv
    return self._recv(size)
  File "/usr/local/lib/python3.7/dist-packages/pymodbus/client/sync.py", line 294, in _recv
    ready = select.select([self.socket], [], [], end - time_)
sellth commented 3 years ago

Ok, good. It's working now, right?

broke23 commented 3 years ago

it works! I see data in SMAZP now instead of only SMAEM!

broke23 commented 3 years ago

Thanks a lot you guys for helping out and pinpoint little errors from me and in config as well.

sellth commented 3 years ago

You're welcome. Have fun logging your PV production.

@datenschuft could you merge #57 #58 & #65 ? Should prevent this type of error in the future.