Skip to content

Commit

Permalink
Support for entity categories, configuration URL and other 2021.11 re…
Browse files Browse the repository at this point in the history
…lated features (#611)
  • Loading branch information
iMicknl authored Nov 3, 2021
1 parent 03d9a96 commit 5c76e86
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions custom_components/tahoma/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def device_info(self) -> DeviceInfo:
sw_version=self.executor.select_attribute(CORE_FIRMWARE_REVISION),
suggested_area=self.coordinator.areas[self.device.place_oid],
via_device=self.executor.get_gateway_id(),
configuration_url=self.coordinator.client.server.configuration_url,
)

@property
Expand Down
3 changes: 3 additions & 0 deletions custom_components/tahoma/number.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Support for Overkiz number devices."""
from homeassistant.components.number import NumberEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_CONFIG
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

Expand All @@ -14,6 +15,7 @@
name="My Position",
icon="mdi:content-save-cog",
command="setMemorized1Position",
entity_category=ENTITY_CATEGORY_CONFIG,
),
# WaterHeater: Expected Number Of Shower (2 - 4)
OverkizNumberDescription(
Expand All @@ -23,6 +25,7 @@
command="setExpectedNumberOfShower",
min_value=2,
max_value=4,
entity_category=ENTITY_CATEGORY_CONFIG,
),
]

Expand Down
6 changes: 6 additions & 0 deletions custom_components/tahoma/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION,
ENERGY_WATT_HOUR,
ENTITY_CATEGORY_DIAGNOSTIC,
LIGHT_LUX,
PERCENTAGE,
POWER_WATT,
Expand All @@ -39,12 +40,14 @@
native_unit_of_measurement=PERCENTAGE,
device_class=sensor.DEVICE_CLASS_BATTERY,
state_class=STATE_CLASS_MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
OverkizSensorDescription(
key="core:BatteryState",
name="Battery",
device_class=sensor.DEVICE_CLASS_BATTERY,
native_value=lambda value: str(value).capitalize(),
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
OverkizSensorDescription(
key="core:RSSILevelState",
Expand All @@ -53,6 +56,7 @@
device_class=sensor.DEVICE_CLASS_SIGNAL_STRENGTH,
state_class=STATE_CLASS_MEASUREMENT,
native_value=lambda value: round(value),
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
OverkizSensorDescription(
key="core:ExpectedNumberOfShowerState",
Expand Down Expand Up @@ -313,6 +317,7 @@
entity_registry_enabled_default=False,
native_value=lambda value: str(value).capitalize(),
device_class=sensor.DEVICE_CLASS_SIGNAL_STRENGTH,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
# DomesticHotWaterProduction/WaterHeatingSystem
OverkizSensorDescription(
Expand Down Expand Up @@ -389,6 +394,7 @@ def __init__(self, device_url: str, coordinator: OverkizDataUpdateCoordinator):
super().__init__(device_url, coordinator)
self._attr_name = "HomeKit Setup Code"
self._attr_icon = "mdi:shield-home"
self._attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC

@property
def state(self):
Expand Down
3 changes: 2 additions & 1 deletion custom_components/tahoma/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
SwitchEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.const import ENTITY_CATEGORY_CONFIG, STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity
Expand Down Expand Up @@ -140,6 +140,7 @@ def __init__(self, device_url: str, coordinator: OverkizDataUpdateCoordinator):
super().__init__(device_url, coordinator)
self._is_on = False
self._attr_name = f"{super().name} low speed"
self._attr_entity_category = ENTITY_CATEGORY_CONFIG

async def async_added_to_hass(self):
"""Run when entity about to be added."""
Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"switch",
"water_heater"
],
"homeassistant": "2021.9.0",
"homeassistant": "2021.11.0",
"render_readme": "true",
"iot_class": "Cloud Polling"
}
2 changes: 1 addition & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-r requirements.txt
homeassistant==2021.9.0b2
homeassistant==2021.11.0b0
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-r requirements_dev.txt
pytest-homeassistant-custom-component==0.4.4
pytest-homeassistant-custom-component==0.4.6
# required for DHCP discovery test
scapy==2.4.5
aiodiscover==1.4.2

0 comments on commit 5c76e86

Please sign in to comment.