# Huawei Logger

### Purpose

Purpose of this plugin is to read from Huawei Solar Loggers using the Modbus protocol.

### Usage

This plugin reads the Huawei Loggers and attached Inverters via Modbus. It uses the Modbus Specification and collects from IP connected inverters using `TCP` protocol. Inverter data will be collected to the `solar` table. There are a number of files that can be used to query the Huawei loggers depending on the version of the logger and the attached inverters. The `huawei_sun2000.txt` (default) file collects data for the Huawei 2000 logger. The other files are `huawei_sun2000_60ktl` `huawei_sun2000_ktl.txt` `huawei_sl1000.txt` `huawei_sl3000.txt` and `huawei_logger_inverters.txt`. Please ensure the file collects the data suitable for your logger.

The following Huawei SmartLogger models are supported:

```
SL1000 SL3000
```

The `huawei_sun2000.txt` config file is valid for the following inverter models:

```
SUN2000-50KTL-C1 SUN2000-50KTL SUN2000-42KTL SUN2000-36KTL SUN2000-33KTL-JP SUN2000-40KTL-JP SUN2000-43KTL-IN-C1 SUN2000-24.7KTL-JP SUN2000-40KTL-US SUN2000-33KTL-US SUN2000-36KTL-US SUN2000-33KTL-A SUN2000-8KTL -> SUN2000-28KTL
```

Other inverter models have their own dedicated configuration file.

These should be read using the `huawei_smart_logger.txt` config file. The `huawei_sl1000.txt` and `huawei_sl3000.txt` config files are old and included for backwards compatibility. They are functionally identical and the same as the `huawei_smart_logger.cmd`.

Data will be run every 5 minutes by default. This plugin relies on the `Modbus Ardexa` plugin. The following data will be collected for the `huawei_sun2000.txt` file. For the other files contact Ardexa. Please also note that this plugin will ONLY collect data from TCP (not RS485 lines).

Run a `log` to send data to the cloud or a `discover` to only display information. You may need to configure the Huawei Logger for Modbus collection as follows:

```
1. Configure Settings->Modbus TCP
    a. If the Ardexa machine has a static address enable "Link Setting: Enable(Limited)" and 
    b. Add the IP address of the Ardexa device. If the Ardexa device is DHCP then make sure the "Link Setting: Enable(Unlimited)""
2. Address mode: Logical Address
3. SmartLogger address	(0-247): 1
```

### Huawei Logger Data

The following logger data will be collected to the `solar` table for the `huawei_smart_logger.txt` file. This is the same list of data that is collected from the `huawei_sl1000.txt` and `huawei_sl3000.txt` config files.

```
Variable					    Units
=========================================================
DC Power           				    W  
AC Power           				    W  
Cos Phi            					   
DC Current         				    A  
Total Energy       				    Wh 
Daily Energy       				    Wh 
AC Current 1       				    A  
AC Current 2       				    A  
AC Current 3       				    A  
Alarm 1            				   
Alarm 1 Raw            							   
Alarm 2            								   
Alarm 2 Raw          								   
Status             								   
Status Raw
Plant Status 1       								   
Plant Status 1 Raw       								   
Plant Status 2       								   
Plant Status 2 Raw   								   
Plant Status 3       								   
Plant Status 3 Raw  								   
Transfer Trip       								   
Transfer Trip Raw      								   
CO2 Reduction       				    kg 
Reactive Power       				    var
DC Current 2         				    A  
Duration Of Daily Power Generation		    h  
Active Alarm Sequence Number						   
Historic Alarm Sequence Number						   
Voltage 12  					    V  
Voltage 23  					    V  
Voltage 31  					    V  
Inverter Efficiency    				    %  
ESN      			 					   
Active Power Control Mode							   
Active Power Control Mode Raw				   
Reactive Power Control Mode						   
Reactive Power Control Mode Raw					   
Reactive Power Scheduling Curve Mode   			   
Reactive Power Scheduling Curve Mode Raw  			   
Rated Plant Capacity   				    W  
Total Rated Capacity Of Grid Connected Inverters    W  
```

### Huawei SUN2000 Data

The following inverter data will be collected to the `solar` table for the `huawei_sun2000.txt` file. Other files collect different information. Please check each file for details.

