Skip to content

Commit

Permalink
Check that config entry has the keys we expect
Browse files Browse the repository at this point in the history
  • Loading branch information
Jalle19 committed Sep 10, 2024
1 parent c46905c commit 159fe29
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/vinx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ async def get_device_information(lw3: LW3) -> DeviceInformation:

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up from a config entry."""
lw3 = LW3(entry.data["host"], entry.data["port"])
if entry.has("host") and entry.has("data"):
lw3 = LW3(entry.data["host"], entry.data["port"])
else:
raise KeyError("Config entry is missing required parameters")

try:
# Store runtime information
Expand Down

0 comments on commit 159fe29

Please sign in to comment.