Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions homeassistant/components/overkiz/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from collections.abc import Callable
from dataclasses import dataclass
from typing import cast

from pyoverkiz.enums import OverkizCommandParam, OverkizState
from pyoverkiz.types import StateType as OverkizStateType
Expand Down Expand Up @@ -100,6 +101,16 @@ class OverkizBinarySensorDescription(
device_class=BinarySensorDeviceClass.VIBRATION,
value_fn=lambda state: state == OverkizCommandParam.DETECTED,
),
# DomesticHotWaterProduction/WaterHeatingSystem
OverkizBinarySensorDescription(
key=OverkizState.IO_OPERATING_MODE_CAPABILITIES,
name="Energy Demand Status",
device_class=BinarySensorDeviceClass.HEAT,
value_fn=lambda state: cast(dict, state).get(
OverkizCommandParam.ENERGY_DEMAND_STATUS
)
== 1,
),
]


Expand Down
7 changes: 7 additions & 0 deletions homeassistant/components/overkiz/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@
icon="mdi:human-greeting-variant",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
# RTDIndoorSiren / RTDOutdoorSiren
ButtonEntityDescription(key="dingDong", name="Ding Dong", icon="mdi:bell-ring"),
ButtonEntityDescription(key="bip", name="Bip", icon="mdi:bell-ring"),
ButtonEntityDescription(
key="fastBipSequence", name="Fast Bip Sequence", icon="mdi:bell-ring"
),
ButtonEntityDescription(key="ring", name="Ring", icon="mdi:bell-ring"),
]


Expand Down
13 changes: 13 additions & 0 deletions homeassistant/components/overkiz/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@
UIClass.DOOR_LOCK: Platform.LOCK,
UIClass.LIGHT: Platform.LIGHT,
}

# Map Overkiz camelCase to Home Assistant snake_case
OVERKIZ_STATE_TO_TRANSLATION: dict[str, str] = {
"externalGateway": "external_gateway",
"localUser": "local_user",
"lowBattery": "low_battery",
"LSC": "lsc",
"maintenanceRequired": "maintenance_required",
"noDefect": "no_defect",
"SAAC": "saac",
"SFC": "sfc",
"UPS": "ups",
}
21 changes: 12 additions & 9 deletions homeassistant/components/overkiz/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,19 @@ def generate_device_info(self) -> DeviceInfo:
)

