Add repair issue for Reolink when using it with an incompatible global ssl certificate (#91597)

This commit is contained in:
starkillerOG 2023-08-07 10:52:14 +01:00 committed by GitHub
parent 001dda6345
commit d72057f41b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 0 deletions

View file

@ -231,6 +231,7 @@ class ReolinkHost:
"network_link": "https://my.home-assistant.io/redirect/network/",
},
)
if self._base_url.startswith("https"):
ir.async_create_issue(
self._hass,
@ -246,9 +247,28 @@ class ReolinkHost:
)
else:
ir.async_delete_issue(self._hass, DOMAIN, "https_webhook")
if self._hass.config.api is not None and self._hass.config.api.use_ssl:
ir.async_create_issue(
self._hass,
DOMAIN,
"ssl",
is_fixable=False,
severity=ir.IssueSeverity.WARNING,
translation_key="ssl",
translation_placeholders={
"ssl_link": "https://www.home-assistant.io/integrations/http/#ssl_certificate",
"base_url": self._base_url,
"network_link": "https://my.home-assistant.io/redirect/network/",
"nginx_link": "https://github.com/home-assistant/addons/tree/master/nginx_proxy",
},
)
else:
ir.async_delete_issue(self._hass, DOMAIN, "ssl")
else:
ir.async_delete_issue(self._hass, DOMAIN, "webhook_url")
ir.async_delete_issue(self._hass, DOMAIN, "https_webhook")
ir.async_delete_issue(self._hass, DOMAIN, "ssl")
# If no ONVIF push or long polling state is received, start fast polling
await self._async_poll_all_motion()