sincze / Domoticz-Omnik-Local-Web-Plugin

Domoticz Python Plugin that can read data from the local inverter webinterface
5 stars 2 forks source link

Error #1

Closed menno99 closed 5 years ago

menno99 commented 5 years ago

Omnik serial: 64300.....

2019-08-18 11:34:22.740 Error: (Omnik inverter Zonnepanelen) 'onMessage' failed 'AttributeError':''NoneType' object has no attribute 'group''. 2019-08-18 11:34:22.740 Error: (Omnik inverter Zonnepanelen) ----> Line 202 in '/home/pi/domoticz/plugins/Domoticz-Omnik-Local-Web-Plugin/plugin.py', function onMessage 2019-08-18 11:34:22.740 Error: (Omnik inverter Zonnepanelen) ----> Line 119 in '/home/pi/domoticz/plugins/Domoticz-Omnik-Local-Web-Plugin/plugin.py', function onMessage

sincze commented 5 years ago

Thanks for the short message. Without a full debug log of what is happening I am unable to determine what goes wrong. Serial number... The plugin does not really care about that ;-)

Please enable full debug. I guess the error is in: strData = re.search(r'(?<=webData=").*?(?=";)', strData).group(0)

And maybe you can share the firmware of the inverter? It is developed on: NL1-V1.0-0118-4 / V2.0-0028. Maybe the data the plugin is looking for could be formed differently in other firmwares.

Have a look at: http://inverter-ip/js/status.js to figure out in what group the data is located. In my case:

var webData="NLDN**2017******,NL1-V1.0-0118-4,V2.0-0028,omnik4000tl ,4000,584,345,33734,,4,";

The function searches for that string and extracts data.

menno99 commented 5 years ago

Ik weet niet precies hoe ik een full-debug kan maken zodat je een eventuele fout kan achterhalen.

Ik heb het bestand status.js bijgevoegd. mogelijk kun je hier iets mee.

Laat even weten als je nog meer info wenst. Alvast super bedankt.

status js _mmm-.pdf

menno99 commented 5 years ago

firmware is: H4.01.51MW.2.01W1.0.65(2018-02-271-D)

smartcontrol19 commented 5 years ago

We have two Omnik inverters. A 3KTL2 installed in 2016 and a 2KTL3S installed in 2019.

The plugin works for the 3KTL2. However when I check the logging of Domoticz there is an Error each TWO minutes. “CConnection_disconnect, disconnection request from ‘Omnik 3K’ ignored. Transport does not exist.” Do you know what causes this error?

The opening status page of both inverters differ. For the newer 2KTL3S the plugin gives the same errors mentioned by menno99 earlier. I think this is because there is no power information on the opening status page.

For the 3KTL2 (firmware version 1.0.07) there are three sections on the opening status page: “Inverter information”, “Device information” and “Remote server information”. The first section “Inverter information” is open and contains the power information.

For the 2KTL3 (firmware version 1.0.65) there are the same three sections but in a different order. “Device information”, “Connected Inverter” and “Remote server information” The first section “Device information” is open but contains no power information. In this case you need the information of the second section “Connected Inverter”. This section opens when you select the “down arrow” of the section. When I inspect the page code in Firefox I see an event defintion for this “Arrow button” defined as [ upfold(4);child_getH(); ] For the status page of the newer firmware you have to retrieve the child data of the second section. Can this be done?

Test system information: Domoticz V4.11214 Raspberry PI Zero running Buster (python3-dev installed, without it the plugins didn’t start)

sincze commented 5 years ago

Ik weet niet precies hoe ik een full-debug kan maken zodat je een eventuele fout kan achterhalen.

Ik heb het bestand status.js bijgevoegd. mogelijk kun je hier iets mee.

Laat even weten als je nog meer info wenst. Alvast super bedankt.

status js _mmm-.pdf

Excellent.

Your code is here: myDeviceArray[0]="AANN302018CU5212,V5.04Build230,V4.13Build253,Omnik3000tl ,3000,1313,685,9429,,1,";

Mine says: var webData="NLDN2017****,NL1-V1.0-0118-4,V2.0-0028,omnik4000tl ,4000,584,345,33734,,4,";

image

