Skip to content

Commit fbd3aed

Browse files
authored
Merge pull request #168 from CoMPaTech/reboot
Add back reboot button
2 parents c839799 + 56b6bb1 commit fbd3aed

4 files changed

Lines changed: 25 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.6.4] - 2026-02-13
6+
7+
### Added
8+
9+
- Re-added reboot functionality
10+
511
## [0.6.3] - 2026-01-25
612

713
### Changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ More details on the integration can be found on the [Ubiquiti UISP airOS](https:
4141
- Wireless mode and signal strength.
4242
- Connected stations and their statistics.
4343
- System information and uptime.
44-
- Device Control: Provides methods to perform actions, such as reconnecting/kicking a connected wireless station.
44+
- Device Control: Provides methods to perform actions, such as reconnecting/kicking a connected wireless station and rebooting the device itself.
4545
- Discovery of airOS devices on your local network (by listening to announcements these devices broadcast).
4646

4747
## Installation
@@ -142,6 +142,7 @@ Note: For firmware 6 we only support the login and status calls currently.
142142
- `warnings()`: Retrieves warning status dict.
143143

144144
- `stakick(mac_address: str)`: Disconnects a specific station by its MAC address.
145+
- `reboot()`: Reboots the device.
145146
- `provmode(active: bool = False)`: Enables or disables the provisioning mode.
146147

147148
- `update_check(force: bool = False)`: Checks if new firmware has been discovered (or force to force check).

airos/base.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def __init__(
7878
# Mostly 8.x API endpoints, login/status are the same in 6.x
7979
self._login_url = f"{self.base_url}/api/auth"
8080
self._status_cgi_url = f"{self.base_url}/status.cgi"
81+
self._reboot_cgi_url = f"{self.base_url}/reboot.cgi"
8182

8283
# Presumed 6.x XM only endpoint
8384
self._v6_xm_login_url = f"{self.base_url}/login.cgi"
@@ -448,6 +449,21 @@ async def stakick(self, mac_address: str | None = None) -> bool:
448449
)
449450
return True
450451

452+
async def reboot(self) -> bool:
453+
"""Reboot/restart device."""
454+
payload = {"reboot": "yes"}
455+
456+
result = await self._request_json(
457+
"POST",
458+
self._reboot_cgi_url,
459+
form_data=payload,
460+
ct_form=True,
461+
authenticated=True,
462+
)
463+
464+
ok_value = result.get("ok")
465+
return ok_value is True or ok_value == "true"
466+
451467
async def provmode(self, active: bool = False) -> bool:
452468
"""Set provisioning mode."""
453469
action = "stop"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "airos"
7-
version = "0.6.3"
7+
version = "0.6.4"
88
license = "MIT"
99
description = "Ubiquiti airOS module(s) for Python 3."
1010
readme = "README.md"

0 commit comments

Comments
 (0)