model = (
str(
self.executor.select_state(
OverkizState.CORE_MODEL,
OverkizState.CORE_PRODUCT_MODEL_NAME,
OverkizState.IO_MODEL,
),
self.executor.select_state(
OverkizState.CORE_MODEL,
OverkizState.CORE_PRODUCT_MODEL_NAME,
OverkizState.IO_MODEL,
)
or self.device.widget
or self.device.widget.value
)

return DeviceInfo(
identifiers={(DOMAIN, self.executor.base_device_url)},
name=self.device.label,
manufacturer=str(manufacturer),
model=model,
model=str(model),
sw_version=str(
self.executor.select_attribute(OverkizAttribute.CORE_FIRMWARE_REVISION)
),
Expand Down Expand Up @@ -105,5 +103,10 @@ def __init__(
class OverkizDeviceClass(StrEnum):
"""Device class for Overkiz specific devices."""

OPEN_CLOSED_PEDESTRIAN = "overkiz__open_closed_pedestrian"
BATTERY = "overkiz__battery"
DISCRETE_RSSI_LEVEL = "overkiz__discrete_rssi_level"
MEMORIZED_SIMPLE_VOLUME = "overkiz__memorized_simple_volume"
OPEN_CLOSED_PEDESTRIAN = "overkiz__open_closed_pedestrian"
PRIORITY_LOCK_ORIGINATOR = "overkiz__priority_lock_originator"
SENSOR_DEFECT = "overkiz__sensor_defect"
SENSOR_ROOM = "overkiz__sensor_room"
31 changes: 24 additions & 7 deletions homeassistant/components/overkiz/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
from homeassistant.helpers.typing import StateType

from . import HomeAssistantOverkizData
from .const import DOMAIN, IGNORED_OVERKIZ_DEVICES
from .const import DOMAIN, IGNORED_OVERKIZ_DEVICES, OVERKIZ_STATE_TO_TRANSLATION
from .coordinator import OverkizDataUpdateCoordinator
from .entity import OverkizDescriptiveEntity, OverkizEntity
from .entity import OverkizDescriptiveEntity, OverkizDeviceClass, OverkizEntity


@dataclass
Expand All @@ -53,12 +53,14 @@ class OverkizSensorDescription(SensorEntityDescription):
device_class=SensorDeviceClass.BATTERY,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
native_value=lambda value: int(str(value).strip("%")),
),
OverkizSensorDescription(
key=OverkizState.CORE_BATTERY,
name="Battery",
native_value=lambda value: str(value).capitalize(),
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:battery",
device_class=OverkizDeviceClass.BATTERY,
),
OverkizSensorDescription(
key=OverkizState.CORE_RSSI_LEVEL,
Expand Down Expand Up @@ -309,15 +311,19 @@ class OverkizSensorDescription(SensorEntityDescription):
OverkizSensorDescription(
key=OverkizState.IO_SENSOR_ROOM,
name="Sensor Room",
native_value=lambda value: str(value).capitalize(),
entity_registry_enabled_default=False,
device_class=OverkizDeviceClass.SENSOR_ROOM,
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:spray-bottle",
),
OverkizSensorDescription(
key=OverkizState.IO_PRIORITY_LOCK_ORIGINATOR,
name="Priority Lock Originator",
native_value=lambda value: str(value).capitalize(),
device_class=OverkizDeviceClass.PRIORITY_LOCK_ORIGINATOR,
icon="mdi:lock",
entity_registry_enabled_default=False,
native_value=lambda value: OVERKIZ_STATE_TO_TRANSLATION.get(
cast(str, value), cast(str, value)
),
),
OverkizSensorDescription(
key=OverkizState.CORE_PRIORITY_LOCK_TIMER,
Expand All @@ -330,8 +336,19 @@ class OverkizSensorDescription(SensorEntityDescription):
key=OverkizState.CORE_DISCRETE_RSSI_LEVEL,
name="Discrete RSSI Level",
entity_registry_enabled_default=False,
native_value=lambda value: str(value).capitalize(),
entity_category=EntityCategory.DIAGNOSTIC,
device_class=OverkizDeviceClass.DISCRETE_RSSI_LEVEL,
icon="mdi:wifi",
),
OverkizSensorDescription(
key=OverkizState.CORE_SENSOR_DEFECT,
name="Sensor Defect",
entity_registry_enabled_default=False,
entity_category=EntityCategory.DIAGNOSTIC,
device_class=OverkizDeviceClass.SENSOR_DEFECT,
native_value=lambda value: OVERKIZ_STATE_TO_TRANSLATION.get(
cast(str, value), cast(str, value)
),
),
# DomesticHotWaterProduction/WaterHeatingSystem
OverkizSensorDescription(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/overkiz/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"server_in_maintenance": "Server is down for maintenance",
"too_many_requests": "Too many requests, try again later.",
"too_many_requests": "Too many requests, try again later",
"unknown": "[%key:common::config_flow::error::unknown%]"
},
"abort": {
Expand Down
41 changes: 41 additions & 0 deletions homeassistant/components/overkiz/strings.sensor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"state": {
"overkiz__battery": {
"full": "Full",
"low": "Low",
"normal": "Normal",
"verylow": "Very low"
},
"overkiz__discrete_rssi_level": {
"good": "Good",
"low": "Low",
"normal": "Normal",
"verylow": "Very low"
},
"overkiz__priority_lock_originator": {
"lsc": "LSC",
"saac": "SAAC",
"sfc": "SFC",
"ups": "UPS",
"external_gateway": "External gateway",
"local_user": "Local user",
"myself": "Myself",
"rain": "Rain",
"security": "Security",
"temperature": "Temperature",
"timer": "Timer",
"user": "User",
"wind": "Wind"
},
"overkiz__sensor_room": {
"clean": "Clean",
"dirty": "Dirty"
},
"overkiz__sensor_defect": {
"dead": "Dead",
"low_battery": "Low battery",
"maintenance_required": "Maintenance required",
"no_defect": "No defect"
}
}
}
2 changes: 1 addition & 1 deletion homeassistant/components/overkiz/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"cannot_connect": "Failed to connect",
"invalid_auth": "Invalid authentication",
"server_in_maintenance": "Server is down for maintenance",
"too_many_requests": "Too many requests, try again later.",
"too_many_requests": "Too many requests, try again later",
"unknown": "Unexpected error"
},
"step": {
Expand Down
41 changes: 41 additions & 0 deletions homeassistant/components/overkiz/translations/sensor.en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"state": {
"overkiz__battery": {
"full": "Full",
"low": "Low",
"normal": "Normal",
"verylow": "Very low"
},
"overkiz__discrete_rssi_level": {
"good": "Good",
"low": "Low",
"normal": "Normal",
"verylow": "Very low"
},
"overkiz__priority_lock_originator": {
"external_gateway": "External gateway",
"local_user": "Local user",
"lsc": "LSC",
"myself": "Myself",
"rain": "Rain",
"saac": "SAAC",
"security": "Security",
"sfc": "SFC",
"temperature": "Temperature",
"timer": "Timer",
"ups": "UPS",
"user": "User",
"wind": "Wind"
},
"overkiz__sensor_defect": {
"dead": "Dead",
"low_battery": "Low battery",
"maintenance_required": "Maintenance required",
"no_defect": "No defect"
},
"overkiz__sensor_room": {
"clean": "Clean",
"dirty": "Dirty"
}
}
}