diff --git a/custom_components/sonoff/number.py b/custom_components/sonoff/number.py index 9bb46b15..5131b17a 100644 --- a/custom_components/sonoff/number.py +++ b/custom_components/sonoff/number.py @@ -30,9 +30,9 @@ def set_state(self, params: dict): if self.round is not None: # convert to int when round is zero value = round(value, self.round or None) - self._attr_value = value + self._attr_native_value = value - async def async_set_value(self, value: float) -> None: + async def async_set_native_value(self, value: float) -> None: if self.multiply: value /= self.multiply await self.ewelink.send(self.device, {self.param: int(value)}) @@ -40,14 +40,14 @@ async def async_set_value(self, value: float) -> None: class XPulseWidth(XEntity, NumberEntity): - _attr_max_value = 36000 - _attr_min_value = 0.5 - _attr_step = 0.5 + _attr_native_max_value = 36000 + _attr_native_min_value = 0.5 + _attr_native_step = 0.5 def set_state(self, params: dict): - self._attr_value = params["pulseWidth"] / 1000 + self._attr_native_value = params["pulseWidth"] / 1000 - async def async_set_value(self, value: float) -> None: + async def async_set_native_value(self, value: float) -> None: """ we need to send {'pulse': 'on'} in order to also set the pilseWidth else it'll reject the command