Skip to content

Commit

Permalink
Merge pull request #25 from jaroschek/release/1.2.x
Browse files Browse the repository at this point in the history
Release 1.2.0
  • Loading branch information
jaroschek authored Jan 31, 2025
2 parents 422ab0e + 32ddab6 commit cee196d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
17 changes: 3 additions & 14 deletions custom_components/eaton_epdu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,18 @@
from homeassistant.components.snmp import async_get_snmp_engine
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType

from .const import DOMAIN, PLATFORMS
from .const import PLATFORMS
from .coordinator import SnmpCoordinator


async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up Eaton ePDU."""
hass.data[DOMAIN] = {}

return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Eaton ePDU from a config entry."""
snmpEngine = await async_get_snmp_engine(hass)
coordinator = SnmpCoordinator(hass=hass, entry=entry, snmpEngine=snmpEngine)
await coordinator.async_config_entry_first_refresh()

hass.data[DOMAIN][entry.entry_id] = coordinator
entry.runtime_data = coordinator

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

Expand All @@ -33,7 +25,4 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
hass.data[DOMAIN].pop(entry.entry_id)

return unload_ok
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
2 changes: 1 addition & 1 deletion custom_components/eaton_epdu/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"issue_tracker": "https://github.com/jaroschek/home-assistant-eaton-epdu/issues",
"requirements": [],
"ssdp": [],
"version": "1.1.2",
"version": "1.2.0",
"zeroconf": []
}
4 changes: 2 additions & 2 deletions custom_components/eaton_epdu/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from .coordinator import SnmpCoordinator
from .entity import SnmpEntity

PARALLEL_UPDATES = 1
PARALLEL_UPDATES = 0
SCAN_INTERVAL = timedelta(seconds=60)


Expand All @@ -45,7 +45,7 @@ async def async_setup_entry(
) -> None:
"""Set up the sensors."""

coordinator = hass.data[DOMAIN][entry.entry_id]
coordinator = entry.runtime_data
entities: list[SensorEntity] = []

for unit in coordinator.get_units():
Expand Down

0 comments on commit cee196d

Please sign in to comment.