76_SMAPortal - Integration SMA Sunny Portal - Ideen & Modulweiterentwicklung

Begonnen von DS_Starter, 08 Juli 2019, 18:45:46

Vorheriges Thema - Nächstes Thema

DS_Starter

Hallo Jens,

bei mir läuft es nach wie vor einwandfrei. Ich habe das interval auf 300 Sekunden stehen.
Wie oft rufst du die Daten ab ?
Schade dass du schon mit Neukonfig probiert hast, dadurch zeigen die Readings daily.* keinen realistischen Wert mehr.

Mir kommt es so vor als ob sma nutzer nach bestimmten kriterien scannt und dann ggf. kompromitiert.
Vermutlich klappt es wieder wenn du dir einen neuen user definierst und darauf achtest das interval hochzusetzen.

Lg,
Heiko
Proxmox+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

Bitschubser

Hallo Heiko,

habe wieder einen neuen User bei SMA angelegt und im Modul eingetragen. Nun läuft es wieder.
So sieht meine Definition aus, ist das mit deiner vergleichbar? Vorher hatte ich Intervall auf 180 (Standard des Moduls) stehen.

defmod MySMAPortal SMAPortal
attr MySMAPortal alias MySMAPortal
attr MySMAPortal detailLevel 4
attr MySMAPortal interval 300
attr MySMAPortal room OG->Dach,ioBroker
attr MySMAPortal userReadings L1_PV_Num { ReadingsNum("MySMAPortal","L1_PV","0") },\
L1_FeedIn_Num { ReadingsNum("MySMAPortal","L1_FeedIn","0") }
attr MySMAPortal verbose 3


LG Jens
FHEM in VM auf Proxmox, Homematic über 2x HM-Lan, Homematic-IP über Raspimatic in VM auf Proxmox, Solax-X3 G4-Wechselrichter, Pushover, TTS, Shelly + Sonoff über MQTT

DS_Starter

Moin Jens,

ja, das ist mit meiner vergleichbar. Bisher war ich immer der Meinung Intervalle >= 120 Sekunden sind unschädlich. Damit lief das Device viele Monate bis ca. Anfang des Jahres Probleme damit begannen.

Momentan arbeite ich an eine Umstrukturierung des Moduls damit man einzelne Bestandteile unabhängig voneinander abrufen kann. Der Abruf der Live Daten macht die meisten Probleme und dafür gibt es auch bessere Alternativen (SMAEM, SMAInverter,...).

LG
Proxmox+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

DS_Starter

@Holger S, teste mal bitte die Version aus meinem contrib. Deine Daten sollten nun auch wieder erstellt werden.

LG,
Heiko
Proxmox+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

BerndArnold

Zitat von: Holger S am 14 Juni 2020, 22:49:07
L1_BatteryChargeStatus funktioniert wieder aber

L1_DirectConsumption
L1_DirectConsumptionQuote


leider nicht

Die Readings L1_DirectConsumption und L1_DirectConsumptionQuote wurden bei mir zuletzt am 06.06.2020 aktualisiert. Vielleicht gibt es diese nicht mehr?

Viele Grüße
Bernd
FHEM auf Raspberry Pi mit Arch Linux
2x HM-LAN, 1x CUL
HomeMatic, FS20, Dreambox, Fritzbox
MQTT zur Kommunikation mit zweiter und dritter FHEM-Instanz

DS_Starter

Hallo zusammen,

in meinem contrib liegt eine Version 76_SMAPortal_V3.0.0.pm.
Mit dieser Version ist die Voraussetzung geschaffen, weitere Daten aufzunehmen. Die Auswertung des Logbuchs ist der nächste Schritt.

Eventuell noch auftretende sporadische Login-Fehler sollten auch eliminiert sein.

Die Versionierung 3.0.0 zeigt an, dass sich sehr viel unter der Haube getan hat. Es bedeutet auch, dass diese Version nicht kompatibel zum vorgänger ist. Die Level der Readings hat sich geändert. Sie heißen jetzt L00... - LXX....

Wer die Readingnamen in notify etc. verankert hat, muss das entsprechend anpassen !

