Skip to content

Commit 5f26786

Browse files
committed
push float numbers to sense
1 parent 892380d commit 5f26786

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

custom_components/plugwise_usb/number.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class PlugwiseNumberEntityDescription(
3333
"""Describes Plugwise Number entity."""
3434

3535
async_number_fn: str = ""
36+
async_number_type: str = "int"
3637

3738

3839
NUMBER_TYPES: tuple[PlugwiseNumberEntityDescription, ...] = (
@@ -103,6 +104,7 @@ class PlugwiseNumberEntityDescription(
103104
native_max_value=99,
104105
native_min_value=1,
105106
native_step=0.1,
107+
async_number_type="float",
106108
mode="box",
107109
),
108110
PlugwiseNumberEntityDescription(
@@ -115,6 +117,7 @@ class PlugwiseNumberEntityDescription(
115117
native_max_value=99,
116118
native_min_value=1,
117119
native_step=0.1,
120+
async_number_type="float",
118121
mode="box",
119122
),
120123
PlugwiseNumberEntityDescription(
@@ -127,6 +130,7 @@ class PlugwiseNumberEntityDescription(
127130
native_max_value=60,
128131
native_min_value=1,
129132
native_step=0.1,
133+
async_number_type="float",
130134
mode="box",
131135
),
132136
PlugwiseNumberEntityDescription(
@@ -139,6 +143,7 @@ class PlugwiseNumberEntityDescription(
139143
native_max_value=60,
140144
native_min_value=1,
141145
native_step=0.1,
146+
async_number_type="float",
142147
mode="box",
143148
),
144149
)
@@ -228,6 +233,8 @@ def _handle_coordinator_update(self) -> None:
228233

229234
async def async_set_native_value(self, value: float) -> None:
230235
"""Update the current value."""
231-
232-
await self.async_number_fn(int(value))
236+
if self.entity_description.async_number_type == "float":
237+
await self.async_number_fn(float(value))
238+
else:
239+
await self.async_number_fn(int(value))
233240
self.async_write_ha_state()

0 commit comments

Comments
 (0)