Hi @ChahtourAla,
as Klinki suggested, you should have a look at the implementation of the FENECON Home battery. It should be a very good example for your project:
- communication based on Modbus
- implementation uses a proper State-Machine, with start/stop capabilities
- there is a Battery-Protection activated, that makes sure the cell voltages stay in proper ranges
- etc.
More background information can be found in theses threads:
- Edge-Module - Programmierstil (German language)
- ESS that can talk with OpenEMS using Modbus TCP
Regards,
Stefan