Skip to content

Commit

Permalink
Fix "key" argurment non default
Browse files Browse the repository at this point in the history
  • Loading branch information
cyr-ius committed Jan 5, 2024
1 parent 7fae57f commit 7e1fbe4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
6 changes: 0 additions & 6 deletions custom_components/bbox/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ def __init__(self, coordinator: BboxDataUpdateCoordinator, description) -> None:
self.entity_description = description
self._attr_device_info = {
"identifiers": {(DOMAIN, self.box_id)},
# "connections": {
# (
# CONNECTION_NETWORK_MAC,
# finditem(coordinator.data, "device_info.hosts.macaddress", "01:02:03:04:05:06"),
# )
# },
"manufacturer": MANUFACTURER,
"name": BBOX_NAME,
"model": device.get("modelname"),
Expand Down
23 changes: 11 additions & 12 deletions custom_components/bbox/helpers.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
"""Helpers for component."""
from __future__ import annotations

from collections.abc import Callable
from dataclasses import dataclass
from homeassistant.helpers.typing import StateType
from homeassistant.components.sensor import SensorEntityDescription
from homeassistant.components.binary_sensor import BinarySensorEntityDescription
from typing import Any

from homeassistant.components.binary_sensor import BinarySensorEntityDescription
from homeassistant.components.sensor import SensorEntityDescription
from homeassistant.helpers.typing import StateType


@dataclass
class BboxValueFnMixin:
"""Mixin for Audi sensor."""
@dataclass(frozen=True)
class BboxSensorDescription(SensorEntityDescription):
"""Describes a sensor."""

value_fn: Callable[..., StateType] | None = None


@dataclass
class BboxSensorDescription(BboxValueFnMixin, SensorEntityDescription):
@dataclass(frozen=True)
class BboxBinarySensorDescription(BinarySensorEntityDescription):
"""Describes a sensor."""


@dataclass
class BboxBinarySensorDescription(BboxValueFnMixin, BinarySensorEntityDescription):
"""Describes a sensor."""
value_fn: Callable[..., StateType] | None = None


def finditem(data: dict[str, Any], key_chain: str, default: Any = None) -> Any:
Expand Down

0 comments on commit 7e1fbe4

Please sign in to comment.