Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
check if service exists before removing (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasgermain authored Jan 9, 2023
1 parent 23200c0 commit af03db8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion custom_components/multimatic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ async def async_unload_services(hass, entry: ConfigEntry):
key = service_key
if serial:
key += f"_{serial}"
hass.services.async_remove(DOMAIN, key)
if hass.services.has_service(DOMAIN, key):
hass.services.async_remove(DOMAIN, key)


async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
Expand Down

0 comments on commit af03db8

Please sign in to comment.