Skip to content

Commit 14cb717

Browse files
authored
Merge pull request #53 from sayurin:improve
Refactor lighting system for improved clarity
2 parents 91cde1f + 469ced3 commit 14cb717

6 files changed

Lines changed: 12 additions & 50 deletions

File tree

README.ja.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@
6363
| 0x0263 | 電動シャッター | Cover + 汎用エンティティ |
6464
| 0x0290 | 一般照明 | Light + 汎用エンティティ |
6565
| 0x0291 | 単機能照明 | Light + 汎用エンティティ |
66-
| 0x02A3 | 照明システム | Light + 汎用エンティティ |
67-
| 0x02A4 | 拡張照明システム | Light + 汎用エンティティ |
6866

6967
**汎用エンティティのみ**(センサー、電力メーター、EV 充電器、調理機器など 50 以上のクラス — インテグレーションオプション UI で一覧を確認できます)。
7068

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ The following classes require **Enable experimental device classes** to be turne
6363
| 0x0263 | Electrically Operated Shutter | Cover + generic entities |
6464
| 0x0290 | General Lighting | Light + generic entities |
6565
| 0x0291 | Mono-Functional Lighting | Light + generic entities |
66-
| 0x02A3 | Lighting System | Light + generic entities |
67-
| 0x02A4 | Extended Lighting System | Light + generic entities |
6866

6967
**Via generic entities only** (50+ additional classes including sensors, meters, EV chargers, cookware, and more — see the full list in the integration options UI).
7068

custom_components/echonet_lite/const.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@
6262
CLASS_CODE_STORAGE_BATTERY = 0x027D
6363
CLASS_CODE_GENERAL_LIGHTING = 0x0290
6464
CLASS_CODE_MONO_FUNCTIONAL_LIGHTING = 0x0291
65-
CLASS_CODE_LIGHTING_SYSTEM = 0x02A3
66-
CLASS_CODE_EXTENDED_LIGHTING_SYSTEM = 0x02A4
6765
CLASS_CODE_SWITCH = 0x05FD # Switch (supporting JEM-A/HA terminals)
6866
CLASS_CODE_CONTROLLER = 0x05FF
6967

@@ -212,18 +210,6 @@
212210
EPC_LIGHTING_MODE,
213211
}
214212
),
215-
CLASS_CODE_LIGHTING_SYSTEM: frozenset(
216-
{
217-
EPC_OPERATION_STATUS,
218-
EPC_LIGHT_LEVEL,
219-
}
220-
),
221-
CLASS_CODE_EXTENDED_LIGHTING_SYSTEM: frozenset(
222-
{
223-
EPC_OPERATION_STATUS,
224-
EPC_LIGHT_LEVEL,
225-
}
226-
),
227213
}
228214

229215

custom_components/echonet_lite/cover.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,13 @@ def __init__(
102102
# Build supported_features dynamically from the device's advertised
103103
# property map so devices that omit optional EPCs (position, tilt)
104104
# don't expose unsupported controls in the UI.
105-
features = (
106-
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP
107-
)
105+
features = CoverEntityFeature(0)
106+
if EPC_COVER_OPEN_CLOSE in node.set_epcs:
107+
features |= (
108+
CoverEntityFeature.OPEN
109+
| CoverEntityFeature.CLOSE
110+
| CoverEntityFeature.STOP
111+
)
108112
if EPC_COVER_POSITION in node.set_epcs:
109113
features |= CoverEntityFeature.SET_POSITION
110114
if EPC_COVER_ANGLE in node.set_epcs:

custom_components/echonet_lite/icons.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,6 @@
5050
}
5151
}
5252
},
53-
"light": {
54-
"extended_lighting_system": {
55-
"default": "mdi:lightbulb-multiple-off",
56-
"state": {
57-
"on": "mdi:lightbulb-multiple"
58-
}
59-
},
60-
"lighting_system": {
61-
"default": "mdi:lightbulb-multiple-off",
62-
"state": {
63-
"on": "mdi:lightbulb-multiple"
64-
}
65-
}
66-
},
6753
"select": {
6854
"installation_location_code": {
6955
"default": "mdi:map-marker",

custom_components/echonet_lite/light.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
1919

2020
from .const import (
21-
CLASS_CODE_EXTENDED_LIGHTING_SYSTEM as CC_EXTENDED_LIGHTING_SYSTEM,
22-
CLASS_CODE_GENERAL_LIGHTING as CC_GENERAL_LIGHTING,
23-
CLASS_CODE_LIGHTING_SYSTEM as CC_LIGHTING_SYSTEM,
24-
CLASS_CODE_MONO_FUNCTIONAL_LIGHTING as CC_MONO_FUNCTIONAL_LIGHTING,
21+
CLASS_CODE_GENERAL_LIGHTING as CC_GENERAL,
22+
CLASS_CODE_MONO_FUNCTIONAL_LIGHTING as CC_MONO,
2523
EPC_LIGHT_COLOR,
2624
EPC_LIGHT_LEVEL,
2725
EPC_LIGHTING_MODE,
@@ -113,18 +111,10 @@ def _create_light_description(
113111

114112

115113
_DESCRIPTIONS: dict[int, EchonetLiteLightEntityDescription] = {
116-
CC_GENERAL_LIGHTING: _create_light_description(
117-
CC_GENERAL_LIGHTING, "general_lighting", build_color=True, build_mode=True
118-
),
119-
CC_MONO_FUNCTIONAL_LIGHTING: _create_light_description(
120-
CC_MONO_FUNCTIONAL_LIGHTING, "mono_functional_lighting"
121-
),
122-
CC_LIGHTING_SYSTEM: _create_light_description(
123-
CC_LIGHTING_SYSTEM, "lighting_system"
124-
),
125-
CC_EXTENDED_LIGHTING_SYSTEM: _create_light_description(
126-
CC_EXTENDED_LIGHTING_SYSTEM, "extended_lighting_system"
114+
CC_GENERAL: _create_light_description(
115+
CC_GENERAL, "general_lighting", build_color=True, build_mode=True
127116
),
117+
CC_MONO: _create_light_description(CC_MONO, "mono_functional_lighting"),
128118
}
129119

130120

0 commit comments

Comments
 (0)