Could you change the search string in the plugin.py. And restart domoticz and see if that solved the issue for you? Ofcourse we can implement a dropdown ;-) for easy purpose

smartcontrol19 commented 5 years ago

Sorry for my former comment. I was completely wrong.

I addedd an "IF ELSE" in plugin.py on the ip address of the converters. This way searching for webData for the older inverter (3KTL2) and searching for "myDeviceArray[0]" for the latest inverter (2KTL3S). It works perfectly now.

I still have Error messages in the logging for both inverters each TWO minutes: “CConnection_disconnect, disconnection request from ‘Omnik 2K’ ignored. Transport does not exist.” “CConnection_disconnect, disconnection request from ‘Omnik 3K’ ignored. Transport does not exist.”

Does anybody know the cause of these Errors?

menno99 commented 5 years ago

Ik weet niet precies hoe ik een full-debug kan maken zodat je een eventuele fout kan achterhalen. Ik heb het bestand status.js bijgevoegd. mogelijk kun je hier iets mee. Laat even weten als je nog meer info wenst. Alvast super bedankt. status js _mmm-.pdf

Excellent.

Your code is here: myDeviceArray[0]="AANN302018CU5212,V5.04Build230,V4.13Build253,Omnik3000tl ,3000,1313,685,9429,,1,";

Mine says: var webData="NLDN2017****,NL1-V1.0-0118-4,V2.0-0028,omnik4000tl ,4000,584,345,33734,,4,";

image

Could you change the search string in the plugin.py. And restart domoticz and see if that solved the issue for you? Ofcourse we can implement a dropdown ;-) for easy purpose

i use: strData = re.search(r'(?<=myDeviceArray[0]=").*?(?=";)', strData).group(0)
??? is that the right adjustment....

Error now: 2019-08-20 22:43:09.576 Error: (Omnik omvormer) 'onMessage' failed 'AttributeError':''NoneType' object has no attribute 'group''. 2019-08-20 22:43:09.576 Error: (Omnik omvormer) ----> Line 202 in '/home/pi/domoticz/plugins/Domoticz-Omnik-Local-Web-Plugin/plugin.py', function onMessage 2019-08-20 22:43:09.576 Error: (Omnik omvormer) ----> Line 119 in '/home/pi/domoticz/plugins/Domoticz-Omnik-Local-Web-Plugin/plugin.py', function onMessage

sincze commented 5 years ago

@smartcontrol19 , Can you share the modified search string for @menno99 ? If my calculations are correct it should be strData = re.search(r'(?<=myDeviceArray[0]=").*?(?=";)', strData).group(0)

smartcontrol19 commented 5 years ago

Use a backslash "\" before [ and ]

sincze commented 5 years ago

Escaping the special character nice. strData = re.search(r'(?<=myDeviceArray\[0\]=").*?(?=";)', strData).group(0)

image

menno99 commented 5 years ago

It's working now. Produce of the solar panels is visible and changes every 5 minutes. I still have an error message in the log

sincze commented 5 years ago
  • 2019-08-21 18:36:46.731 Error: CConnection_disconnect, disconnection request from 'Omnik omvormer' ignored. Transport does not exist.

I requested this on the forum as I have nu clue about that. forum

smartcontrol19 commented 5 years ago

To Sincze: Thank you for this awesome plugin.
I am very glad that I can see the solar energy of our latest Omnik inverter.

Is it possible for you to add a dropdown hardware parameter with two options. The plugin should then select the right search string based on this parameter.

The Error “Error: CConnection_disconnect …” occurs each time after calling “self.httpConn.Disconnect()”. This only happens when the disconnectcount is Odd. That is why there are always 1+1=2 minutes between these Error messages. Does the Error message tell that disconnecting is not possible?

sincze commented 5 years ago

I did the following and the error seems to go away.

#            if ((self.disconnectCount & 1) == 1):
#                Domoticz.Log("Good Response received from Inverter, Disconnecting.")
#                self.httpConn.Disconnect()
#            else:
#                Domoticz.Log("Good Response received from Inverter, Dropping connection.")
#                self.httpConn = None
#            self.disconnectCount = self.disconnectCount + 1
sincze commented 5 years ago

Modifying the Plugin with some additional security features. image

menno99 commented 5 years ago

Top! Download?