Skip to content

Commit acdd1e1

Browse files
committed
Only add reboot button when supported by py_netgear_plus.
1 parent b65f298 commit acdd1e1

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ some basic configuration updates.
6868
| GS108Ev4 | 8 | V1.0.1.3 | |
6969
| GS108PEv3 | 8 | V2.06.24 | V2.06.01 |
7070
| GS110EMX | 10 | V1.0.2.8 | |
71-
| GS116Ev2 | 16 | ? | ? |
71+
| GS116Ev2 | 16 | V2.6.0.48, V2.6.0.50 | ? |
7272
| GS305E | 5 | V1.0.0.16 | V1.0.0.2 |
7373
| GS305EP | 5 | V1.0.1.1 | |
7474
| GS305EPP | 5 | V1.0.1.4 | |

custom_components/netgear_plus/button.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,22 @@ async def async_setup_entry(
2828
coordinator_switch_infos = config_entry.runtime_data.coordinator_switch_infos
2929

3030
if gs_switch.api:
31+
if gs_switch.api.switch_model.has_reboot_button():
32+
_LOGGER.info(
33+
"[button.async_setup_entry] setting up Platform.BUTTON for Switch Reboot"
34+
)
35+
entities.append(
36+
NetgearRebootButtonEntity(
37+
coordinator=coordinator_switch_infos,
38+
hub=gs_switch,
39+
entity_description=NetgearButtonEntityDescription(
40+
key="reboot",
41+
name="Reboot Switch",
42+
device_class=ButtonDeviceClass.RESTART,
43+
),
44+
)
45+
)
46+
3147
n_poe_ports = 0
3248
if gs_switch.api.poe_ports:
3349
n_poe_ports = len(gs_switch.api.poe_ports)
@@ -37,18 +53,6 @@ async def async_setup_entry(
3753
n_poe_ports,
3854
)
3955

40-
entities.append(
41-
NetgearRebootButtonEntity(
42-
coordinator=coordinator_switch_infos,
43-
hub=gs_switch,
44-
entity_description=NetgearButtonEntityDescription(
45-
key="reboot",
46-
name="Reboot Switch",
47-
device_class=ButtonDeviceClass.RESTART,
48-
),
49-
)
50-
)
51-
5256
if n_poe_ports > 0:
5357
for poe_port in gs_switch.api.poe_ports:
5458
switch_entity = NetgearPoEPowerCycleButtonEntity(

custom_components/netgear_plus/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"documentation": "https://github.com/ckarrie/ha-netgear-plus/blob/main/README.md",
77
"iot_class": "local_polling",
88
"issue_tracker": "https://github.com/ckarrie/ha-netgear-plus/issues",
9-
"requirements": ["lxml>=4.6.1", "py-netgear-plus==v0.4.6"],
9+
"requirements": ["lxml>=4.6.1", "py-netgear-plus==v0.4.7"],
1010
"ssdp": [
1111
{
1212
"manufacturer": "NETGEAR",
1313
"deviceType": "urn:schemas-upnp-org:device:InternetGatewayDevice:1"
1414
}
1515
],
16-
"version": "0.7.8"
16+
"version": "0.7.9"
1717
}

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
colorlog==6.9.0
22
homeassistant>=2024.12.5
33
lxml>=4.6.1
4-
py-netgear-plus==v0.4.6
4+
py-netgear-plus==v0.4.7
55
pip>=21.3.1
66
ruff==0.11.13

0 commit comments

Comments
 (0)