Closed HanSyt closed 10 months ago
Think its because you don't have battery.
That could be the problem. However I solved the problem with a bash script. I'm not a python programmer and the code was to complex for me to alter it. So with this idea I wrote a bash script to read the data: So with this idea I wrote a bash script to read the data:
you can try to use latest pull request that support nonhybrid system and give a try
The data of the original is not merged with your code, I suggest you correct the readme.MD as well:
git clone https://github.com/ayasystems/froniusHttp.git to git clone https://github.com/gniazdoj/froniusHttp.git
I will try the code tonight.
Did try it now, unfortunately no data, used both options:
Tried DEBUG option:
My Inverter doesn't find URL from your script (/solar_api/GetInverterRealtimeData.cgi?Scope=System)
Can you drop your output from this URL? http://IP:PORT/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceID=1&DataCollection=CommonInverterData and debug output from Domoticz, what you sent is just errors. Debug will tell more, Select device with no AKU.
you can check different URL in documentation, maybe you have older firmware? https://www.fronius.com/en/photovoltaics/products/all-products/system-monitoring/open-interfaces/fronius-solar-api-json-#75ac040a-dc5d-4bfe-b49b-274216b1f709
Problem, I have a different URL: http://192.168.2.12/solar_api/GetInverterRealtimeData.cgi?Scope=System The other V1 URL does not work, this is the output:
Look in the Fronius DOC API I've sent you link to for better URL, you should be able to get much more details from your device.
to get the script to work please comment all lines that takes/update data that you don't have and change variable URL4 to your need.
lines to change are like:
URL4 = "/solar_api/GetInverterRealtimeData.cgi?Scope=System"
line 367 change condition and remove LEDColor
if((self.current==self.URL1 or self.current==self.URL4) and int(self.LEDColor) == 2 ):
to
if((self.current==self.URL1 or self.current==self.URL4) ):
from:
self.E_Day = str(jsonData['Body']['Data']['DAY_ENERGY']['Value'])
self.E_Total = str(jsonData['Body']['Data']['TOTAL_ENERGY']['Value'])
self.E_Year = str(jsonData['Body']['Data']['YEAR_ENERGY']['Value'])
try:
self.PAC = str(jsonData['Body']['Data']['PAC']['Value'])
to:
self.DAY_ENERGY = str(jsonData['Body']['Data']['DAY_ENERGY']['Values']['1'])
self.PAC = str(jsonData['Body']['Data']['PAC']['Values']['1'])
self.TOTAL_ENERGY = str(jsonData['Body']['Data']['TOTAL_ENERGY']['Values']['1'])
as you can see **['Values']['1'])**
this string is different in your output.
lines to comments are like: in function: def processResponse(self,httpResp):
self.UAC = str(jsonData['Body']['Data']['UAC']['Value'])
self.UDC = str(jsonData['Body']['Data']['UDC']['Value'])
self.IAC = str(jsonData['Body']['Data']['IAC']['Value'])
self.IDC = str(jsonData['Body']['Data']['IDC']['Value'])
self.FAC = str(jsonData['Body']['Data']['FAC']['Value'])
UpdateDevice("F_UAC", 0, self.UAC+";0")
UpdateDevice("F_UDC", 0, self.UDC+";0")
UpdateDevice("F_FAC", 0, self.FAC+";0")
UpdateDevice("F_IAC", 0, self.IAC+";0")
UpdateDevice("F_IDC", 0, self.IDC+";0")
You can try to look in URLs: http://IP/solar_api/GetInverterRealtimeData.cgi?Scope=Device&DeviceIndex=0&DataCollection=CommonInverterData http://IP/solar_api/GetInverterRealtimeData.cgi?Scope=Device&DeviceIndex=1&DataCollection=CommonInverterData
Good job @gniazdoj
I did this plugin without Fronius inverter so it is not easy fix it on my side...
Thanks for your work....
Did do the changes you suggested. However, no data is comming in Domoticz. I will publish the debug data on comment later
The output of the 2 urls:
The Debug data..
Looking on line from time 13:07:20.061 is wrong URL.
Variable URL4 should be setup to your second picture, it return exactly data I have on my side so all names should be correct. Back code to one in pull request and select under Hardware Tab Inverter Model: Fronius
URL4 = "/solar_api/GetInverterRealtimeData.cgi?Scope=Device&DeviceIndex=1&DataCollection=CommonInverterData"
my debug output for this line looks like this:
2020-11-06 13:16:56.285 (FroniusInverter) a>'Data':'b'{\n "Body" : {\n "Data" : {\n "DAY_ENERGY" : {\n "Unit" : "Wh",\n "Value" : 892.20000000000005\n },\n "DeviceStatus" : {\n "ErrorCode" : 0,\n "LEDColor" : 2,\n "LEDState" : 0,\n "MgmtTimerRemainingTime" : -1,\n "StateToReset" : false,\n "StatusCode" : 7\n },\n "FAC" : {\n "Unit" : "Hz",\n "Value" : 50.009999999999998\n },\n "IAC" : {\n "Unit" : "A",\n "Value" : 0.59999999999999998\n },\n "IDC" : {\n "Unit" : "A",\n "Value" : 0.5\n },\n "PAC" : {\n "Unit" : "W",\n "Value" : 148\n },\n "TOTAL_ENERGY" : {\n "Unit" : "Wh",\n "Value" : 82691.009999999995\n },\n "UAC" : {\n "Unit" : "V",\n "Value" : 241.19999999999999\n },\n "UDC" : {\n "Unit" : "V",\n "Value" : 323.89999999999998\n },\n "YEAR_ENERGY" : {\n "Unit" : "Wh",\n "Value" : 82691.800000000003\n }\n }\n },\n "Head" : {\n "RequestArguments" : {\n "DataCollection" : "CommonInverterData",\n "DeviceClass" : "Inverter",\n "DeviceId" : "1",\n "Scope" : "Device"\n },\n "Status" : {\n "Code" : 0,\n "Reason" : "",\n "UserMessage" : ""\n },\n "Timestamp" : "2020-11-06T13:16:53+01:00"\n }\n}\n''
I deleted the plugin and did a fresh clone from the server, changed URL4 from ID to Index
removed all created devices and restarted
Sadly no values in devices, enclosed a part of the log:
can you confirm you have:
URL4 = "/solar_api/GetInverterRealtimeData.cgi?Scope=Device&DeviceIndex=1&DataCollection=CommonInverterData"
?
I have feeling you left v1
after /solar_api/.
My mistake, corrected it:
Restarted Domoticz, sadly no values,
debug
can you drop the output from lines like:
2020-11-06 13:53:01.308 (FroniusInverter) Good Response received from Solax, Disconnecting. 2020-11-06 13:53:01.309 (FroniusInverter) ErrorCode.processResponse: 0 2020-11-06 13:53:01.309 (FroniusInverter) LEDColor.processResponse: 2 2020-11-06 13:53:01.309 (FroniusInverter) self.LEDColor.processResponse LED Status is: GREEN : 2 2020-11-06 13:53:01.309 (FroniusInverter) onConnect.#self.current: /solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceID=1&DataCollection=CommonInverterData 2020-11-06 13:53:01.310 (FroniusInverter) self.PAC.processResponse.URL4 : 124 2020-11-06 13:53:01.310 (FroniusInverter) self.E_Day.processResponse.URL4 : 962.5
maybe set URL1, URL2, URL4 to same value.
Can you validate IP address please? on one picture I can see 192.168.2.8 in Domoticz Hardware, and other picture with proper data was returned with IP: 192.168.2.12
Changing all URL's to non V1 urls did the trick:
Now it is giving output data to the devices:
So the problem seems to be solved:)
Good job @gniazdoj
I did this plugin without Fronius inverter so it is not easy fix it on my side...
Thanks for your work....
Your welcome, I love that script. This opens for all different kind of json output you can handle. Think we can pass some parameters to Hardware TAB to cover more Inverters and clarify it works only with 1 phase or "1 phase + AKU" etc. Anyway now we know that API v1, API v2, different phase options are on market requires other URL, This can be easily adjusted by changing few lines of code based on Fronius Documentation. Thanks
Thanks for helping out, switched off my bash script and continue with this one (this one has more information like the voltage of the inverters grid connection (I had problems with the inverter switching off at 248 Volt, Fronius NL fixed that.).
Guess this one caused the problem?
line 163
please look in the morning, for me it doesn't start after night, need to find out why, for now you can setup timeout on device but this produce error each 1h or what time you setup or you can add Push button - dummy switch with ON action setup to:
http://IP:PORT/json.htm?type=command¶m=updatehardware&htype=94&idx=45&name=FroniusInverter&username=&password=&address=FRONIUS_IP&port=&serialport=&Mode1=80&Mode2=Normal&Mode3=Fronius3&Mode4=&Mode5=&Mode6=0&extra=FroniusHttp&enabled=true&datatimeout=0
and Timer setup to start 00:30 After Sunrise or similar.
Guess this one caused the problem? line 163
There are some lines I don't understand why there was selection between URL1 and URL2, I just start using one URL and this could be change I think but its my first python script so I'm happy it works at all :)
I will check it tomorrow and let you know
I have no problem with the plugin starting after the night, yesterday and today it started without problem. However (there is always a but), I noticed that it does not shut down clean at night, last 2 nights it stopped working, stating a 7 Wh delivery all night. This evening I will try to check this command after it stops working: _http://192.168.2.12/solar_api/GetInverterRealtimeData.cgi?Scope=Device&DeviceIndex=1&DataCollection=CommonInverterData_ to find out what data it sends to the plugin, I assume it has something to do with ledcolor=2. My bash version could get data from the datalogger all night (not when you reset it at night time). Keep you informed
I don't have issue when URL2 = URL4 in the morning now.
line: if((self.current==self.URL1 or self.current==self.URL4) and int(self.LEDColor) == 2 ):
present status of LED Light as GREEN it means for me Inverter works fine, have enough light etc.
I have 3 states:
I have idea to create another menu for devices with API v0 and have different URL and maybe inverter works all day/night I will submit another version and you can check how it works for you.
My inverter itself does not have a web interface, it is een separate unit called datalogger. However if the unit switches off the output of the datalogger does what you wrote, led status went from 2 to 1. I can't tell you the colour of leds since I do not recognise colours to well. At the same time the web output is slightly smaller:
So I guess the reading of the led status is important for the plugin what data is readable.
I have same output when there is no sunlight for some time before Inverter will go into sleep mode. There is much less details and this cause script to generate error message each few seconds. It's why I've added LEDColor condition to avoid that. It will only update values when there is production. I don't know if your device works at night or not. I only guess script should work well, if there is sunlight and will continue to update values, if there is no sunlight it will change LEDColor to != 2 this means frequently "not enough sunlight" and skip update part, simply doing nothing.
I read this tread after all.
API detection can be done automatically: by checking API version by /solar_api/GetAPIVersion.cgi according to documentation both of them should have that API available. Simply set proper URL regarding to returned API version.
BR, Jarzyn
@ayasystems I think this issue may be closed.
Thanks!!!!
HI,
I have a fronius TL4.0 inverter with a datalogger unit. I discoverd the messages from the datalogger unit can be retreived with:
<IP>/solar_api/GetInverterRealtimeData.cgi?Scope=System
So I replaced this line in plugin.py, however I get thes errors:2020-07-26 21:51:41.949 (Fronius) Good Response received from Solax, Dropping connection. 2020-07-26 21:51:41.949 Error: (Fronius) 'onMessage' failed 'NameError'. 2020-07-26 21:51:41.949 Error: (Fronius) ----> Line 230 in '/home/pi/domoticz/plugins/froniusHttp/plugin.py', function onMessage 2020-07-26 21:51:41.949 Error: (Fronius) ----> Line 165 in '/home/pi/domoticz/plugins/froniusHttp/plugin.py', function onMessage 2020-07-26 21:51:41.949 Error: (Fronius) ----> Line 287 in '/home/pi/domoticz/plugins/froniusHttp/plugin.py', function processResponse
Maybe I need another plugin for python? Or is the data structure incompatible? This is what the datalogger sends to me.
{ "Head" : { "RequestArguments" : { "Scope" : "System" }, "Status" : { "Code" : 0, "Reason" : "", "UserMessage" : "" }, "Timestamp" : "2020-07-26T21:35:18+02:00" }, "Body" : { "Data" : { "PAC" : { "Unit" : "W", "Values" : {} }, "DAY_ENERGY" : { "Unit" : "Wh", "Values" : { "1" : 8139 } }, "YEAR_ENERGY" : { "Unit" : "Wh", "Values" : { "1" : 1687941 } }, "TOTAL_ENERGY" : { "Unit" : "Wh", "Values" : { "1" : 20687944 } } } } }
In DEBUG log I got this (I think maybe this is de Data message that is causing trouble:
2020-07-26 22:07:30.294 (Fronius) ----a>'Content-Type':'text/javascript' 2020-07-26 22:07:30.294 (Fronius) a>'Data':'b'{\n\t"Head" : {\n\t\t"RequestArguments" : {\n\t\t\t"Scope" : "System"\n\t\t},\n\t\t"Status" : {\n\t\t\t"Code" : 0,\n\t\t\t"Reason" : "",\n\t\t\t"UserMessage" : ""\n\t\t},\n\t\t"Timestamp" : "2020-07-26T22:04:31+02:00"\n\t},\n\t"Body" : {\n\t\t"Data" : {\n\t\t\t"PAC" : {\n\t\t\t\t"Unit" : "W",\n\t\t\t\t"Values" : {}\n\t\t\t},\n\t\t\t"DAY_ENERGY" : {\n\t\t\t\t"Unit" : "Wh",\n\t\t\t\t"Values" : {\n\t\t\t\t\t"1" : 8139\n\t\t\t\t}\n\t\t\t},\n\t\t\t"YEAR_ENERGY" : {\n\t\t\t\t"Unit" : "Wh",\n\t\t\t\t"Values" : {\n\t\t\t\t\t"1" : 1687941\n\t\t\t\t}\n\t\t\t},\n\t\t\t"TOTAL_ENERGY" : {\n\t\t\t\t"Unit" : "Wh",\n\t\t\t\t"Values" : {\n\t\t\t\t\t"1" : 20687944\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}'' 2020-07-26 22:07:30.294 (Fronius) Good Response received from Solax, Disconnecting.