mletenay / home-assistant-goodwe-inverter

Experimental version of Home Assistant integration for Goodwe solar inverters
https://discord.gg/TaXyWXT
MIT License
146 stars 38 forks source link

Battery charging current setting #287

Closed Rotif closed 4 months ago

Rotif commented 4 months ago

Hi, pleas would it be possible to add the ability to control the charging current of the battery. E.g. in the morning do not charge the battery (1A current) but export the energy to the mains and start charging the battery at noon. I tried this notation but it doesn't work. Thank you

switch.py GoodweSwitchEntityDescription( key="battery_charge_limit_switch", translation_key="battery_charge_limit_switch", entity_category=EntityCategory.CONFIG, device_class=SwitchDeviceClass.SWITCH, setting="battery_charge", ),

string.json "battery_charge_limit": { "name": "Battery charge limit" },

number.py

Charge limit in A

GoodweNumberEntityDescription(
    key="battery_charge_limit",
    translation_key="battery_charge_limit",
    entity_category=EntityCategory.CONFIG,
    device_class=NumberDeviceClass.CURRENT,
    native_unit_of_measurement=UnitOfCurrent.AMPS,
    native_step=1,
    native_min_value=0,
    native_max_value=300,
    getter=lambda inv: inv.get_battery_charge_limit(),
    mapper=lambda v: v,
    setter=lambda inv, val: inv.set_battery_charge_limit(val),
    filter=lambda inv: _get_setting_unit(inv, "battery_charge_limit") != "%",
),

icons.json "battery_charge_limit": { "default": "mdi:battery-arrow-down" },

  "battery_charge_limit_switch": {
    "default": "mdi:transmission-tower-import",
    "state": {
      "on": "mdi:battery-arrow-down",
      "off": "mdi:battery-arrow-down"
mletenay commented 4 months ago

There are no inverter settings named battery_charge and battery_charge_limit. They are not exposed to HA as UI entities, since they are potentially dangerous and it assumes some basic skills/knowledge. Having said that, you can control it by modifying 'battery_discharge_current' setting. And there is no need to modify integration sources and add new UI elements, just call set_parameter service from some automation.