Skip to content

Commit a2a51f4

Browse files
committed
Don't hardcode protocol version in each type of request/response class.
1 parent 647e344 commit a2a51f4

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

PyGrowatt/Growatt.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class GrowattAnnounceResponse(GrowattResponse):
106106
function_code = 0x03
107107

108108
def __init__(self, **kwargs):
109-
GrowattResponse.__init__(self, protocol=6, **kwargs)
109+
GrowattResponse.__init__(self, **kwargs)
110110
self.wifi_serial = kwargs.get('wifi_serial', [])
111111
self.inverter_serial = kwargs.get('inverter_serial', [])
112112

@@ -135,7 +135,7 @@ class GrowattAnnounceRequest(GrowattRequest):
135135
"""
136136

137137
def __init__(self, **kwargs):
138-
GrowattRequest.__init__(self, protocol=6, **kwargs)
138+
GrowattRequest.__init__(self, **kwargs)
139139
self.wifi_serial = kwargs.get('wifi_serial', [])
140140
self.device_serial = kwargs.get('device_serial', [])
141141
self.active_rate = kwargs.get('active_rate', 0)
@@ -207,7 +207,7 @@ class GrowattEnergyResponse(GrowattResponse):
207207
function_code = 0x04
208208

209209
def __init__(self, **kwargs):
210-
GrowattResponse.__init__(self, protocol=6, **kwargs)
210+
GrowattResponse.__init__(self, **kwargs)
211211

212212
def encode(self):
213213
""" ACK the Energy message
@@ -232,7 +232,7 @@ class GrowattEnergyRequest(GrowattRequest):
232232
function_code = 0x04
233233

234234
def __init__(self, **kwargs):
235-
GrowattRequest.__init__(self, protocol=6, **kwargs)
235+
GrowattRequest.__init__(self, **kwargs)
236236
self.wifi_serial = []
237237
self.inverter_serial = []
238238
self.year = 0
@@ -339,7 +339,7 @@ class GrowattPingResponse(GrowattResponse):
339339
function_code = 0x16
340340

341341
def __init__(self, **kwargs):
342-
GrowattResponse.__init__(self, protocol=6, **kwargs)
342+
GrowattResponse.__init__(self, **kwargs)
343343
self.wifi_serial = kwargs.get('wifi_serial', [])
344344

345345
def encode(self):
@@ -362,7 +362,7 @@ class GrowattPingRequest(GrowattRequest):
362362
function_code = 0x16
363363

364364
def __init__(self, **kwargs):
365-
GrowattRequest.__init__(self, protocol=6, **kwargs)
365+
GrowattRequest.__init__(self, **kwargs)
366366
self.wifi_serial = kwargs.get('wifi_serial', [])
367367

368368
def encode(self):
@@ -389,7 +389,7 @@ class GrowattConfigResponse(GrowattResponse):
389389
function_code = 0x18
390390

391391
def __init__(self, **kwargs):
392-
GrowattResponse.__init__(self, protocol=6, **kwargs)
392+
GrowattResponse.__init__(self, **kwargs)
393393
self.wifi_serial = kwargs.get("wifi_serial", [])
394394
self.config_id = kwargs.get("config_id", 0)
395395
self.config_value = kwargs.get("config_value", '')
@@ -421,7 +421,7 @@ class GrowattConfigRequest(GrowattRequest):
421421
function_code = 0x18
422422

423423
def __init__(self, **kwargs):
424-
GrowattRequest.__init__(self, protocol=6, **kwargs)
424+
GrowattRequest.__init__(self, **kwargs)
425425
self.wifi_serial = kwargs.get("wifi_serial", [])
426426
self.config_id = kwargs.get("config_id", 0)
427427
self.config_value = kwargs.get("config_value", '')
@@ -450,7 +450,7 @@ class GrowattQueryResponse(GrowattResponse):
450450
function_code = 0x19
451451

452452
def __init__(self, **kwargs):
453-
GrowattResponse.__init__(self, protocol=6, **kwargs)
453+
GrowattResponse.__init__(self, **kwargs)
454454
self.wifi_serial = kwargs.get("wifi_serial", [])
455455
self.first_config = kwargs.get("first_config", 0)
456456
self.last_config = kwargs.get("last_config", None)
@@ -483,7 +483,7 @@ class GrowattQueryRequest(GrowattRequest):
483483
function_code = 0x19
484484

485485
def __init__(self, **kwargs):
486-
GrowattRequest.__init__(self, protocol=6, **kwargs)
486+
GrowattRequest.__init__(self, **kwargs)
487487
self.wifi_serial = kwargs.get("wifi_serial", [])
488488
self.config_id = kwargs.get("config_id", 0)
489489
self.config_value = kwargs.get("config_value", '')
@@ -534,7 +534,7 @@ class GrowattBufferedEnergyResponse(GrowattResponse):
534534
function_code = 0x50
535535

536536
def __init__(self, **kwargs):
537-
GrowattResponse.__init__(self, protocol=6, **kwargs)
537+
GrowattResponse.__init__(self, **kwargs)
538538
self.wifi_serial = kwargs.get('wifi_serial', [])
539539

540540
def encode(self):
@@ -557,7 +557,7 @@ class GrowattBufferedEnergyRequest(GrowattRequest):
557557
function_code = 0x50
558558

559559
def __init__(self, **kwargs):
560-
GrowattRequest.__init__(self, protocol=6, **kwargs)
560+
GrowattRequest.__init__(self, **kwargs)
561561
self.wifi_serial = kwargs.get("wifi_serial", [])
562562
self.inverter_serial = kwargs.get("inverter_serial", [])
563563
self.year = kwargs.get("year", 0)

0 commit comments

Comments
 (0)