@@ -34,30 +34,15 @@ async def add_configured_entities():
3434 for entity in entities :
3535
3636 device_name = instance .device_name_from_entity_id (entity .unique_id )
37- # If we in update mode, then remove instance_name prefix from device name
38- if instance .updating :
39- _LOGGER .info (f"We in updating mode. Removing prefix { instance .name } for { device_name } " )
40- device_name = device_name .removeprefix (instance .name + "_" )
41- instance .entity_registry .async_update_entity (
42- entity_id = entity .entity_id ,
43- new_unique_id = instance .create_entity_id (device_name )
44- )
4537 _LOGGER .debug (f"add_configured_entities: creating sensor with name { device_name } " )
4638 (sensor , _ ) = instance .get_sensor (device_name )
47- if instance .updating :
48- await sensor .device_update ()
4939 sensors .append (sensor )
5040
5141 async_add_entities (sensors )
5242
5343 instance : SleepAsAndroidInstance = hass .data [DOMAIN ][config_entry .entry_id ]
5444 await add_configured_entities ()
5545 _LOGGER .debug ("async_setup_entry: adding configured entities is finished." )
56-
57- if instance .updating :
58- _LOGGER .debug ("We need update. Running self_update" )
59- instance .self_update ()
60-
6146 _LOGGER .debug ("Going to subscribe to root topic." )
6247 await instance .subscribe_root_topic (async_add_entities )
6348 _LOGGER .debug ("async_setup_entry is finished" )
@@ -163,22 +148,3 @@ def device_info(self):
163148 info = {"identifiers" : {(DOMAIN , self .unique_id )}, "name" : self .name , "manufacturer" : "SleepAsAndroid" ,
164149 "type" : None , "model" : "MQTT" }
165150 return info
166-
167- async def device_update (self ) -> None :
168- if not self ._instance .updating :
169- return
170-
171- device_registry = await dr .async_get_registry (self .hass )
172- # Instance in updating mode. Device should be update too
173- _LOGGER .info ("Updating device identifiers" )
174- # v1.2.4 -> v1.2.5 update
175- old_identifiers = {(DOMAIN , self ._instance .name + "_" + self .unique_id )}
176- _LOGGER .info (f"Trying to get v1.2.4 device { old_identifiers } " )
177- device = device_registry .async_get_device (identifiers = old_identifiers , connections = set ())
178- if device is not None :
179- _LOGGER .info (f"Found device { device .id } from v1.2.4. Updating ... " )
180- device_registry .async_update_device (
181- device_id = device .id ,
182- new_identifiers = self .device_info ['identifiers' ]
183- )
184- _LOGGER .info ("Device updating finished" )
0 commit comments