Browse Source
			
			
			Merge pull request #61 from Sprinterfreak/pypackage
			
				Pypackage fix interval, add HM600 event count
			
			
				pull/63/head
			
			
		 
		
			
				
					
						 lumapu
					
					3 years ago
						lumapu
					
					3 years ago
					
						
							committed by
							
								 GitHub
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 4AEE18F83AFDEB23
						
					
				
			
		
		
		
	
		
			
				 3 changed files with 
10 additions and 
2 deletions
			 
			
		 
		
			
				- 
					
					
					 
					tools/rpi/hoymiles/__main__.py
				
- 
					
					
					 
					tools/rpi/hoymiles/decoders/__init__.py
				
- 
					
					
					 
					tools/rpi/hoymiles/outputs.py
				
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -268,7 +268,7 @@ if __name__ == '__main__': | 
			
		
	
		
			
				
					|  |  |  |             print('', end='', flush=True) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             if loop_interval > 0 and (time.time() - t_loop_start) < loop_interval: | 
			
		
	
		
			
				
					|  |  |  |                 time.sleep(time.time() % loop_interval) | 
			
		
	
		
			
				
					|  |  |  |                 time.sleep(loop_interval - (time.time() - t_loop_start)) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     except KeyboardInterrupt: | 
			
		
	
		
			
				
					|  |  |  |         sys.exit() | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -46,6 +46,7 @@ class StatusResponse(Response): | 
			
		
	
		
			
				
					|  |  |  |     temperature = None | 
			
		
	
		
			
				
					|  |  |  |     frequency = None | 
			
		
	
		
			
				
					|  |  |  |     powerfactor = None | 
			
		
	
		
			
				
					|  |  |  |     event_count = None | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     def unpack(self, fmt, base): | 
			
		
	
		
			
				
					|  |  |  |         """ | 
			
		
	
	
		
			
				
					|  |  | @ -120,6 +121,7 @@ class StatusResponse(Response): | 
			
		
	
		
			
				
					|  |  |  |         data['temperature'] = self.temperature | 
			
		
	
		
			
				
					|  |  |  |         data['frequency'] = self.frequency | 
			
		
	
		
			
				
					|  |  |  |         data['powerfactor'] = self.powerfactor | 
			
		
	
		
			
				
					|  |  |  |         data['event_count'] = self.event_count | 
			
		
	
		
			
				
					|  |  |  |         data['time'] = self.time_rx | 
			
		
	
		
			
				
					|  |  |  |         return data | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -544,7 +546,7 @@ class Hm600Decode0B(StatusResponse): | 
			
		
	
		
			
				
					|  |  |  |         """ Inverter temperature in °C """ | 
			
		
	
		
			
				
					|  |  |  |         return self.unpack('>H', 38)[0]/10 | 
			
		
	
		
			
				
					|  |  |  |     @property | 
			
		
	
		
			
				
					|  |  |  |     def alarm_count(self): | 
			
		
	
		
			
				
					|  |  |  |     def event_count(self): | 
			
		
	
		
			
				
					|  |  |  |         """ Event counter """ | 
			
		
	
		
			
				
					|  |  |  |         return self.unpack('>H', 40)[0] | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -667,6 +669,10 @@ class Hm1200Decode0B(StatusResponse): | 
			
		
	
		
			
				
					|  |  |  |     def temperature(self): | 
			
		
	
		
			
				
					|  |  |  |         """ Inverter temperature in °C """ | 
			
		
	
		
			
				
					|  |  |  |         return self.unpack('>H', 58)[0]/10 | 
			
		
	
		
			
				
					|  |  |  |     @property | 
			
		
	
		
			
				
					|  |  |  |     def event_count(self): | 
			
		
	
		
			
				
					|  |  |  |         """ Event counter """ | 
			
		
	
		
			
				
					|  |  |  |         return self.unpack('>H', 60)[0] | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | class Hm1200Decode11(EventsResponse): | 
			
		
	
		
			
				
					|  |  |  |     """ Inverter generic events log """ | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -114,6 +114,8 @@ class InfluxOutputPlugin(OutputPluginFactory): | 
			
		
	
		
			
				
					|  |  |  |             data_stack.append(f'{measurement},string={string_id},type=current value={string["current"]:3f} {ctime}') | 
			
		
	
		
			
				
					|  |  |  |             string_id = string_id + 1 | 
			
		
	
		
			
				
					|  |  |  |         # Global | 
			
		
	
		
			
				
					|  |  |  |         if data['event_count'] is not None: | 
			
		
	
		
			
				
					|  |  |  |             data_stack.append(f'{measurement},type=total_events value={data["event_count"]} {ctime}') | 
			
		
	
		
			
				
					|  |  |  |         if data['powerfactor'] is not None: | 
			
		
	
		
			
				
					|  |  |  |             data_stack.append(f'{measurement},type=pf value={data["powerfactor"]:f} {ctime}') | 
			
		
	
		
			
				
					|  |  |  |         data_stack.append(f'{measurement},type=frequency value={data["frequency"]:.3f} {ctime}') | 
			
		
	
	
		
			
				
					|  |  | 
 |