Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit c0883db

Browse files
committed
Fixed: expiration slider doesn't update UI state
1 parent c94ba01 commit c0883db

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

custom_components/format_ble_tracker/README.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

custom_components/format_ble_tracker/number.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ async def async_added_to_hass(self):
4040
"""Entity has been added to hass, restoring state"""
4141
restored = await self.async_get_last_number_data()
4242
native_value = 2 if restored is None else restored.native_value
43-
self._attr_native_value = native_value
44-
await self.coordinator.on_expiration_time_changed(native_value)
45-
self.async_write_ha_state()
43+
await self.update_value(native_value)
4644

4745
async def async_set_native_value(self, value: float) -> None:
4846
"""Update the current value."""
4947
val = min(10, max(1, int(value)))
50-
self._attr_native_value = val
51-
await self.coordinator.on_expiration_time_changed(val)
48+
await self.update_value(val)
49+
50+
51+
async def update_value(self, value: int):
52+
"""Set value to HA and coordinator"""
53+
self._attr_native_value = value
54+
await self.coordinator.on_expiration_time_changed(value)
55+
self.async_write_ha_state()
5256

0 commit comments

Comments
 (0)