Fix powerwall typing (#104875)

This commit is contained in:
Marc Mueller 2023-12-01 16:42:50 +01:00 committed by GitHub
parent dc708b8a18
commit 5014e2f0c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,9 +122,9 @@ class PowerwallDataManager:
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Tesla Powerwall from a config entry.""" """Set up Tesla Powerwall from a config entry."""
http_session = requests.Session() http_session = requests.Session()
ip_address = entry.data[CONF_IP_ADDRESS] ip_address: str = entry.data[CONF_IP_ADDRESS]
password = entry.data.get(CONF_PASSWORD) password: str | None = entry.data.get(CONF_PASSWORD)
power_wall = Powerwall(ip_address, http_session=http_session) power_wall = Powerwall(ip_address, http_session=http_session)
try: try:
base_info = await hass.async_add_executor_job( base_info = await hass.async_add_executor_job(
@ -184,7 +184,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
def _login_and_fetch_base_info( def _login_and_fetch_base_info(
power_wall: Powerwall, host: str, password: str power_wall: Powerwall, host: str, password: str | None
) -> PowerwallBaseInfo: ) -> PowerwallBaseInfo:
"""Login to the powerwall and fetch the base info.""" """Login to the powerwall and fetch the base info."""
if password is not None: if password is not None: