Modules
Top-level package for hoymiles_modbus.
client
¶
Hoymiles Modbus client.
CommunicationParams
dataclass
¶
Low level pymodbus communication parameters.
close_comm_on_error: bool = False
class-attribute
¶
Close connection on error
reconnect_delay: int = 60000 * 5
class-attribute
¶
Delay in milliseconds before reconnecting.
retries: int = 3
class-attribute
¶
Max number of retries per request.
retry_on_empty: bool = False
class-attribute
¶
Retry if received an empty response.
strict: bool = True
class-attribute
¶
Strict timing, 1.5 character between requests.
timeout: int = 3
class-attribute
¶
Request timeout.
HoymilesModbusTCP(host, port=502, microinverter_type=MicroinverterType.MI, unit_id=1)
¶
Hoymiles Modbus TCP client.
Gather data from photovoltaic installation based on Hoymiles microinverters managed by Hoymiles DTU (like DTU-pro). The client communicates with DTU via Modbus TCP protocol.
Initialize the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host |
str
|
DTU address |
required |
port |
int
|
target DTU modbus TCP port |
502
|
microinverter_type |
MicroinverterType
|
Microinverter type, applies to all microinverters |
MicroinverterType.MI
|
unit_id |
int
|
Modbus unit ID |
1
|
Source code in hoymiles_modbus/client.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
comm_params: CommunicationParams
property
¶
Low level communication parameters.
dtu: str
property
¶
DTU serial number.
microinverter_data: List[Union[MISeriesMicroinverterData, HMSeriesMicroinverterData]]
property
¶
Status data from all microinverters.
Each get
is a new request and data from the installation.
plant_data: PlantData
property
¶
Plant status data.
Each get
is a new request and data from the installation.
datatypes
¶
Data structures.
HMSeriesMicroinverterData
¶
MISeriesMicroinverterData
¶
Bases: Structure
MI series microinverter status data structure.
MicroinverterType
¶
PlantData
dataclass
¶
Data structure for the whole plant.
alarm_flag: bool = False
class-attribute
¶
Alarm indicator. True means that at least one microinverter reported an alarm.
dtu: str
class-attribute
¶
DTU serial number.
microinverter_data: List[Union[MISeriesMicroinverterData, HMSeriesMicroinverterData]] = field(default_factory=list)
class-attribute
¶
Data for each microinverter.
pv_power: Decimal = Decimal(0)
class-attribute
¶
Current production [W].
today_production: int = 0
class-attribute
¶
Today production [Wh].
total_production: int = 0
class-attribute
¶
Total production [Wh].