diff --git a/docs/configuration.md b/docs/configuration.md index 2e8ee92..d45b723 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1269,6 +1269,10 @@ The following options are available for `hue` device types: address: # A valid ip address or hostname of the Philips Hue Bridge. This # parameter must be provided. +port: +# A port number if an alternative Zigbee bridge is used on a HTTP port +# different from the default 80/443 +# user: # The api key used for request authorization. This option accepts # Jinja2 Templates, see the [secrets] section for details. diff --git a/moonraker/components/power.py b/moonraker/components/power.py index 355688b..ad9c42e 100644 --- a/moonraker/components/power.py +++ b/moonraker/components/power.py @@ -1381,7 +1381,7 @@ class MQTTDevice(PowerDevice): class HueDevice(HTTPDevice): def __init__(self, config: ConfigHelper) -> None: - super().__init__(config) + super().__init__(config, default_port=80) self.device_id = config.get("device_id") self.device_type = config.get("device_type", "light") if self.device_type == "group": @@ -1394,7 +1394,7 @@ class HueDevice(HTTPDevice): async def _send_power_request(self, state: str) -> str: new_state = True if state == "on" else False url = ( - f"{self.protocol}://{quote(self.addr)}/api/{quote(self.user)}" + f"{self.protocol}://{quote(self.addr)}:{self.port}/api/{quote(self.user)}" f"/{self.device_type}s/{quote(self.device_id)}" f"/{quote(self.state_key)}" ) @@ -1410,7 +1410,7 @@ class HueDevice(HTTPDevice): async def _send_status_request(self) -> str: url = ( - f"{self.protocol}://{quote(self.addr)}/api/{quote(self.user)}" + f"{self.protocol}://{quote(self.addr)}:{self.port}/api/{quote(self.user)}" f"/{self.device_type}s/{quote(self.device_id)}" ) ret = await self.client.request("GET", url)