Add devices class to better categorisation in HA

This commit is contained in:
2023-02-27 21:31:37 +01:00
parent 7ea6c96331
commit bdaccea1e1
5 changed files with 73 additions and 27 deletions

View File

@@ -106,7 +106,7 @@ async def async_setup_entry(hass, entry):
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
async def async_unload_entry(hass, entry):
"""Unload an GeoRide config entry."""
await hass.config_entries.async_forward_entry_unload(entry, "device_tracker")
@@ -116,22 +116,12 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
await hass.config_entries.async_forward_entry_unload(entry, "siren")
context = hass.data[DOMAIN]["context"]
context.socket.disconnect() // Disconnect only if all devices is disabled
context.socket.disconnect() # Disconnect only if all devices is disabled
return True
async def async_remove_config_entry_device(hass: HomeAssistant, config_entry: ConfigEntry, device_entry: DeviceEntry) -> bool:
"""Remove an GeoRide device entry."""
await hass.config_entries.async_remove_config_entry_device(device_entry, "device_tracker")
await hass.config_entries.async_remove_config_entry_device(device_entry, "switch")
await hass.config_entries.async_remove_config_entry_device(device_entry, "sensor")
await hass.config_entries.async_remove_config_entry_device(device_entry, "binary_sensor")
await hass.config_entries.async_remove_config_entry_device(device_entry, "siren")
context = hass.data[DOMAIN]["context"]
# context.socket.disconnect()
async def async_remove_config_entry_device(hass, config_entry, device_entry) -> bool:
"""Remove an GeoRide device entry."""
return True