diff --git a/custom_components/dahua/__init__.py b/custom_components/dahua/__init__.py index e88e10e..012c809 100644 --- a/custom_components/dahua/__init__.py +++ b/custom_components/dahua/__init__.py @@ -116,6 +116,7 @@ def __init__(self, hass: HomeAssistant, events: list, address: str, port: int, r self._profile_mode = "0" self._supports_profile_mode = False self._channel = channel + self._address = address # channel_number is not the channel_index. channel_number is the index + 1. # So channel index 0 is channel number 1. Except for some older firmwares where channel @@ -577,6 +578,9 @@ def get_event_key(self, event_name: str) -> str: """returns the event key we use for listeners. It uses the channel index to support multiple channels""" return "{0}-{1}".format(event_name, self._channel) + def get_address(self) -> str: + """returns the IP address of this camera""" + return self._address async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Handle removal of an entry.""" diff --git a/custom_components/dahua/entity.py b/custom_components/dahua/entity.py index c4e79a2..3181485 100644 --- a/custom_components/dahua/entity.py +++ b/custom_components/dahua/entity.py @@ -28,6 +28,7 @@ def device_info(self): "name": self._coordinator.get_device_name(), "model": self._coordinator.get_model(), "manufacturer": "Dahua", + "configuration_url": "http://" + self._coordinator.get_address(), "sw_version": self._coordinator.get_firmware_version(), }