|  | @ -74,9 +74,11 @@ class Response: | 
			
		
	
		
		
			
				
					|  |  |         self.inverter_ser = params.get('inverter_ser', None) |  |  |         self.inverter_ser = params.get('inverter_ser', None) | 
			
		
	
		
		
			
				
					|  |  |         self.inverter_name = params.get('inverter_name', None) |  |  |         self.inverter_name = params.get('inverter_name', None) | 
			
		
	
		
		
			
				
					|  |  |         self.dtu_ser = params.get('dtu_ser', None) |  |  |         self.dtu_ser = params.get('dtu_ser', None) | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         self.response = args[0] |  |  |         self.response = args[0] | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         strings = params.get('strings', None) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         self.inv_strings = strings | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |         if isinstance(params.get('time_rx', None), datetime): |  |  |         if isinstance(params.get('time_rx', None), datetime): | 
			
		
	
		
		
			
				
					|  |  |             self.time_rx = params['time_rx'] |  |  |             self.time_rx = params['time_rx'] | 
			
		
	
		
		
			
				
					|  |  |         else: |  |  |         else: | 
			
		
	
	
		
		
			
				
					|  | @ -91,7 +93,7 @@ class Response: | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | class StatusResponse(Response): |  |  | class StatusResponse(Response): | 
			
		
	
		
		
			
				
					|  |  |     """Inverter StatusResponse object""" |  |  |     """Inverter StatusResponse object""" | 
			
		
	
		
		
			
				
					
					|  |  |     e_keys  = ['voltage','current','power','energy_total','energy_daily','powerfactor'] |  |  |     e_keys  = ['voltage','current','power','energy_total','energy_daily','powerfactor', 'reactive_power', 'irradiation'] | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |     temperature = None |  |  |     temperature = None | 
			
		
	
		
		
			
				
					|  |  |     frequency = None |  |  |     frequency = None | 
			
		
	
		
		
			
				
					|  |  |     powerfactor = None |  |  |     powerfactor = None | 
			
		
	
	
		
		
			
				
					|  | @ -333,18 +335,29 @@ class HardwareInfoResponse(UnknownResponse): | 
			
		
	
		
		
			
				
					|  |  |             { FLD_FW_VERSION,           UNIT_NONE,   CH0,  0, 2, 1 }, |  |  |             { FLD_FW_VERSION,           UNIT_NONE,   CH0,  0, 2, 1 }, | 
			
		
	
		
		
			
				
					|  |  |             { FLD_FW_BUILD_YEAR,        UNIT_NONE,   CH0,  2, 2, 1 }, |  |  |             { FLD_FW_BUILD_YEAR,        UNIT_NONE,   CH0,  2, 2, 1 }, | 
			
		
	
		
		
			
				
					|  |  |             { FLD_FW_BUILD_MONTH_DAY,   UNIT_NONE,   CH0,  4, 2, 1 }, |  |  |             { FLD_FW_BUILD_MONTH_DAY,   UNIT_NONE,   CH0,  4, 2, 1 }, | 
			
		
	
		
		
			
				
					
					|  |  |             { FLD_HW_ID,                UNIT_NONE,   CH0,  8, 2, 1 } |  |  |             { FLD_FW_Build_Hour_Minute, UNIT_NONE,   CH0,  6, 2, 1 }, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |             { FLD_HW_ID,                UNIT_NONE,   CH0,  8, 2, 1 }, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             { FLD_unknown,              UNIT_NONE,   CH0, 10, 2, 1 }, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             { FLD_unknown,              UNIT_NONE,   CH0, 12, 2, 1 }, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             { FLD_CRC-M,                UNIT_NONE,   CH0, 14, 2, 1 } | 
			
		
	
		
		
			
				
					|  |  |         }; |  |  |         }; | 
			
		
	
		
		
			
				
					|  |  |         self.response = bytes('\x27\x1a\x07\xe5\x04\x4d\x03\x4a\x00\x68\x00\x00\x00\x00\xe6\xfb', 'latin1') |  |  |         self.response = bytes('\x27\x1a\x07\xe5\x04\x4d\x03\x4a\x00\x68\x00\x00\x00\x00\xe6\xfb', 'latin1') | 
			
		
	
		
		
			
				
					|  |  |         """ |  |  |         """ | 
			
		
	
		
		
			
				
					
					|  |  |         fw_version, fw_build_yyyy, fw_build_mmdd, unknown, hw_id = struct.unpack('>HHHHH', self.response[0:10]) |  |  |         fw_version, fw_build_yyyy, fw_build_mmdd, fw_build_hhmm, hw_id = struct.unpack('>HHHHH', self.response[0:10]) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         responce_info = self.response | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         logging.debug(f'HardwareInfoResponse: {struct.unpack(">HHHHHHHH", responce_info)}') | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |         fw_version_maj = int((fw_version / 10000)) |  |  |         fw_version_maj = int((fw_version / 10000)) | 
			
		
	
		
		
			
				
					|  |  |         fw_version_min = int((fw_version % 10000) / 100) |  |  |         fw_version_min = int((fw_version % 10000) / 100) | 
			
		
	
		
		
			
				
					|  |  |         fw_version_pat = int((fw_version %   100)) |  |  |         fw_version_pat = int((fw_version %   100)) | 
			
		
	
		
		
			
				
					|  |  |         fw_build_mm = int(fw_build_mmdd / 100) |  |  |         fw_build_mm = int(fw_build_mmdd / 100) | 
			
		
	
		
		
			
				
					|  |  |         fw_build_dd = int(fw_build_mmdd % 100) |  |  |         fw_build_dd = int(fw_build_mmdd % 100) | 
			
		
	
		
		
			
				
					
					|  |  |         logging.debug(f'Firmware: {fw_version_maj}.{fw_version_min}.{fw_version_pat} build at {fw_build_dd}/{fw_build_mm}/{fw_build_yyyy}, HW revision {hw_id}') |  |  |         fw_build_HH = int(fw_build_hhmm / 100) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |         fw_build_MM = int(fw_build_hhmm % 100) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         logging.debug(f'Firmware: {fw_version_maj}.{fw_version_min}.{fw_version_pat} '\ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                       f'build at {fw_build_dd:>02}/{fw_build_mm:>02}/{fw_build_yyyy}T{fw_build_HH:>02}:{fw_build_MM:>02}, '\ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                       f'HW revision {hw_id}') | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | class DebugDecodeAny(UnknownResponse): |  |  | class DebugDecodeAny(UnknownResponse): | 
			
		
	
		
		
			
				
					|  |  |     """Default decoder""" |  |  |     """Default decoder""" | 
			
		
	
	
		
		
			
				
					|  | @ -420,6 +433,12 @@ class Hm300Decode0B(StatusResponse): | 
			
		
	
		
		
			
				
					|  |  |     def dc_energy_daily_0(self): |  |  |     def dc_energy_daily_0(self): | 
			
		
	
		
		
			
				
					|  |  |         """ String 1 daily energy in Wh """ |  |  |         """ String 1 daily energy in Wh """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>H', 12)[0] |  |  |         return self.unpack('>H', 12)[0] | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     def dc_irradiation_0(self): | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         """ String 1 irratiation in percent """ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         if self.inv_strings is None: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           return None | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return round(self.unpack('>H', 6)[0]/10/self.inv_strings[0]['s_maxpower']*100, 3) | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @property |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |     def ac_voltage_0(self): |  |  |     def ac_voltage_0(self): | 
			
		
	
	
		
		
			
				
					|  | @ -438,6 +457,10 @@ class Hm300Decode0B(StatusResponse): | 
			
		
	
		
		
			
				
					|  |  |         """ Grid frequency in Hertz """ |  |  |         """ Grid frequency in Hertz """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>H', 16)[0]/100 |  |  |         return self.unpack('>H', 16)[0]/100 | 
			
		
	
		
		
			
				
					|  |  |     @property |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     def ac_reactive_power_0(self): | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         """ reactive power """ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return self.unpack('>H', 20)[0]/10 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |     def temperature(self): |  |  |     def temperature(self): | 
			
		
	
		
		
			
				
					|  |  |         """ Inverter temperature in °C """ |  |  |         """ Inverter temperature in °C """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>h', 26)[0]/10 |  |  |         return self.unpack('>h', 26)[0]/10 | 
			
		
	
	
		
		
			
				
					|  | @ -482,6 +505,12 @@ class Hm600Decode0B(StatusResponse): | 
			
		
	
		
		
			
				
					|  |  |     def dc_energy_daily_0(self): |  |  |     def dc_energy_daily_0(self): | 
			
		
	
		
		
			
				
					|  |  |         """ String 1 daily energy in Wh """ |  |  |         """ String 1 daily energy in Wh """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>H', 22)[0] |  |  |         return self.unpack('>H', 22)[0] | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     def dc_irradiation_0(self): | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         """ String 1 irratiation in percent """ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         if self.inv_strings is None: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           return None | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return round(self.unpack('>H', 6)[0]/10/self.inv_strings[0]['s_maxpower']*100, 3) | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @property |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |     def dc_voltage_1(self): |  |  |     def dc_voltage_1(self): | 
			
		
	
	
		
		
			
				
					|  | @ -503,6 +532,12 @@ class Hm600Decode0B(StatusResponse): | 
			
		
	
		
		
			
				
					|  |  |     def dc_energy_daily_1(self): |  |  |     def dc_energy_daily_1(self): | 
			
		
	
		
		
			
				
					|  |  |         """ String 2 daily energy in Wh """ |  |  |         """ String 2 daily energy in Wh """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>H', 24)[0] |  |  |         return self.unpack('>H', 24)[0] | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     def dc_irradiation_1(self): | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         """ String 2 irratiation in percent """ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         if self.inv_strings is None: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           return None | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return round(self.unpack('>H', 12)[0]/10/self.inv_strings[1]['s_maxpower']*100, 3) | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @property |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |     def ac_voltage_0(self): |  |  |     def ac_voltage_0(self): | 
			
		
	
	
		
		
			
				
					|  | @ -511,7 +546,7 @@ class Hm600Decode0B(StatusResponse): | 
			
		
	
		
		
			
				
					|  |  |     @property |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |     def ac_current_0(self): |  |  |     def ac_current_0(self): | 
			
		
	
		
		
			
				
					|  |  |         """ Phase 1 ampere """ |  |  |         """ Phase 1 ampere """ | 
			
		
	
		
		
			
				
					
					|  |  |         return self.unpack('>H', 34)[0]/10 |  |  |         return self.unpack('>H', 34)[0]/100 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |     @property |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |     def ac_power_0(self): |  |  |     def ac_power_0(self): | 
			
		
	
		
		
			
				
					|  |  |         """ Phase 1 watts """ |  |  |         """ Phase 1 watts """ | 
			
		
	
	
		
		
			
				
					|  | @ -521,6 +556,10 @@ class Hm600Decode0B(StatusResponse): | 
			
		
	
		
		
			
				
					|  |  |         """ Grid frequency in Hertz """ |  |  |         """ Grid frequency in Hertz """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>H', 28)[0]/100 |  |  |         return self.unpack('>H', 28)[0]/100 | 
			
		
	
		
		
			
				
					|  |  |     @property |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     def ac_reactive_power_0(self): | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         """ reactive power """ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return self.unpack('>H', 32)[0]/10 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |     def powerfactor(self): |  |  |     def powerfactor(self): | 
			
		
	
		
		
			
				
					|  |  |         """ Powerfactor """ |  |  |         """ Powerfactor """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>H', 36)[0]/1000 |  |  |         return self.unpack('>H', 36)[0]/1000 | 
			
		
	
	
		
		
			
				
					|  | @ -573,6 +612,12 @@ class Hm1200Decode0B(StatusResponse): | 
			
		
	
		
		
			
				
					|  |  |     def dc_energy_daily_0(self): |  |  |     def dc_energy_daily_0(self): | 
			
		
	
		
		
			
				
					|  |  |         """ String 1 daily energy in Wh """ |  |  |         """ String 1 daily energy in Wh """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>H', 20)[0] |  |  |         return self.unpack('>H', 20)[0] | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     def dc_irradiation_0(self): | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         """ String 1 irratiation in percent """ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         if self.inv_strings is None: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           return None | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return round(self.unpack('>H', 8)[0]/10/self.inv_strings[0]['s_maxpower']*100, 3) | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @property |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |     def dc_voltage_1(self): |  |  |     def dc_voltage_1(self): | 
			
		
	
	
		
		
			
				
					|  | @ -594,6 +639,12 @@ class Hm1200Decode0B(StatusResponse): | 
			
		
	
		
		
			
				
					|  |  |     def dc_energy_daily_1(self): |  |  |     def dc_energy_daily_1(self): | 
			
		
	
		
		
			
				
					|  |  |         """ String 2 daily energy in Wh """ |  |  |         """ String 2 daily energy in Wh """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>H', 22)[0] |  |  |         return self.unpack('>H', 22)[0] | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     def dc_irradiation_0(self): | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         """ String 2 irratiation in percent """ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         if self.inv_strings is None: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           return None | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return round(self.unpack('>H', 10)[0]/10/self.inv_strings[1]['s_maxpower']*100, 3) | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @property |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |     def dc_voltage_2(self): |  |  |     def dc_voltage_2(self): | 
			
		
	
	
		
		
			
				
					|  | @ -615,6 +666,12 @@ class Hm1200Decode0B(StatusResponse): | 
			
		
	
		
		
			
				
					|  |  |     def dc_energy_daily_2(self): |  |  |     def dc_energy_daily_2(self): | 
			
		
	
		
		
			
				
					|  |  |         """ String 3 daily energy in Wh """ |  |  |         """ String 3 daily energy in Wh """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>H', 42)[0] |  |  |         return self.unpack('>H', 42)[0] | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     def dc_irradiation_0(self): | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         """ String 3 irratiation in percent """ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         if self.inv_strings is None: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           return None | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return round(self.unpack('>H', 30)[0]/10/self.inv_strings[2]['s_maxpower']*100, 3) | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @property |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |     def dc_voltage_3(self): |  |  |     def dc_voltage_3(self): | 
			
		
	
	
		
		
			
				
					|  | @ -636,6 +693,12 @@ class Hm1200Decode0B(StatusResponse): | 
			
		
	
		
		
			
				
					|  |  |     def dc_energy_daily_3(self): |  |  |     def dc_energy_daily_3(self): | 
			
		
	
		
		
			
				
					|  |  |         """ String 4 daily energy in Wh """ |  |  |         """ String 4 daily energy in Wh """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>H', 44)[0] |  |  |         return self.unpack('>H', 44)[0] | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     def dc_irradiation_0(self): | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         """ String 4 irratiation in percent """ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         if self.inv_strings is None: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           return None | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return round(self.unpack('>H', 32)[0]/10/self.inv_strings[3]['s_maxpower']*100, 3) | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @property |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |     def ac_voltage_0(self): |  |  |     def ac_voltage_0(self): | 
			
		
	
	
		
		
			
				
					|  | @ -654,6 +717,10 @@ class Hm1200Decode0B(StatusResponse): | 
			
		
	
		
		
			
				
					|  |  |         """ Grid frequency in Hertz """ |  |  |         """ Grid frequency in Hertz """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>H', 48)[0]/100 |  |  |         return self.unpack('>H', 48)[0]/100 | 
			
		
	
		
		
			
				
					|  |  |     @property |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     def ac_reactive_power_0(self): | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         """ reactive power """ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return self.unpack('>H', 52)[0]/10 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @property | 
			
		
	
		
		
			
				
					|  |  |     def powerfactor(self): |  |  |     def powerfactor(self): | 
			
		
	
		
		
			
				
					|  |  |         """ Powerfactor """ |  |  |         """ Powerfactor """ | 
			
		
	
		
		
			
				
					|  |  |         return self.unpack('>H', 56)[0]/1000 |  |  |         return self.unpack('>H', 56)[0]/1000 | 
			
		
	
	
		
		
			
				
					|  | 
 |