Skip to content

Commit d2ea385

Browse files
feat: boost via the command line (#19)
* feat: boost via the command line * Update pyproject.toml
1 parent db67b22 commit d2ea385

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ $ python -m aiocomfoconnect set-speed low --host 192.168.1.213
2525
$ python -m aiocomfoconnect set-mode auto --host 192.168.1.213
2626
$ python -m aiocomfoconnect set-speed medium --host 192.168.1.213
2727
$ python -m aiocomfoconnect set-speed high --host 192.168.1.213
28+
$ python -m aiocomfoconnect set-boost on --host 192.168.1.213 --timeout 1200
2829

2930
$ python -m aiocomfoconnect show-sensors --host 192.168.1.213
3031
$ python -m aiocomfoconnect show-sensor 276 --host 192.168.1.213

aiocomfoconnect/__main__.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ async def main(args):
4242
elif args.action == "set-comfocool":
4343
await run_set_comfocool(args.host, args.uuid, args.mode)
4444

45+
elif args.action == "set-boost":
46+
await run_set_boost(args.host, args.uuid, args.mode, args.timeout)
47+
4548
elif args.action == "show-sensors":
4649
await run_show_sensors(args.host, args.uuid)
4750

@@ -197,6 +200,26 @@ async def run_set_comfocool(host: str, uuid: str, mode: Literal["auto", "off"]):
197200
await comfoconnect.disconnect()
198201

199202

203+
async def run_set_boost(host: str, uuid: str, mode: Literal["on", "off"], timeout: int):
204+
"""Set boost."""
205+
# Discover bridge so we know the UUID
206+
bridges = await discover_bridges(host)
207+
if not bridges:
208+
raise Exception("No bridge found")
209+
210+
# Connect to the bridge
211+
comfoconnect = ComfoConnect(bridges[0].host, bridges[0].uuid)
212+
try:
213+
await comfoconnect.connect(uuid)
214+
except ComfoConnectNotAllowed:
215+
print("Could not connect to bridge. Please register first.")
216+
sys.exit(1)
217+
218+
await comfoconnect.set_boost(mode == "on", timeout)
219+
220+
await comfoconnect.disconnect()
221+
222+
200223
async def run_show_sensors(host: str, uuid: str):
201224
"""Show all sensors."""
202225
# Discover bridge so we know the UUID
@@ -391,6 +414,12 @@ async def run_set_flow_for_speed(host: str, uuid: str, speed: Literal["away", "l
391414
p_set_mode.add_argument("--host", help="Host address of the bridge")
392415
p_set_mode.add_argument("--uuid", help="UUID of this app", default=DEFAULT_UUID)
393416

417+
p_set_boost = subparsers.add_parser("set-boost", help="trigger or cancel a boost")
418+
p_set_boost.add_argument("mode", help="Boost mode", choices=["on", "off"])
419+
p_set_boost.add_argument("--host", help="Host address of the bridge")
420+
p_set_boost.add_argument("--uuid", help="UUID of this app", default=DEFAULT_UUID)
421+
p_set_boost.add_argument("--timeout", "-t", help="Timeout in seconds", type=int, default=600)
422+
394423
p_sensors = subparsers.add_parser("show-sensors", help="show the sensor values")
395424
p_sensors.add_argument("--host", help="Host address of the bridge")
396425
p_sensors.add_argument("--uuid", help="UUID of this app", default=DEFAULT_UUID)

0 commit comments

Comments
 (0)