Skip to content

Commit 9f8c128

Browse files
committed
Update version to 2.2.1-beta.2 in manifest.json and modify switch.py to adjust device class handling and UI behavior for toggle switches.
1 parent 24655c2 commit 9f8c128

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

custom_components/unifi_network_rules/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
"aiounifi>=82.0.0",
1616
"orjson>=3.8.0"
1717
],
18-
"version": "2.2.1-beta.1"
18+
"version": "2.2.1-beta.2"
1919
}

custom_components/unifi_network_rules/switch.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import re
1010
import copy
1111

12-
from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription, PLATFORM_SCHEMA
12+
from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription, SwitchDeviceClass, PLATFORM_SCHEMA
1313
from homeassistant.config_entries import ConfigEntry
1414
from homeassistant.core import HomeAssistant, callback
1515
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
@@ -343,9 +343,6 @@ def __init__(
343343
# Set default icon for all rule switches (can be overridden by subclasses)
344344
self._attr_icon = "mdi:toggle-switch"
345345

346-
# Set device class to outlet to force toggle/slider rendering instead of icon button
347-
self._attr_device_class = "outlet"
348-
349346
# Set device info
350347
self._attr_device_info = DeviceInfo(
351348
identifiers={(DOMAIN, coordinator.api.host)},
@@ -602,8 +599,8 @@ def is_on(self) -> bool:
602599

603600
@property
604601
def assumed_state(self) -> bool:
605-
"""Return True as we're implementing optimistic state."""
606-
return True
602+
"""Return False to get toggle slider UI instead of icon buttons."""
603+
return False
607604

608605
def _get_current_rule(self) -> Any | None:
609606
"""Get current rule data from coordinator."""

0 commit comments

Comments
 (0)