Skip to content

Commit

Permalink
Config parsing ifx
Browse files Browse the repository at this point in the history
  • Loading branch information
odya committed Jul 13, 2024
1 parent 56660e1 commit 3f59ab2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions custom_components/ina219_ups_hat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import annotations
from datetime import timedelta
import json
import logging

from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
Expand All @@ -12,18 +13,15 @@

from .const import CONF_SCAN_INTERVAL, DOMAIN

_LOGGER = logging.getLogger(__name__)

async def async_setup(hass: HomeAssistant, config: ConfigType):
"""Your controller/hub specific code."""

if DOMAIN not in config:
return False
# if DOMAIN not in config:
# return False

sensor_config: ConfigType = config[DOMAIN]

if CONF_SCAN_INTERVAL not in sensor_config:
return False
sensor_config[CONF_SCAN_INTERVAL] = timedelta(seconds=sensor_config[CONF_SCAN_INTERVAL])
sensor_config = config["sensor"][0]

coordinator = INA219UpsHatCoordinator(hass, sensor_config)
await coordinator.async_refresh()
Expand Down

0 comments on commit 3f59ab2

Please sign in to comment.