Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 3 additions & 2 deletions homeassistant/components/kostal_plenticore/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession

from .const import DOMAIN
from .const import DOMAIN, SERVICE_CODE
from .helper import get_hostname_id

_LOGGER = logging.getLogger(__name__)
Expand All @@ -21,6 +21,7 @@
{
vol.Required(CONF_HOST): str,
vol.Required(CONF_PASSWORD): str,
vol.Optional(SERVICE_CODE): str,
}
)

Expand All @@ -33,7 +34,7 @@ async def test_connection(hass: HomeAssistant, data) -> str:

session = async_get_clientsession(hass)
async with ApiClient(session, data["host"]) as client:
await client.login(data["password"])
await client.login(data[CONF_PASSWORD], service_code=data.get(SERVICE_CODE))
hostname_id = await get_hostname_id(client)
values = await client.get_setting_values("scb:network", hostname_id)

Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/kostal_plenticore/const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Constants for the Kostal Plenticore Solar Inverter integration."""

DOMAIN = "kostal_plenticore"
SERVICE_CODE = "Service Code"
7 changes: 5 additions & 2 deletions homeassistant/components/kostal_plenticore/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator

from .const import DOMAIN
from .const import DOMAIN, SERVICE_CODE
from .helper import get_hostname_id

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -59,7 +59,10 @@ async def async_setup(self) -> bool:
async_get_clientsession(self.hass), host=self.host
)
try:
await self._client.login(self.config_entry.data[CONF_PASSWORD])
await self._client.login(
self.config_entry.data[CONF_PASSWORD],
service_code=self.config_entry.data.get(SERVICE_CODE),
)
except AuthenticationException as err:
_LOGGER.error(
"Authentication exception connecting to %s: %s", self.host, err
Expand Down
10 changes: 10 additions & 0 deletions homeassistant/components/kostal_plenticore/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ class PlenticoreSwitchEntityDescription(SwitchEntityDescription):
off_value="2",
off_label="Automatic economical",
),
PlenticoreSwitchEntityDescription(
module_id="devices:local",
key="Battery:ManualCharge",
name="Battery Manual Charge",
is_on="1",
on_value="1",
on_label="On",
off_value="0",
off_label="Off",
),
]


Expand Down