Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d0b6768

Browse files
jesserockzfrenck
andauthored
Add issue to ESPHome deprecating api password (home-assistant#86606)
Co-authored-by: Franck Nijhof <git@frenck.dev>
1 parent 60b799a commit d0b6768

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

‎homeassistant/components/esphome/__init__.py‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,30 @@ def _async_check_firmware_version(
107107
)
108108

109109

110+
@callback
111+
def _async_check_using_api_password(
112+
hass: HomeAssistant, device_info: EsphomeDeviceInfo, has_password: bool
113+
) -> None:
114+
"""Create or delete an the api_password_deprecated issue."""
115+
# ESPHome device_info.mac_address is the unique_id
116+
issue = f"api_password_deprecated-{device_info.mac_address}"
117+
if not has_password:
118+
async_delete_issue(hass, DOMAIN, issue)
119+
return
120+
async_create_issue(
121+
hass,
122+
DOMAIN,
123+
issue,
124+
is_fixable=False,
125+
severity=IssueSeverity.WARNING,
126+
learn_more_url="https://esphome.io/components/api.html",
127+
translation_key="api_password_deprecated",
128+
translation_placeholders={
129+
"name": device_info.name,
130+
},
131+
)
132+
133+
110134
async def async_setup_entry( # noqa: C901
111135
hass: HomeAssistant, entry: ConfigEntry
112136
) -> bool:
@@ -309,6 +333,7 @@ async def on_connect() -> None:
309333
await cli.disconnect()
310334
else:
311335
_async_check_firmware_version(hass, device_info)
336+
_async_check_using_api_password(hass, device_info, bool(password))
312337

313338
async def on_disconnect() -> None:
314339
"""Run disconnect callbacks on API disconnect."""

‎homeassistant/components/esphome/strings.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
"ble_firmware_outdated": {
5151
"title": "Update {name} with ESPHome {version} or later",
5252
"description": "To improve Bluetooth reliability and performance, we highly recommend updating {name} with ESPHome {version} or later. When updating the device to ESPHome {version}, it is recommended to use a serial cable instead of an over-the-air update to take advantage of the new partition scheme."
53+
},
54+
"api_password_deprecated": {
55+
"title": "API Password deprecated on {name}",
56+
"description": "The API password for ESPHome is deprecated and the use of an API encryption key is recommended instead.\n\nRemove the API password and add an encryption key to your ESPHome device to resolve this issue."
5357
}
5458
}
5559
}

‎homeassistant/components/esphome/translations/en.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
}
4848
},
4949
"issues": {
50+
"api_password_deprecated": {
51+
"description": "The API password for ESPHome is deprecated and the use of an API encryption key is recommended instead.\n\nRemove the API password and add an encryption key to your ESPHome device to resolve this issue.",
52+
"title": "API Password deprecated on {name}"
53+
},
5054
"ble_firmware_outdated": {
5155
"description": "To improve Bluetooth reliability and performance, we highly recommend updating {name} with ESPHome {version} or later. When updating the device to ESPHome {version}, it is recommended to use a serial cable instead of an over-the-air update to take advantage of the new partition scheme.",
5256
"title": "Update {name} with ESPHome {version} or later"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /