Skip to content

Commit

Permalink
power: add support for custom Homeseer ports
Browse files Browse the repository at this point in the history
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
  • Loading branch information
Arksine committed Mar 1, 2024
1 parent 9813011 commit f0ae517
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion moonraker/components/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ def __init__(
self.password = config.load_template(
"password", default_password).render()
self.protocol = config.get("protocol", default_protocol)
if self.port == -1:
self.port = 443 if self.protocol.lower() == "https" else 80

async def init_state(self) -> None:
async with self.request_lock:
Expand Down Expand Up @@ -1109,7 +1111,7 @@ async def _send_homeseer(
query = urlencode(query_args)
url = (
f"{self.protocol}://{quote(self.user)}:{quote(self.password)}@"
f"{quote(self.addr)}/JSON?{query}"
f"{quote(self.addr)}:{self.port}/JSON?{query}"
)
return await self._send_http_command(url, request)

Expand Down

0 comments on commit f0ae517

Please sign in to comment.