Außerdem gibt es das Attribut detailLevel nicht mehr. Dafür verwendet man jetzt das Attribut providerLevel. Damit kann man jeden einzelnen gewünschten Datenprovider unabhängig voneinander auswählen und ist nicht mehr an die aufsteigende Abhängigkeit von detailLevel gebunden.
Die Anlagen- und Verbraucherstammdaten (L00..) werden immer abgerufen weil man diese Daten generell im Modul benötigt. 

Wenn ihr auf das neue Modul bereits umstellen und testen möchtet, ladet ihr es einfach herunter und benennt es in 76_SMAPortal.pm um. Danach restart und die Attributanpassungen vornehmen und ggf. Abhängigkeiten anpassen.

Sobald ich das Logbuch integriert habe, gebe ich wieder Bescheid.

LG,
Heiko
Proxmox+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

DS_Starter

Kleine Info zur Version 3.0.0

Nach einem Tag Laufzeit haben die Readings einen identischen Stand:


     2020-06-18 22:02:07   dailyCallCounter 18:269
     2020-06-18 22:02:08   dailyIssueCookieCounter 18:269


Das bedeutet mit dieser Version waren keinerlei Wiederholungen beim Abruf der Daten aufgetreten, es kamen auch keine fehlerhaften Logins oder unterbrochene Datenlieferungen vor.
Proxmox+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

kroonen

Hi,

I try to ue the module, but I get errors

2020.06.19 22:35:52 3: portaal - Running data cycle: 1 of 52
2020.06.19 22:35:58 3: portaal - Login into SMA-Portal successfully done
malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "(end of string)") at ./FHEM/76_SMAPortal.pm line 1858.
2020.06.19 22:36:03 1: portaal - BlockingCall FHEM::SMAPortal::GetSetData pid:DEAD:14338 Process died prematurely
2020.06.19 22:36:03 3: portaal - Cookie file deleted: ./log/portaal_cookie.txt

any idea what goes wrong?

Internals:
   CREDENTIALS Set
   FUUID      5eed2119-f33f-d772-e13b-7fc88af860916c3b
   FVERSION   76_SMAPortal.pm:v2.10.5-s22167/2020-06-12
   MODE       Automatic - next polltime: 22:40:52
   NAME       portaal
   NR         88
   STATE      running - call cycle 1
   TYPE       SMAPortal
   HELPER:
     ACTCYCLE   1
     CYCLEBTIME 1592598952
     GETTER     all
     PACKAGE    FHEM::SMAPortal
     RETRIES    1
     SETTER     none
     VERSION    2.10.5
     oldlogintime 1592598958
   OLDREADINGS:
   READINGS:
     2020-06-19 22:35:58   L1_Login-Status successful
     2020-06-19 22:35:52   dailyCallCounter 19:3
     2020-06-19 22:35:58   dailyIssueCookieCounter 19:2
     2020-06-19 22:34:47   state           running - call cycle 1
Attributes:
   detailLevel 4


DS_Starter

Guten Morgen, Good morning,

in meinem contrib enthält die Version 3.0.0 76_SMAPortal.pm nun auch das integrierte Logbuch (File 76_SMAPortal_V3.0.0.pm ist gelöscht).
Um den Abruf des Logbuches zu aktivieren, fügt man im Attribut providerLevel den Eintrag plantLogbook hinzu.

Es gibt weitere Attribute zur Steuerung des Abrufs:

* plantLogbookApprovalState
Mit diesem Attribut werden die Einträge entsprechend ihres Status gefiltert.
(default: Any)

    Any                 - alle Mitteilungen
    NotApproved   - nicht bestätigte Mitteilungen


* plantLogbookTypes
Mit diesem Attribut werden die zu selektierenden Mitteilungstypen des Anlagenlogbuchs festgelegt. Es werden maximal die aktuellsten 25 Logbucheinträge aller eingestellten Typen angezeigt.
(default: Warning,Disturbance,Error)

@kroonen,
your problem is probably related to a UTF8 issue. In my Contrib directory there is an advanced version 3.0.0 which is not yet released. Please test this version to see if your problem is solved. Note the attribute providerLevel to select the required data providers.
The new version 3.0.0 has a different structure than the version 2.10.5. Attributes and also the reading structure has changed.

