Skip to content

Commit

Permalink
Add support for 'device configuration urls'
Browse files Browse the repository at this point in the history
  • Loading branch information
rroller committed Dec 4, 2021
1 parent 1287a08 commit dc3211e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_components/dahua/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."""
Expand Down
1 change: 1 addition & 0 deletions custom_components/dahua/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}

Expand Down

0 comments on commit dc3211e

Please sign in to comment.