Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion custom_components/sonnenbatterie/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
{
**cv.ENTITY_SERVICE_FIELDS,
# vol.Required(CONF_CHARGE_WATT): vol.Range(min=0, max=inverter_power),
vol.Required(CONF_CHARGE_WATT): str,
vol.Required(CONF_CHARGE_WATT): int,
}
)

Expand Down
4 changes: 2 additions & 2 deletions custom_components/sonnenbatterie/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _get_sb_connection(self, call_data: ReadOnlyDict) -> AsyncSonnenBatterie:
# service definitions
async def charge_battery(self, call: ServiceCall) -> ServiceResponse:
LOGGER.debug(f"_charge_battery: {call.data}")
power = int(call.data.get(CONF_CHARGE_WATT))
power = call.data.get(CONF_CHARGE_WATT)
if power < 0:
power = 0
# Make sure we have an sb2 object
Expand All @@ -65,7 +65,7 @@ async def charge_battery(self, call: ServiceCall) -> ServiceResponse:

async def discharge_battery(self, call: ServiceCall) -> ServiceResponse:
LOGGER.debug(f"_discharge_battery: {call.data}")
power = int(call.data.get(CONF_CHARGE_WATT))
power = call.data.get(CONF_CHARGE_WATT)
if power < 0:
power = 0
sb_conn = self._get_sb_connection(call.data)
Expand Down
16 changes: 10 additions & 6 deletions custom_components/sonnenbatterie/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ charge_battery:
integration: sonnenbatterie
power:
required: true
example: "1000"
example: 1000
selector:
text:
suffix: "W"
number:
min: 0
step: 1
unit_of_measurement: "W"
discharge_battery:
fields:
device_id:
Expand All @@ -54,10 +56,12 @@ discharge_battery:
integration: sonnenbatterie
power:
required: true
example: "1000"
example: 1000
selector:
text:
suffix: "W"
number:
min: 0
step: 1
unit_of_measurement: "W"
set_battery_reserve:
fields:
device_id:
Expand Down