To download, enter in the FHEMWEB command line including the execution characters and then restart FHEM:


"wget -qO ./FHEM/76_SMAPortal.pm https://svn.fhem.de/fhem/trunk/fhem/contrib/DS_Starter/76_SMAPortal.pm"


LG,
Heiko
Proxmox+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

kroonen

Grabbed the new version, looks better, but still errors . and still no graphs on SMAPortalSPG


2020.06.20 11:09:10 3: portaal - Login into SMA-Portal successfully done with user: richard@*****.eu
2020.06.20 11:09:10 4: portaal - Getting liveData
2020.06.20 11:09:10 4: portaal - ##### extracting live data ####
2020.06.20 11:09:10 4: portaal - Getting weatherData
2020.06.20 11:09:10 4: portaal - ##### extracting weather data ####
2020.06.20 11:09:10 4: portaal - Weatherdata content "today": $VAR1 = {
          'Temperature' => '17.5242023468018',
          'WeatherIcon' => '/Images/Dashboard/Weather/00.png',
          'TemperatureSymbol' => "\x{b0}C",
          'WeatherDescription' => 'Cloudless'
        };

2020.06.20 11:09:10 4: portaal - Weatherdata content "tomorrow": $VAR1 = {
          'WeatherDescription' => 'Cloudless',
          'TemperatureSymbol' => "\x{b0}C",
          'WeatherIcon' => '/Images/Dashboard/Weather/00.png',
          'Temperature' => '19.6010437011719'
        };

2020.06.20 11:09:10 4: portaal - Getting balanceDayData
2020.06.20 11:09:10 4: portaal - ##### extracting balance data ####
malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "(end of string)") at ./FHEM/76_SMAPortal.pm line 2121.
2020.06.20 11:09:16 1: portaal - BlockingCall FHEM::SMAPortal::GetSetData pid:DEAD:7635 Process died prematurely
2020.06.20 11:09:16 3: portaal - Cookie file deleted: ./log/portaal_cookie.txt



fhem> l portaal
Internals:
   CREDENTIALS Set
   FUUID      5eed2119-f33f-d772-e13b-7fc88af860916c3b
   FVERSION   76_SMAPortal.pm:v3.0.0-s22149/2020-06-09
   MODE       Automatic - next polltime: 11:14:04
   NAME       portaal
   NR         88
   STATE      running - call cycle 1
   TYPE       SMAPortal
   HELPER:
     ACTCYCLE   1
     CYCLEBTIME 1592644144
     GETTER     all
     PACKAGE    FHEM::SMAPortal
     RETRIES    1
     SETTER     none
     SPGDETAIL
     SPGDEV     SPG3.portaal
     SPGROOM    SMAPortal
     VERSION    3.0.0
     oldlogintime 1592644150
   OLDREADINGS:
   READINGS:
     2020-06-20 11:09:04   dailyCallCounter 20:8
     2020-06-20 11:09:10   dailyIssueCookieCounter 20:8
     2020-06-20 11:09:10   loginState      successful
     2020-06-20 11:09:04   state           running - call cycle 1
Attributes:
   providerLevel balanceDayData,consumerCurrentdata,consumerDayData,consumerMonthData,consumerYearData,forecastData,liveData,weatherData,plantLogbook
   verbose    4

DS_Starter

Grabbed the new version, looks better, but still errors . and still no graphs on SMAPortalSPG
You get no data because of the broken process ...BlockingCall FHEM::SMAPortal::GetSetData pid:DEAD:7635 Process died prematurely. Thats why no graph data occure.

Ok, please set the attribute verbose 5 and attribute  verbose5Data = balanceDayData.
Take a new data get cycle and post the log entries (may be a lot).

May be it is only a problem with the data provider balanceDayData. Please deselect it in attr providerLevel and take a new data cycle.
Proxmox+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

kroonen

This looks better, stil no mages or graph visible in SMAPortalSPG.

SMA Sunny Portal Graphics - Forecast Generation
Awaiting minor level forecast data ...

Also issue someting with plant id to set?


