Closed Tinus016 closed 1 year ago
Same problem for me 2022-11-19 18:37:59.199 Error: Growatt Inverter: Call to function 'onMessage' failed, exception details: 2022-11-19 18:37:59.200 Error: Growatt Inverter: Traceback (most recent call last): 2022-11-19 18:37:59.200 Error: Growatt Inverter: File "/home/pi/domoticz/plugins/Domoticz-Growatt-Webserver-Plugin/plugin.py", line 275, in onMessage 2022-11-19 18:37:59.200 Error: Growatt Inverter: _plugin.onMessage(Connection, Data) 2022-11-19 18:37:59.200 Error: Growatt Inverter: File "/home/pi/domoticz/plugins/Domoticz-Growatt-Webserver-Plugin/plugin.py", line 172, in onMessage 2022-11-19 18:37:59.201 Error: Growatt Inverter: apiResponse = json.loads(strData) 2022-11-19 18:37:59.201 Error: Growatt Inverter: File "/usr/lib/python3.7/json/init.py", line 348, in loads 2022-11-19 18:37:59.201 Error: Growatt Inverter: return _default_decoder.decode(s) 2022-11-19 18:37:59.201 Error: Growatt Inverter: File "/usr/lib/python3.7/json/decoder.py", line 337, in decode 2022-11-19 18:37:59.201 Error: Growatt Inverter: obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 2022-11-19 18:37:59.201 Error: Growatt Inverter: File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode 2022-11-19 18:37:59.201 Error: Growatt Inverter: raise JSONDecodeError("Expecting value", s, err.value) from None 2022-11-19 18:37:59.201 Error: Growatt Inverter: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I have tried to find it out my self, but no success at this moment. I also put the highest level of debug on and that tells me this:
19-11-2022 | 16:55:01.615 | Growatt: >'Status':'200'
19-11-2022 | 16:55:01.615 | Growatt: >'Headers':
19-11-2022 | 16:55:01.615 | Growatt: ---->'Server':'Tengine'
19-11-2022 | 16:55:01.615 | Growatt: ---->'Content-Type':'application/json;charset=UTF-8'
19-11-2022 | 16:55:01.615 | Growatt: ---->'Transfer-Encoding':'chunked'
19-11-2022 | 16:55:01.615 | Growatt: ---->'Connection':'keep-alive'
19-11-2022 | 16:55:01.615 | Growatt: ---->'Vary':'Accept-Encoding'
19-11-2022 | 16:55:01.615 | Growatt: ---->'Date':'Sat, 19 Nov 2022 15:55:01 GMT'
19-11-2022 | 16:55:01.615 | Growatt: ---->'Set-Cookie':
19-11-2022 | 16:55:01.615 | Growatt: --------['JSESSIONID=A830E37613389AF6211DC2513BA2F5A6; Path=/; HttpOnly']
19-11-2022 | 16:55:01.615 | Growatt: --------['SERVERID=c6ce5dcf4bc4a6d94703a96816e904f0\|1668873301\|1668873301;Path=/']
19-11-2022 | 16:55:01.615 | Growatt: ---->'Via':'cache26.l2de2[63,0], cache7.nl2[304,0]'
19-11-2022 | 16:55:01.615 | Growatt: ---->'Timing-Allow-Origin':'*'
19-11-2022 | 16:55:01.615 | Growatt: ---->'EagleId':'2ff6309b16688733012721957e'
19-11-2022 | 16:55:01.616 | Growatt: ---->'Content-Encoding':'gzip'
19-11-2022 | 16:55:01.616 | Growatt: >'Data':'b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03tS\xc1n\xdb0\x0c\xfd\x95A\xe7\xb4\xb0\xe5:N\|Z\x9a\x06C\x80 \x0b\xb6\xb6\x03V\x0c\x03-\xd3\x8e\x10Y\xf2$9EQ\xf4\xdfG\xc9\xce\xbaK\xe1\x8bEQ\xe4\xe3{\x8f\xaf\xac\x02qb\xe5+\xeb\\\xcbJ\xc6f\xcc\x1b\x0f\xea\x0e<P\xf4m\xc6\xea\xf8\xf7\xf4\xcaz\x05\xdaokJ\xe2\xd9\x82\xa7\x05\xa5\xc6\xd0\x1e:\xa4\xe0\xadA\xfb\xfb\xa7\xd1\xec\xed\x17=\xc2\xb3\x14\xb86\x83\xf6t\x95R\xaat_{\xd4w1\xbe\x93\x8e\xc2\xe9\x8c\xfd\x19@I\xffB)ILY\x1fQ\x9c\x1e\x1c\xda\xd5\xe0\x8f\xac\xf4v\xc0\x10\xdeH\x11\x83u\xfd\xbd\x03\xeb\xc7"\xef\xd7\xef\x85\x0f`\xa1s\xacLB\xf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\xc6\x89\xf9\xc0\x95Q8I\xe4:\xb77>.\xc3dE\x1d\x8f\xef\xb8\xa5;LK\xf0\r\xdb\xcb\x9a\x11\xf8\xcd\x88)\xc8<-D\xc2\x93\x04P\x14\xb8\xac\x05\xf0<\x1ci%\x16\xbc\x81\xac\x80\xe4/\x00\x00\x00\xff\xff2NRB\x8a\x83\x90\xcc\\\x88{\x8d\x80\x8e5\xd45\xb4T02\xb625\xb52\x00\xb9\x17d2\xccU\x90\xb8CJ<\xfe\xc5\xb8B\tTj9&\x17"Rv\n\x90U\x94\x99TZ\x92\x8f\x1a/\xc9\xc0T\xe3\x99\x97\x92Z\x01L\x98\xb5\xb0\xd2\x04\\\xcc\xb8%\xe6f\xe6T\xc2\xa2$>\x19\x92\xbc\x0c\x95jk\x01\x00\x00\x00\xff\xff\x03\x00\xa5\x17]\'5\x05\x00\x00''
19-11-2022 | 16:55:01.616 | Error: Growatt: Call to function 'onMessage' failed, exception details:
19-11-2022 | 16:55:01.617 | Error: Growatt: Traceback (most recent call last):
19-11-2022 | 16:55:01.617 | Error: Growatt: File "/home/pi/domoticz/plugins/Domoticz-Growatt-Webserver-Plugin/plugin.py", line 285, in onMessage
19-11-2022 | 16:55:01.618 | Error: Growatt: _plugin.onMessage(Connection, Data)
19-11-2022 | 16:55:01.618 | Error: Growatt: File "/home/pi/domoticz/plugins/Domoticz-Growatt-Webserver-Plugin/plugin.py", line 171, in onMessage
19-11-2022 | 16:55:01.618 | Error: Growatt: apiResponse = json.loads(strData)
19-11-2022 | 16:55:01.618 | Error: Growatt: File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
19-11-2022 | 16:55:01.618 | Error: Growatt: return _default_decoder.decode(s)
19-11-2022 | 16:55:01.618 | Error: Growatt: File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
19-11-2022 | 16:55:01.618 | Error: Growatt: obj, end = self.raw_decode(s, idx=_w(s, 0).end())
19-11-2022 | 16:55:01.618 | Error: Growatt: File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
19-11-2022 | 16:55:01.618 | Error: Growatt: raise JSONDecodeError("Expecting value", s, err.value) from None
19-11-2022 | 16:55:01.618 | Error: Growatt: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
In my opinion there is something wrong with the received data. It's expecting a encoded JSON but it's no JSON or so
same problem here 2 years aga, they fixed the plugin https://github.com/stas-demydiuk/domoticz-zigbee2mqtt-plugin/issues/521
As temporary fix i use this: domoticz.local:8080/json.htm?type=command¶m=udevice&idx=IDX&nvalue=0&svalue=0;Total amount from the Growatt app by 1000
forget the .
and add 00
in my case:
domoticz.local:8080/json.htm?type=command¶m=udevice&idx=17&nvalue=0&svalue=0;6714300
I do this once a day at the end off the day otherwise my "real use counter" is out of sinq
Can you give the following a try: So add a # 2 times in front of the encoding of 'Accept-Encoding': 'gzip'
def apiRequestHeaders(self): # Needed headers for Login Function
return {
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
'Connection': 'keep-alive',
'Host': 'server-api.growatt.com',
'User-Agent': 'Domoticz/1.0'
# 'Accept-Encoding': 'gzip'
}
def apiRequestHeaders_cookie(self): # Needed headers for Data retrieval
return {
'Verb': 'POST',
'URL': '/newTwoPlantAPI.do?op=getUserCenterEnertyDataByPlantid',
'Headers' : { 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
'Connection': 'keep-alive',
'Host': 'server-api.growatt.com',
'User-Agent': 'Domoticz/1.0',
# 'Accept-Encoding': 'gzip',
'Cookie': ['JSESSIONID='+self.sessionId, 'SERVERID='+self.serverId]
},
I had the same problem and the 2 times # works for me, thanks
Can you give the following a try: So add a # 2 times in front of the encoding of 'Accept-Encoding': 'gzip'
def apiRequestHeaders(self): # Needed headers for Login Function return { 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'Connection': 'keep-alive', 'Host': 'server-api.growatt.com', 'User-Agent': 'Domoticz/1.0' # 'Accept-Encoding': 'gzip' } def apiRequestHeaders_cookie(self): # Needed headers for Data retrieval return { 'Verb': 'POST', 'URL': '/newTwoPlantAPI.do?op=getUserCenterEnertyDataByPlantid', 'Headers' : { 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'Connection': 'keep-alive', 'Host': 'server-api.growatt.com', 'User-Agent': 'Domoticz/1.0', # 'Accept-Encoding': 'gzip', 'Cookie': ['JSESSIONID='+self.sessionId, 'SERVERID='+self.serverId] },
This fixed the issue!! Thank you very much!
Can you give the following a try: So add a # 2 times in front of the encoding of 'Accept-Encoding': 'gzip'
def apiRequestHeaders(self): # Needed headers for Login Function return { 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'Connection': 'keep-alive', 'Host': 'server-api.growatt.com', 'User-Agent': 'Domoticz/1.0' # 'Accept-Encoding': 'gzip' } def apiRequestHeaders_cookie(self): # Needed headers for Data retrieval return { 'Verb': 'POST', 'URL': '/newTwoPlantAPI.do?op=getUserCenterEnertyDataByPlantid', 'Headers' : { 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'Connection': 'keep-alive', 'Host': 'server-api.growatt.com', 'User-Agent': 'Domoticz/1.0', # 'Accept-Encoding': 'gzip', 'Cookie': ['JSESSIONID='+self.sessionId, 'SERVERID='+self.serverId] },
Thanks, is working
confirm it is working fine after remark two lines ! Thanks for your quick fi. The code is ready for integration in the production version And no errors in de domoticz logfile anymore
Merged into V1.0.1
After this update still not working. I have domoticz 2022.2 and growatt pligin 1.0.1 I deleted this hw and create new without success.
2022-11-21 13:02:48.527 Status: growatt: Entering work loop. 2022-11-21 13:02:48.528 Status: growatt: Started. 2022-11-21 13:02:48.781 Status: growatt: Initialized version 1.0.1, author 'sincze' 2022-11-21 13:02:48.802 Error: growatt: Call to function 'onStart' failed, exception details: 2022-11-21 13:02:48.828 Error: growatt: Traceback (most recent call last): 2022-11-21 13:02:48.828 Error: growatt: File "/home/pi/domoticz/plugins/Domoticz-Growatt-Webserver-Plugin/plugin.py", line 265, in onStart 2022-11-21 13:02:48.828 Error: growatt: _plugin.onStart() 2022-11-21 13:02:48.828 Error: growatt: File "/home/pi/domoticz/plugins/Domoticz-Growatt-Webserver-Plugin/plugin.py", line 137, in onStart 2022-11-21 13:02:48.828 Error: growatt: createDevices() 2022-11-21 13:02:48.828 Error: growatt: File "/home/pi/domoticz/plugins/Domoticz-Growatt-Webserver-Plugin/plugin.py", line 354, in createDevices 2022-11-21 13:02:48.828 Error: growatt: image = Images["Growatt"].ID # Get id from database 2022-11-21 13:02:48.828 Error: growatt: KeyError: 'Growatt' 2022-11-21 13:02:58.006 growatt: Pushing 'onHeartbeatCallback' on to queue 2022-11-21 13:02:58.056 growatt: Processing 'onHeartbeatCallback' message ...
@hofikhof did you remove the icons as well before re-adding the plugin ???
@hofikhof did you remove the icons as well before re-adding the plugin ???
yes, in www/images
Edit: it has been created 2 devices, growatt Inverter (W) and growatt inverter (kWh) but the 3. not - it will be inverter status
You can do this from the Domoticz Inteface that will probably clean the ID's as well. I always remove via Domoticz interface not on file level.
without succes. I deleted via interface this 2 devices (inverter status has not been created as i wrote), remove hw, delete plugin, new git clone and adding, but still the same error...
Not only delete 2 devices... delete Growatt icons as described here
Gives me the follwing after I recreate the plugin from the hardware menu.
Gives me the follwing after I recreate the plugin from the hardware menu.
Now it works without errors - I see this 2 devices (inverter status has not been created but earlier yes}.... I don't need status. Thank you for your reply.
Gives me the follwing after I recreate the plugin from the hardware menu.
I use my own python script with more devices - only run as cronjob python script. If you need to upgrade your plugin please send me message.
After a few years of working perfectly, today i received the following error message. My experience with python is too low to understand what is failing now. The error message came after a few 403 messages.