datenschuft / SMA-EM

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

Keine Pakete vom SMA-HA 2 (nur Device Discovery) #78

Open JoC0de opened 1 year ago

JoC0de commented 1 year ago

Ich bekomme mit sma-em-measuerement bzw. sma-em-capture-package lediglich Device Discovery Pakete (länge 54, mit falscher Serien-Nummer ...). Im Sunny Portal sehe ich die folgenden Informationen über den SMA-HA: image

Speedwire Konfiguration von einem der angeschlossenen SMA Geräten (Tripower) image

wolfgangr commented 1 month ago

similiar picture. tcpdump shows 58 bytes length; minus the "SMA" label yield 54.

My calculator tells me: dec 3006136413 = 0xB32E005D
This is what we see at pos 0x28. May be the rest resembles a timestamp. But no trace of usable data.
Any Idea what went wrong?

root@homeserver:/etc/smaemd$ tcpdump -i eth0 -vv -XX port 9522 
tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
19:28:40.504988 IP (tos 0x0, ttl 64, id 24998, offset 0, flags [DF], proto UDP (17), length 86)
    SMA3006136413.rosner.lokal.9522 > 192.168.1.255.9522: [udp sum ok] UDP, length 58
        0x0000:  ffff ffff ffff 00d0 934b 8ff5 0800 4500  .........K....E.
        0x0010:  0056 61a6 4000 4011 53b2 c0a8 01ef c0a8  .Va.@.@.S.......
        0x0020:  01ff 2532 2532 0042 5246 534d 4100 0004  ..%2%2.BRFSMA...
        0x0030:  02a0 0000 0001 0026 0010 6065 09a0 ffff  .......&..`e....
        0x0040:  ffff ffff 0000 7401 5d00 2eb3 0000 0000  ......t.].......
        0x0050:  0000 dc9b 0002 0000 0000 0000 0000 0000  ................
        0x0060:  0000 0000 

From sunnyportal, I can retrieve the software versions and see that auto update is enabled:

Geräte-Updates eingeschaltet        Ja  
Hardware-Version des Hauptprozessors    A1      18.11.2015 08:59:10 
Firmware-Version des Hauptprozessors    2.14.13.R   10.04.2024 01:23:42 
Firmware-Version des Betriebssystems    4.01.0.R    30.08.2023 23:18:31
wolfgangr commented 1 month ago

May be this is the solution: "direct meter communication" aka "Direkte Zähler Kommunikation"

https://www.photovoltaikforum.com/thread/148909-home-manager-2-direct-meter-communication-version-2-4-14-r/?postID=2114618#post2114618

When I enter my server as the target IP, the TCPdump changes to

20:34:58.688746 IP (tos 0x0, ttl 64, id 12351, offset 0, flags [DF], proto UDP (17), length 636)
    SMA3006136413.rosner.lokal.57844 > homeserver.rosner.lokal.9522: [udp sum ok] UDP, length 608
        0x0000:  0023 7db9 c45c 00d0 934b 8ff5 0800 4500  .#}..\...K....E.

i.e. I get messages of 608 bytes now. Both sma-em-capture-package.py and sma-em-measurement.py appear to produces sensible output now ;-)

wolfgangr commented 1 month ago

... and got demon to run, produce mqtt and simplefile output :-)))

when I start the demon from the console, it regularly (some 20 seconds or so??) produces

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/simplefswriter.py", line 27, in run
    serials=config['serials'].split(' ')
            ~~~~~~^^^^^^^^^^^
KeyError: 'serials'

My guess is that still incomplete broadcast messages are received. A glimpse into the source tells me that the exception is caught, so just a nasty but not serious warning. When I start the demon as a systemd service, the warnings go to nirwana as it seems.

I tried to fix the issue by replacing my local IP to multicastgrp, but the demon won't start then. So, let's continue to ignore this.

Would be nice for some code maintenance to find the unicast option configurable, nevertheless, as the clean solution.

wolfgangr commented 2 weeks ago

new aspect: Logfile congestion

:~$ sudo journalctl -u smaemd.service -S yesterday -U today |  wc
  16204  132396 1407620

read:
in one single day, said message produces 16 thousands lines of log in my /var/log/syslog , a total of 1.4 MB

this increases pressure to solve ....

datenschuft commented 2 weeks ago

i'm sorry. I own only a very old SMA EM (not a home manager 2). So I could not verify how the sma home manager works. In a working environment no logs (journalctl) should be generated. (depending on activated plugins) did you apply https://github.com/datenschuft/SMA-EM/commit/b7ed82311c1cd456dc51cb093d99fb359bb00f19 ?

Maybe the content of the logs suggest a hint of the problem ?

Sorry for no real help.