2020.06.20 11:53:12 3: portaal - ################################################################
2020.06.20 11:53:12 3: portaal - ###      start new set/get data from SMA Sunny Portal        ###
2020.06.20 11:53:12 3: portaal - ################################################################
2020.06.20 11:53:12 4: portaal - calculated cycles summary time: 5.6
2020.06.20 11:53:12 4: portaal - calculated maximum cycles:      52
2020.06.20 11:53:12 4: portaal - calculated timeout:             286
2020.06.20 11:53:12 3: portaal - Running data cycle: 1 of 52
2020.06.20 11:53:13 5: portaal - Start operation with CookieLocation: ./log/portaal_cookie.txt and UserAgent: Mozilla/5.
0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)
2020.06.20 11:53:13 5: portaal - data get: all, data set: none
2020.06.20 11:53:13 4: portaal - User not logged in. Try login with credentials ...
2020.06.20 11:53:13 4: portaal - Credentials read from RAM: richard@******n.eu ********
2020.06.20 11:53:13 3: portaal - Login into SMA-Portal successfully done with user: richard@******n.eu
2020.06.20 11:53:13 4: portaal - Getting weatherData
GET https://www.sunnyportal.com/Dashboard/Weather
Connection: keep-alive
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US;q=0.7,en;q=0.3
Host: www.sunnyportal.com
Referer: https://www.sunnyportal.com/FixedPages/HoManLive.aspx
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)
Cookie: collapseNavi_state=shown; SunnyPortalPageCounter=0; ASP.NET_SessionId=0mf23q4wowkncjvgfgfqzxlh; BIGipServerPool_
P_SunnyPortal=3154421952.20480.0000; .SunnyPortalFormsLogin=D7DDD1B0231706375FED401067F4406585B59C330C5795F5C96973BA9C1E
51C53B15561DE3E2F1C734E1ED59E75AB269E15655A14D2D8902BE02526369D07B25FF115B3EF6AE3E241350FFA4A8806CA857996D407BE53FC98AFD
ABCBC9268CFF2AC1FBA51B5F5C3856C4B456CD33BD179632A59730ADB9FCF6FD1BEF25B18E87DFFDA46271F884AD790CE68EB92A91317C1F2A1509D5
2C1B2D2E518EC2545AF4763BD614EA9165F8B06EE961CC9D12103012DE260C5EF0901BE0B1C4AB7CD4C8DC24FC31A2B745B26457F9753EE6EEB75DC0
312A3564E98308103A7EF997E5BD9EC691EB1C7F5929A90FF39F5BB7095A85EADBE9349CBAD7E3B88546AD82780050F28210DB11E7E5F3A4358BA209
99E96D5FDADEB26FC24F41D8FE8F1BA1F5964ED0F64BA5DEDC0091CDBF7DDAD49B6846C12D2D96A3B36CB6A27A197111B57E02E02F041FC67F18B46B
AF2DA6649AF5A6E792C0E76A8103C5ACF2484069FC6D1D2705EDCA36706ACF95AA5E063086EFFF227E823E4D39FFD9236F973BFB13603607A7A694B3
BFD7FEAB05C25FB673C0810FBD16C2C1AEF617EA988D383599D254CEA8F1C005DF54AEF9E9D43BD8587D4555F7B9196473D2D648C78AD8C083D2945D
ED522A35AB44F691D17D083CC2DF43B36E08F03C83C21C5BC20ECF1AA10DA18732E64654D2A81D3F78774F97A6592645BDF106DA3338D4BD8A62E728
606DEA5996E89B4E9A0B9576C1B75BF67C9E8963DFEE92D11AEF00DBBED1E4F10FB2EBEF79B8F11278523C8F7B9EF2252FF0732EE8316D1F34FA7D08
E5D9561C8017B094CD15
Cookie2: $Version="1"
DNT: 1
X-Requested-With: XMLHttpRequest

(no content)
HTTP/1.1 200 OK
Cache-Control: private, s-maxage=0
Date: Sat, 20 Jun 2020 09:53:18 GMT
Server: Microsoft-IIS/10.0
Content-Length: 306
Content-Type: application/json; charset=utf-8
Client-Date: Sat, 20 Jun 2020 09:53:19 GMT
Client-Peer: 171.25.178.37:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Domain Validation Secure
Server CA
Client-SSL-Cert-Subject: /OU=Domain Control Validated/OU=COMODO SSL Wildcard/CN=*.sunnyportal.com
Client-SSL-Cipher: ECDHE-RSA-AES256-GCM-SHA384
Client-SSL-Socket-Class: IO::Socket::SSL
X-AspNet-Version: 4.0.30319
X-AspNetMvc-Version: 5.2

