|
51 | 51 | async_remove_orphaned_entities, |
52 | 52 | brightness_to_percentage, |
53 | 53 | get_device_entry_gen, |
| 54 | + get_rpc_channel_name, |
| 55 | + get_rpc_key_id, |
54 | 56 | is_block_channel_type_light, |
55 | 57 | is_rpc_channel_type_light, |
56 | 58 | percentage_to_brightness, |
@@ -120,6 +122,7 @@ def __init__( |
120 | 122 | """Initialize block light.""" |
121 | 123 | super().__init__(coordinator, block, attribute, description) |
122 | 124 | self.control_result: dict[str, Any] | None = None |
| 125 | + self._attr_name = None # Main device entity |
123 | 126 | self._attr_unique_id: str = f"{coordinator.mac}-{block.description}" |
124 | 127 | self._attr_supported_color_modes = set() |
125 | 128 | self._attr_min_color_temp_kelvin = KELVIN_MIN_VALUE_WHITE |
@@ -377,6 +380,7 @@ def __init__( |
377 | 380 | ) -> None: |
378 | 381 | """Initialize light.""" |
379 | 382 | super().__init__(coordinator, key, attribute, description) |
| 383 | + self._attr_name = get_rpc_channel_name(coordinator.device, key) |
380 | 384 | self._attr_unique_id = f"{coordinator.mac}-{key}" |
381 | 385 |
|
382 | 386 | @property |
@@ -535,7 +539,7 @@ class RpcShellyRgbwLight(RpcShellyLightBase): |
535 | 539 | key="switch", |
536 | 540 | sub_key="output", |
537 | 541 | removal_condition=lambda config, _status, key: not is_rpc_channel_type_light( |
538 | | - config, int(key.split(":")[-1]) |
| 542 | + config, get_rpc_key_id(key) |
539 | 543 | ), |
540 | 544 | entity_class=RpcShellySwitchAsLight, |
541 | 545 | ), |
|
0 commit comments