springfall2008 / batpred

Home battery prediction and charging automation for Home Assistant, supporting many inverter types
https://springfall2008.github.io/batpred/
129 stars 44 forks source link

Add support for Solar Assistant #786

Open xhemp opened 8 months ago

xhemp commented 8 months ago

Would be great to have support for Solar Assistant ( https://solar-assistant.io/ ). It supports many types of inverters and the beta version has a proper power management that works fine with Growatt (my case) inverters as well. I saw another issue opened here for Huaweii ( #684 ) so I will try to play a bit with the template yaml and see where I get, just wanted to get this on the radar (and also confirm if this is something doable or not). Thanks!

springfall2008 commented 8 months ago

Could make sense, but can share details on how to control it in HA?

xhemp commented 8 months ago

Hey, thanks for getting back to me! So the way I use SA with Home Assistant via MQTT: For example, there's a switch called Work mode priority, there you select Load first, Battery first or Grid first. That is tied to the device_mode topic on MQTT. Attached is a screenshot of all the MQTT topics for Solar Assistant:

Screenshot 2024-03-03 at 22 11 01

If you need anything else or have any other questions, let me know.

springfall2008 commented 8 months ago

Do these MQTT topics appear as HA entities?

I would need a list of HA entities that hold the basic information required for apps.yaml together with some example automations used to charge and force discharge the battery

xhemp commented 8 months ago

They do, yes and sure thing, here's the entities list: entities_list.txt Please, let me know if you need anything else!

springfall2008 commented 8 months ago

I guess I don't really know what these do without context.

Can you take this template and try to map these sensors to the line items listed here:

https://github.com/springfall2008/batpred/blob/main/templates/solaredge.yaml

Then if you can create a simple automation in HA to start and stop charging the battery from grid and to discharge the battery to the grid that can go into the configuration also.

xhemp commented 8 months ago

@springfall2008 Sure thing, I am abroad this week but I will give this a go next week, thanks!

xhemp commented 8 months ago

Those are the sensor values I came up with ( I added a few questions to understand what's the need on some of them):

battery_rate_max:

For the automation, here they are:

Services to control charging/discharging

service: select.select_option entity_id: "select.growatt_spa_work_mode_priority" option: "Battery first" charge_stop_service: service: select.select_option entity_id: "select.growatt_spa_work_mode_priority" option: "Load first" discharge_start_service: service: select.select_option entity_id: "select.growatt_spa_work_mode_priority" option: "Grid first"

Let me know if this is what you were looking for and if you need any changes or an explanation.

springfall2008 commented 8 months ago

charge_rate - should be a setting in Watts e.g. 3000=3kW. You can just hard-wire it as 3000 for now discharge_rate - as charge rate

soc_max is a value in kWh which is the size of the battery e.g. 10 would be a 10 kWh battery

On the services, does Grid first force the battery to discharge at full rate?

xhemp commented 8 months ago

charge_rate - should be a setting in Watts e.g. 3000=3kW. You can just hard-wire it as 3000 for now discharge_rate - as charge rate

soc_max is a value in kWh which is the size of the battery e.g. 10 would be a 10 kWh battery

On the services, does Grid first force the battery to discharge at full rate?

Thanks for clarifying. Grid first forces the battery to discharge at whatever percentage is set on another sensor ( number.growatt_spa_grid_first_discharge_rate ).

Edit: updated the soc values.

xhemp commented 1 week ago

I would love to get this one sorted, any help is appreciated!