Package: growatt-client
GrowattClientPython wrapper for getting data asynchronously from Growatt inverters via serial RS232/RS485 connection and modbus RTU protocol.The implementation is based onGrowatt Inverter Modbus RTU Protocol V1.20.Tested with inverters:SPH 10000 TL3 BHAttributesDepending on the firmware version of your inverter, not all attributes might be availableHolding register attributesserial_numbermodel_numberfirmwareInput register attributesAttributeRegisterUnitDescriptionMiscbattery_charge1011kWBattery chargingbattery_charge_lifetime1058kWhBattery charged totalbattery_charge_today1056kWhBattery charged todaybattery_discharge1009kWBattery dischargingbattery_discharge_lifetime1054kWhBattery discharged totalbattery_discharge_today1052kWhBattery discharged todaybattery_voltage1013VBattery voltageconsumptionCalckWConsumption{photovoltaics} + {battery_discharge} + {import_from_grid} - {export_to_grid} - {battery_charge}consumption_lifetimeCalckWhConsumption total{photovoltaics_lifetime} + {battery_discharge_lifetime} + {import_from_grid_lifetime} - {export_to_grid_lifetime} - {battery_charge_lifetime}consumption_todayCalckWhConsumption today{photovoltaics_today} + {battery_discharge_today} + {import_from_grid_today} - {export_to_grid_today} - {battery_charge_today}export_to_grid1029kWExport to gridexport_to_grid_lifetime1050kWhExport to grid totalexport_to_grid_today1048kWhExport to grid todaygrid_frequency37HzGrid frequencygrid_voltage38VGrid voltageimport_from_grid1021kWImport from gridimport_from_grid_lifetime1046kWhImport from grid totalimport_from_grid_today1044kWhImport from grid todayinverter_temperature_193°CInverter temperatureinverter_temperature_294°CThe inside IPM in inverter Temperatureinverter_temperature_31040°CBattery temperaturelocal_load1037kWInverter local loadlocal_load_lifetime1062kWhInverter local load totallocal_load_today1060kWhInverter local load todayphotovoltaics1kWPhotovoltaics (PV) generationphotovoltaics_15kWPhotovoltaics (PV) 1photovoltaics_1_lifetime61kWhPhotovoltaics (PV) 1 totalphotovoltaics_1_today59kWhPhotovoltaics (PV) 1 todayphotovoltaics_1_voltage3VPhotovoltaics (PV) 1 voltagephotovoltaics_29kWPhotovoltaics (PV) 2photovoltaics_2_lifetime65kWhPhotovoltaics (PV) 2 totalphotovoltaics_2_today63kWhPhotovoltaics (PV) 2 todayphotovoltaics_2_voltage7VPhotovoltaics (PV) 2 voltagephotovoltaics_lifetime91kWhPhotovoltaics (PV) generation totalphotovoltaics_todayCalckWhPhotovoltaics (PV) generation today{photovoltaics_2_today} + {photovoltaics_1_today}self_consumptionCalckWSelf Consumption{consumption} if {export_to_grid} > 0 else {system_production}statement_of_charge1014%Statement of charge (SOC), capacitysystem_productionCalckWSystem Production{photovoltaics} + {battery_discharge} - {battery_charge}system_production_lifetimeCalckWhSystem Production total{photovoltaics_lifetime} + {battery_discharge_lifetime} - {battery_charge_lifetime}system_production_todayCalckWhSystem Production today{photovoltaics_today} + {battery_discharge_today} - {battery_charge_today}system_production_with_battery_lifetime1139kWhSystem production total (including battery)system_production_with_battery_today1137kWhSystem production today (including battery)How to use the packageimportasyncioimportloggingfromsysimportargvfromgrowatt_client.growattimportGrowattClient# defaults# USB port of RS232/RS485 converterDEFAULT_PORT="/dev/ttyUSB0"# Growatt modbus addressDEFAULT_ADDRESS=0x1logging.basicConfig(level=logging.DEBUG)asyncdefmain():port=str(argv[1])iflen(argv)>1elseDEFAULT_PORTaddress=int(argv[2])iflen(argv)>2elseDEFAULT_ADDRESSgrowatt_client=GrowattClient(port,address,attributes=["import_from_grid_today","local_load_lifetime"],)try:data=awaitgrowatt_client.async_update()print(f"Sensors data:{data}")exceptExceptionaserror:print("Error: "+repr(error))loop=asyncio.get_event_loop()loop.run_until_complete(main())loop.close()