```
Variable				    Units
=================================================    
Rated Power				    W		
Output Mode										
Output Mode Raw									
ESN									
DC Voltage 1				    V		
DC Current 1				    A		
DC Voltage 2				    V		
DC Current 2				    A		
DC Voltage 3				    V		
DC Current 3				    A		
DC Voltage 4				    V		
DC Current 4				    A		
DC Voltage 5				    V		
DC Current 5				    A		
DC Voltage 6				    V		
DC Current 6				    A		
DC Voltage 7				    V		
DC Current 7				    A		
DC Voltage 8				    V		
DC Current 8				    A		
AC Voltage 1				    V		
AC Voltage 2				    V		
AC Voltage 3				    V		
AC Current 1				    A        		
AC Current 2				    A		
AC Current 3				    A		
Grid Freq				    Hz		
Cos Phi								 		
Temperature				    °C  	
Status 1									 		
Status 1 Raw									 		
Status 2									 		
Status 2 Raw									 		
Peak Daily Power			    W		
AC Power				    W		
Reactive Power				    var
DC Power				    W		
Daily Energy				    Wh		
Total Energy				    Wh		
Locking								
Locking Raw
Zero Voltage Ride-Through Protection On			
LVRT Protection On									
Islanding Protection On							
Insul Resist				    Mohm	
DC Power 1				    W		
DC Power 2				    W		
DC Power 3				    W		
DC Power 4				    W		
Efficiency				    %		
Reactive Power Compensation Mode		
Active Power Control Mode							
Active Power Derating Percentage	    %		
Active Power Derating Value		    W		
Active Power Deration Gradient		    %/s	
Reactive Power Compensation Power Factor		
Reactive Power Compensation Q/S					
Reactive power adjustment time		    s		
Alarm 1							 		
Alarm 2									 		
Alarm 3									 		
Alarm 4									 		
Alarm 5									 		
Alarm 6									 		
Alarm 7									 		
Alarm 8									 		
Alarm 9									 		
Alarm 10									 		
Alarm 1 Raw									 		
Alarm 2 Raw									 		
Alarm 3 Raw									 		
Alarm 4 Raw									 		
Alarm 5 Raw									 		
Alarm 6 Raw									 		
Alarm 7 Raw									 		
Alarm 8 Raw									 		
Alarm 9 Raw									 		
Alarm 10 Raw						 		
Warning	
Warning Raw								 		
```

### Huawei SUN2000-60KTL Data

The following inverter data will be collected to the `solar` table for the `huawei_sun2000_60ktl.txt` file. Other files will collect different information. Please check each file for details. Note: The `DC Voltage` values can go up to `10`. The `SL1000` units will not collect as much information as the `Sun2000` model.

```
Variable           	Units
=============================
Rated Power             W
DC Voltage 1            V
DC Current 1            A
DC Voltage 2            V
DC Current 2            A
DC Voltage 3            V
DC Current 3            A
DC Voltage 4            V
DC Current 4            A
DC Voltage 5            V
DC Current 5            A
DC Voltage 6            V
DC Current 6            A
DC Voltage 7            V
DC Current 7            A
DC Voltage 8            V
DC Current 8            A
AC Voltage 1            V
AC Voltage 2            V
AC Voltage 3            V
AC Current 1            A
AC Current 2            A
AC Current 3            A
Grid Freq               Hz
Cos Phi
Cabinet Temperature     °C
Status
Peak Daily Power
AC Power                W
Reactive Power          var
DC Power                W
Daily Energy            Wh
Total Energy            Wh
Insul Resist            Mohms
Alarm 1									 		
Alarm 2									 		
Alarm 3									 		
Alarm 4									 		
Alarm 5									 		
Alarm 6									 		
Alarm 7									 		
Alarm 8									 		
Alarm 9									 		
Alarm 10									 		
Alarm 1 Raw									 		
Alarm 2 Raw									 		
Alarm 3 Raw									 		
Alarm 4 Raw									 		
Alarm 5 Raw									 		
Alarm 6 Raw									 		
Alarm 7 Raw									 		
Alarm 8 Raw									 		
Alarm 9 Raw									 		
Alarm 10 Raw						 		
Warning
Warning Raw
```

