Remove update before add
This commit is contained in:
parent
29a69215ca
commit
5b787b9820
|
|
@ -115,7 +115,7 @@ async def async_setup_entry(
|
||||||
for item in vacuums:
|
for item in vacuums:
|
||||||
item = vacuums[item]
|
item = vacuums[item]
|
||||||
entity = RoboVacEntity(item)
|
entity = RoboVacEntity(item)
|
||||||
async_add_entities([entity], update_before_add=True)
|
async_add_entities([entity])
|
||||||
|
|
||||||
|
|
||||||
class RoboVacEntity(StateVacuumEntity):
|
class RoboVacEntity(StateVacuumEntity):
|
||||||
|
|
@ -346,11 +346,15 @@ class RoboVacEntity(StateVacuumEntity):
|
||||||
self.tuyastatus.get(CONSUMABLE_CODE)
|
self.tuyastatus.get(CONSUMABLE_CODE)
|
||||||
).decode("ascii")
|
).decode("ascii")
|
||||||
)["consumable"]["duration"]
|
)["consumable"]["duration"]
|
||||||
|
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
except TuyaException as e:
|
except TuyaException as e:
|
||||||
self.update_failures += 1
|
self.update_failures += 1
|
||||||
_LOGGER.debug("Update errored. Current failure count: {}. Reason: {}".format(self.update_failures, e))
|
_LOGGER.debug(
|
||||||
|
"Update errored. Current failure count: {}. Reason: {}".format(
|
||||||
|
self.update_failures, e
|
||||||
|
)
|
||||||
|
)
|
||||||
if self.update_failures == UPDATE_RETRIES:
|
if self.update_failures == UPDATE_RETRIES:
|
||||||
self.update_failures = 0
|
self.update_failures = 0
|
||||||
self.error_code = "CONNECTION_FAILED"
|
self.error_code = "CONNECTION_FAILED"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue