Difference between revisions of "SMA Webbox script"
From PhotoVoltaic Logger new generation
m |
m (→Test) |
||
Line 89: | Line 89: | ||
[10:22:30.00] --- 2 --- | [10:22:30.00] --- 2 --- | ||
[10:22:32.17] HTTP code : 201 | [10:22:32.17] HTTP code : 201 | ||
+ | |||
+ | == Cron == |
Revision as of 09:26, 9 September 2014
With this script you can acquire data from your SMA Webbox and store them in PVLng.
This script can run via cron around the clock, the Webbox will be queried only during daylight times ±60 minutes.
Location
SMA/webbox.sh
Configuration example
SMA/webbox.conf.dist
Copy this file and edit for your needs.
Global settings
Webbox IP[:Port]
optional, default "192.168.0.168:80"
WEBBOX "192.168.0.168:80"
Installer password
The plain Webbox "installer" account password. If not set, the "user" account will be used for Webbox access, with less information.
optional
PASSWORD ""
Count of inverters / Sensorboxes
Count of following sections.
required
GUID_N 0
Section to repeat
Copy the following settings as much as you need. Name the parameters for each section with the same _<#>
Inverter/Sensorbox GUID
required, but an empty GUID skips section
GUID_1 ""
Inverter/sensor box serial
The inverter/sensor box serial is requested by default via API. If you run the scripts on remote equipment, you should define them also here, so when the connection to your PVLng server fails, the data will be collected correctly.
optional
SERIAL_1 ""
Test
Run the script with your config in test & debug mode (-tv)
$ ./Webbox.sh -tv your_config.conf [10:06:45.04] --- your_config.conf --- [10:06:45.05] WEBBOX = 192.168.0.168:80 [10:06:45.06] PASSWORD = *********** [10:06:45.07] GUID_N = 2 [10:06:45.08] GUID_1 = 28b9-3791-b390-e697-06e0-8116-26c7-b9fc [10:06:45.08] SERIAL_1 = WRTP2S89:2110279112 [10:06:45.09] GUID_2 = aed0-2d4f0-63ea-170-ecfd-be49-e58b-314a [10:06:45.10] SERIAL_2 = WRTP2889:2110264761 [10:06:45.12] Fetch : http://........../api/latest/daylight/60.txt [10:06:45.18] Fetch : done [10:06:45.19] Daylight: 1 [10:06:45.20] --- 1 --- [10:06:45.21] Webbox request: [10:06:45.21] /tmp/pvlng.hR9d6h >>> [10:06:45.21] {"version":"1.0","proc":"GetProcessData","id":"1410250005","format":"JSON","params":{"devices": [{"key":"WRTP2S89:2110211279"}]},"passwd":"2f39eb0bae1604f9be0b14df8f2d0a52"} [10:06:45.21] <<< /tmp/pvlng.hR9d6h [10:06:46.70] Webbox response: [10:06:46.71] /tmp/pvlng.kUqu2E >>> [10:06:46.71] {"format":"JSON","result":{"devices":[{"key":"WRTP2S89:2110211279","channels":[{"unit":"A","meta":"A.Ms.Amp","name":"A.Ms.Amp","value":"9.430"},{"unit":"V","meta":"A.Ms.Vol","name":"A.Ms.Vol","value":"360.920"},{"unit":"W","meta":"A.Ms.Watt","name":"A.Ms.Watt","value":"3403"},{"unit":"A","meta":"A1.Ms.Amp","name":"A1.Ms.Amp","value":"4.685"},{"unit":"A","meta":"A2.Ms.Amp","name":"A2.Ms.Amp","value":"4.685"},{"unit":"A","meta":"A3.Ms.Amp","name":"A3.Ms.Amp","value":"0.034"},{"unit":"A","meta":"A4.Ms.Amp","name":"A4.Ms.Amp","value":"0.019"},{"unit":"A","meta":"A5.Ms.Amp","name":"A5.Ms.Amp","value":"0.050"},{"unit":"A","meta":"B.Ms.Amp","name":"B.Ms.Amp","value":"4.859"},{"unit":"V","meta":"B.Ms.Vol","name":"B.Ms.Vol","value":"616.200"},{"unit":"W","meta":"B.Ms.Watt","name":"B.Ms.Watt","value":"2994"},{"unit":"A","meta":"B1.Ms.Amp","name":"B1.Ms.Amp","value":"4.859"},{"unit":"","meta":"Error","name":"Error","value":"-------"},{"unit":"kWh","meta":"E-Total","name":"E-Total","value":"31485.424"},{"unit":"","meta":"GM.TotS0Out","name":"GM.TotS0Out","value":"0"},{"unit":"Wh","meta":"GM.TotWhOut","name":"GM.TotWhOut","value":"0"},{"unit":"A","meta":"GridMs.A.phsA","name":"GridMs.A.phsA","value":"8.772"},{"unit":"A","meta":"GridMs.A.phsB","name":"GridMs.A.phsB","value":"8.726"},{"unit":"A","meta":"GridMs.A.phsC","name":"GridMs.A.phsC","value":"8.724"},{"unit":"Hz","meta":"GridMs.Hz","name":"GridMs.Hz","value":"49.980"},{"unit":"V","meta":"GridMs.PhV.phsA","name":"GridMs.PhV.phsA","value":"234.910"},{"unit":"V","meta":"GridMs.PhV.phsB","name":"GridMs.PhV.phsB","value":"236.760"},{"unit":"V","meta":"GridMs.PhV.phsC","name":"GridMs.PhV.phsC","value":"236.960"},{"unit":"","meta":"GridMs.TotPF","name":"GridMs.TotPF","value":"0.999"},{"unit":"VA","meta":"GridMs.TotVA","name":"GridMs.TotVA","value":"6194"},{"unit":"VAr","meta":"GridMs.TotVAr","name":"GridMs.TotVAr","value":"0"},{"unit":"VA","meta":"GridMs.VA.phsA","name":"GridMs.VA.phsA","value":"2061"},{"unit":"VA","meta":"GridMs.VA.phsB","name":"GridMs.VA.phsB","value":"2066"},{"unit":"VA","meta":"GridMs.VA.phsC","name":"GridMs.VA.phsC","value":"2067"},{"unit":"VAr","meta":"GridMs.VAr.phsA","name":"GridMs.VAr.phsA","value":"0"},{"unit":"VAr","meta":"GridMs.VAr.phsB","name":"GridMs.VAr.phsB","value":"0"},{"unit":"VAr","meta":"GridMs.VAr.phsC","name":"GridMs.VAr.phsC","value":"0"},{"unit":"W","meta":"GridMs.W.phsA","name":"GridMs.W.phsA","value":"2061"},{"unit":"W","meta":"GridMs.W.phsB","name":"GridMs.W.phsB","value":"2066"},{"unit":"W","meta":"GridMs.W.phsC","name":"GridMs.W.phsC","value":"2067"},{"unit":"","meta":"Inv.TmpLimStt","name":"Inv.TmpLimStt","value":"NoneDrt"},{"unit":"","meta":"InvCtl.Stt","name":"InvCtl.Stt","value":"On"},{"unit":"A","meta":"Iso.FltA","name":"Iso.FltA","value":"0.010"},{"unit":"","meta":"Mode","name":"Mode","value":"Mpp"},{"unit":"h","meta":"Mt.TotOpTmh","name":"Mt.TotOpTmh","value":"11665.041226682"},{"unit":"h","meta":"Mt.TotTmh","name":"Mt.TotTmh","value":"12018.480792604"},{"unit":"","meta":"Op.EvtCntIstl","name":"Op.EvtCntIstl","value":"69"},{"unit":"","meta":"Op.EvtCntUsr","name":"Op.EvtCntUsr","value":"399"},{"unit":"","meta":"Op.EvtNo","name":"Op.EvtNo","value":"0"},{"unit":"","meta":"Op.EvtNoDvlp","name":"Op.EvtNoDvlp","value":"0"},{"unit":"","meta":"Op.GriSwCnt","name":"Op.GriSwCnt","value":"1052"},{"unit":"","meta":"Op.GriSwStt","name":"Op.GriSwStt","value":"Cls"},{"unit":"","meta":"Op.Health","name":"Op.Health","value":"Ok"},{"unit":"","meta":"Op.Prio","name":"Op.Prio","value":"NonePrio"},{"unit":"s","meta":"Op.TmsRmg","name":"Op.TmsRmg","value":"0"},{"unit":"W","meta":"Pac","name":"Pac","value":"6194"},{"unit":"","meta":"PCM-DigInStt","name":"PCM-DigInStt","value":"D0"},{"unit":"","meta":"PlntCtl.Stt","name":"PlntCtl.Stt","value":"On"},{"unit":"kOhm","meta":"Riso","name":"Riso","value":"1909.539"},{"unit":"","meta":"Serial Number","name":"Serial Number","value":"2110211279"}]}]},"proc":"GetProcessData","version":"1.0","id":"1410250005"} [10:06:46.71] <<< /tmp/pvlng.kUqu2E [10:06:46.75] --- 2 --- [10:06:46.77] Webbox request: [10:06:46.78] /tmp/pvlng.hR9d6h >>> [10:06:46.78] {"version":"1.0","proc":"GetProcessData","id":"1410250006","format":"JSON","params":{"devices":[{"key":"WRTP2889:2110276164"}]},"passwd":"2ebaea0b109eb16044df3f2d0f9bf852"} [10:06:46.78] <<< /tmp/pvlng.hR9d6h [10:06:47.56] Webbox response: [10:06:47.57] /tmp/pvlng.kUqu2E >>> [10:06:47.57] {"format":"JSON","result":{"devices":[{"key":"WRTP2889:2110276164","channels":[{"unit":"A","meta":"A.Ms.Amp","name":"A.Ms.Amp","value":"4.874"},{"unit":"V","meta":"A.Ms.Vol","name":"A.Ms.Vol","value":"517.520"},{"unit":"W","meta":"A.Ms.Watt","name":"A.Ms.Watt","value":"2522"},{"unit":"A","meta":"A1.Ms.Amp","name":"A1.Ms.Amp","value":"4.795"},{"unit":"A","meta":"A2.Ms.Amp","name":"A2.Ms.Amp","value":"0.014"},{"unit":"A","meta":"A3.Ms.Amp","name":"A3.Ms.Amp","value":"0.013"},{"unit":"A","meta":"A4.Ms.Amp","name":"A4.Ms.Amp","value":"0.013"},{"unit":"A","meta":"A5.Ms.Amp","name":"A5.Ms.Amp","value":"0.013"},{"unit":"A","meta":"B.Ms.Amp","name":"B.Ms.Amp","value":"2.052"},{"unit":"V","meta":"B.Ms.Vol","name":"B.Ms.Vol","value":"553.430"},{"unit":"W","meta":"B.Ms.Watt","name":"B.Ms.Watt","value":"1135"},{"unit":"A","meta":"B1.Ms.Amp","name":"B1.Ms.Amp","value":"2.052"},{"unit":"","meta":"Error","name":"Error","value":"-------"},{"unit":"kWh","meta":"E-Total","name":"E-Total","value":"20180.680"},{"unit":"","meta":"GM.TotS0Out","name":"GM.TotS0Out","value":"0"},{"unit":"Wh","meta":"GM.TotWhOut","name":"GM.TotWhOut","value":"0"},{"unit":"A","meta":"GridMs.A.phsA","name":"GridMs.A.phsA","value":"5.064"},{"unit":"A","meta":"GridMs.A.phsB","name":"GridMs.A.phsB","value":"5.037"},{"unit":"A","meta":"GridMs.A.phsC","name":"GridMs.A.phsC","value":"5.031"},{"unit":"Hz","meta":"GridMs.Hz","name":"GridMs.Hz","value":"49.980"},{"unit":"V","meta":"GridMs.PhV.phsA","name":"GridMs.PhV.phsA","value":"233.150"},{"unit":"V","meta":"GridMs.PhV.phsB","name":"GridMs.PhV.phsB","value":"232.230"},{"unit":"V","meta":"GridMs.PhV.phsC","name":"GridMs.PhV.phsC","value":"232.910"},{"unit":"","meta":"GridMs.TotPF","name":"GridMs.TotPF","value":"0.999"},{"unit":"VA","meta":"GridMs.TotVA","name":"GridMs.TotVA","value":"3522"},{"unit":"VAr","meta":"GridMs.TotVAr","name":"GridMs.TotVAr","value":"-1"},{"unit":"VA","meta":"GridMs.VA.phsA","name":"GridMs.VA.phsA","value":"1181"},{"unit":"VA","meta":"GridMs.VA.phsB","name":"GridMs.VA.phsB","value":"1170"},{"unit":"VA","meta":"GridMs.VA.phsC","name":"GridMs.VA.phsC","value":"1171"},{"unit":"VAr","meta":"GridMs.VAr.phsA","name":"GridMs.VAr.phsA","value":"-1"},{"unit":"VAr","meta":"GridMs.VAr.phsB","name":"GridMs.VAr.phsB","value":"0"},{"unit":"VAr","meta":"GridMs.VAr.phsC","name":"GridMs.VAr.phsC","value":"0"},{"unit":"W","meta":"GridMs.W.phsA","name":"GridMs.W.phsA","value":"1181"},{"unit":"W","meta":"GridMs.W.phsB","name":"GridMs.W.phsB","value":"1170"},{"unit":"W","meta":"GridMs.W.phsC","name":"GridMs.W.phsC","value":"1171"},{"unit":"","meta":"Inv.TmpLimStt","name":"Inv.TmpLimStt","value":"NoneDrt"},{"unit":"","meta":"InvCtl.Stt","name":"InvCtl.Stt","value":"On"},{"unit":"A","meta":"Iso.FltA","name":"Iso.FltA","value":"0.015"},{"unit":"","meta":"Mode","name":"Mode","value":"Mpp"},{"unit":"h","meta":"Mt.TotOpTmh","name":"Mt.TotOpTmh","value":"10405.611141985"},{"unit":"h","meta":"Mt.TotTmh","name":"Mt.TotTmh","value":"10800.526147331"},{"unit":"","meta":"Op.EvtCntIstl","name":"Op.EvtCntIstl","value":"134"},{"unit":"","meta":"Op.EvtCntUsr","name":"Op.EvtCntUsr","value":"8712"},{"unit":"","meta":"Op.EvtNo","name":"Op.EvtNo","value":"0"},{"unit":"","meta":"Op.EvtNoDvlp","name":"Op.EvtNoDvlp","value":"0"},{"unit":"","meta":"Op.GriSwCnt","name":"Op.GriSwCnt","value":"947"},{"unit":"","meta":"Op.GriSwStt","name":"Op.GriSwStt","value":"Cls"},{"unit":"","meta":"Op.Health","name":"Op.Health","value":"Ok"},{"unit":"","meta":"Op.Prio","name":"Op.Prio","value":"NonePrio"},{"unit":"s","meta":"Op.TmsRmg","name":"Op.TmsRmg","value":"0"},{"unit":"W","meta":"Pac","name":"Pac","value":"3522"},{"unit":"","meta":"PCM-DigInStt","name":"PCM-DigInStt","value":"D0"},{"unit":"","meta":"PlntCtl.Stt","name":"PlntCtl.Stt","value":"On"},{"unit":"kOhm","meta":"Riso","name":"Riso","value":"1289.707"},{"unit":"","meta":"Serial Number","name":"Serial Number","value":"2110276164"}]}]},"proc":"GetProcessData","version":"1.0","id":"1410250006"} [10:06:47.57] <<< /tmp/pvlng.kUqu2E
If you get no error messages here, run live in verbose mode (-v). The output should look like this with HTTP code 201 meaning data added.
$ ./Webbox.sh -v your_config.conf [10:22:28.10] --- 1 --- [10:22:30.00] HTTP code : 201 [10:22:30.00] --- 2 --- [10:22:32.17] HTTP code : 201