{"today":{"WeatherIcon":"/Images/Dashboard/Weather/00.png","WeatherDescription":"Cloudless","Temperature":17.52420234680
1758,"TemperatureSymbol":"\xC2\xB0C"},"tomorrow":{"WeatherIcon":"/Images/Dashboard/Weather/00.png","WeatherDescription":
"Cloudless","Temperature":19.601043701171875,"TemperatureSymbol":"\xC2\xB0C"}}
2020.06.20 11:53:19 5: portaal - Return Code: 200
2020.06.20 11:53:19 5: portaal - weatherData received:
$VAR1 = {
          'today' => {
                       'WeatherIcon' => '/Images/Dashboard/Weather/00.png',
                       'TemperatureSymbol' => "\x{b0}C",
                       'WeatherDescription' => 'Cloudless',
                       'Temperature' => '17.5242023468018'
                     },
          'tomorrow' => {
                          'WeatherIcon' => '/Images/Dashboard/Weather/00.png',
                          'WeatherDescription' => 'Cloudless',
                          'Temperature' => '19.6010437011719',
                          'TemperatureSymbol' => "\x{b0}C"
                        }
        };

2020.06.20 11:53:19 4: portaal - ##### extracting weather data ####
2020.06.20 11:53:19 4: portaal - Weatherdata content "today": $VAR1 = {
          'WeatherIcon' => '/Images/Dashboard/Weather/00.png',
          'WeatherDescription' => 'Cloudless',
          'Temperature' => '17.5242023468018',
          'TemperatureSymbol' => "\x{b0}C"
        };

2020.06.20 11:53:19 4: portaal - Weatherdata content "tomorrow": $VAR1 = {
          'WeatherDescription' => 'Cloudless',
          'Temperature' => '19.6010437011719',
          'TemperatureSymbol' => "\x{b0}C",
          'WeatherIcon' => '/Images/Dashboard/Weather/00.png'
        };

2020.06.20 11:53:19 2: portaal - The consumer data cannot be retrieved because of the plant ID isn't set.
2020.06.20 11:53:19 3: portaal - Cookie file deleted: ./log/portaal_cookie.txt
2020.06.20 11:53:19 4: portaal - Refresh - caller: SPG3.portaal, callerroom: SMAPortal, detail: "n.a.", pload: 0, forcePageRefresh: 0, event_Spgdev: 1


DS_Starter

ZitatAlso issue someting with plant id to set?
Yes, it seems to be your root cause.

After first login the modue retrieve the asset master data, the plantOid and the consumers (if available).

In your device list you must see something like this:

     PLANTOID   9bfdbda3-9584-42e8-89fe-xxxxxxxxxx
     RETRIES    1
     SETTER     none
     VERSION    3.0.0
     oldlogintime 1592643237
     CONSUMER:
       0:
         ConsumerOid 066c4deb-7f69-463c-9522-69xxxxxxxxx
         DeviceName Geschirrspueler
         SUSyID     191
         SerialNumber 172014443
       1:
         ConsumerOid 1bfc4372-b696-4546-ad46-734xxxxxxxxx
         DeviceName Waschmaschine
         SUSyID     191
         SerialNumber 172014290


select consumerMasterdata and plantData in attr verbose5Data. Then try again.
Hope we see now the problem in log (think a lot will appear).
Proxmox+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

DS_Starter

Hi kroonen,

may be I have identified an order problem. Please wait, I will provide a new version to check this.
Proxmox+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

Bitschubser

Hallo Heiko,

meine Loginprobleme sind wieder da. Sollte ich auf deine neue Version 3 umsteigen?

LG Jens
FHEM in VM auf Proxmox, Homematic über 2x HM-Lan, Homematic-IP über Raspimatic in VM auf Proxmox, Solax-X3 G4-Wechselrichter, Pushover, TTS, Shelly + Sonoff über MQTT