### Huawei SUN2000-KTL Data

The following inverter data will be collected to the `solar` table for the `huawei_sun2000_ktl.txt` file. Other files will collect different information. Please check each file for details. Note: The `DC Voltage` values can go up to `10`. The `SL1000` units will not collect as much information as the `Sun2000` model.

```
Variable           	Units
=============================
Operating Status		   		
Operating Status Raw			
Connected						
Alarm1							
Alarm1 Raw						
Alarm2							
Alarm2 Raw						
Alarm3							
DC Voltage 1		V		
DC Current 1		A		
DC Voltage 2		V		
DC Current 2		A		
DC Voltage 3		V		
DC Current 3		A		
DC Voltage 4		V		
DC Current 4		A		
DC Voltage 5		V		
DC Current 5		A		
DC Voltage 6		V		
DC Current 6		A		
DC Voltage 7		V		
DC Current 7		A		
DC Voltage 8		V		
DC Current 8		A		
DC Voltage 9		V		
DC Current 9		A		
DC Voltage 10		V		
DC Current 10		A		
DC Voltage 11		V		
DC Current 11		A		
DC Voltage 12		V		
DC Current 12		A		
DC Voltage 13		V		
DC Current 13		A		
DC Voltage 14		V		
DC Current 14		A		
DC Voltage 15		V		
DC Current 15		A		
DC Voltage 16		V		
DC Current 16		A		
DC Voltage 17		V		
DC Current 17		A		
DC Voltage 18		V		
DC Current 18		A		
DC Power		W		
AC Voltage 1		V		
AC Voltage 2		V		
AC Voltage 3		V		
AC Current 1		A		
AC Current 2		A		
AC Current 3		A		
AC Power		W		
Reactive Power		var	
Cos Phi				    		
Grid Freq		Hz		
Efficiency		%		
Cabinet Temperature	°C		
Insul Resist		Mohms	
Status					 		
Status Raw				 		
Total Energy	        Wh		 
Daily Energy		Wh		 
```

### Huawei SUN2000-8-28KTL Data

The following inverter data will be collected to the `solar` table for the `huawei_sun2000_ktl.txt` file. Other files will collect different information. Please check each file for details. Note: The `DC Voltage` values can go up to `10`. The `SL1000` units will not collect as much information as the `Sun2000` model.

```
Variable           	Units
=============================
DC Voltage 1		V
DC Voltage 		V
DC Voltage 3		V
DC Voltage 4		V
DC Voltage 5		V
DC Voltage 6		V
DC Current 1		A
DC Current 2		A
DC Current 3		A
DC Current 4		A
DC Current 5		A
DC Current 6		A
AC Power		W
AC Voltage 12		V
AC Voltage 23		V
AC Voltage 31		V
Cos Phi				    
Cabinet Temperature	°C
Reactive Power		var
Grid Freq		Hz
Total Energy		Wh
Daily Energy		Wh
AC Current 1		A
AC Current 2		A
AC Current 3		A
Efficiency		%
DC Power MPPT 1		W
DC Power MPPT 2		W
DC Power MPPT 3		W
DC Power		W
Status				        
Status Raw			        
Alarm 1					
Alarm 2					
Alarm 3					
Alarm 4					
Alarm 5					
Alarm 6					
Alarm 7					
Alarm 8					
Alarm 9					
Alarm 10					
Alarm 1 Raw				
Alarm 2 Raw				
Alarm 3 Raw				
Alarm 4 Raw				
Alarm 5 Raw				
Alarm 6 Raw				
Alarm 7 Raw				
Alarm 8 Raw				
Alarm 9 Raw				
Alarm 10 Raw								
```

### Arguments

Arguments are as follows:

* `endpoint`. This is either an IP address like `192.168.1.15`
* `bus_addresses`. The bus address of the inverter(s)
* `--port`. This is an optional parameter used in an Ethernet gateway and is the TCP port used for the gateway. Default is `502`
* `--attempts`. This is an optional parameter and determines how many times to times to attempt to read an inverter value. Default is `1`
* `--delay`. This is the delay in seconds between inverter send and receive commands AND if `attempts` > 1. Fractions like `0.3` can be used. Default is `0.05`
