File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
custom_components/aquarea Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -355,12 +355,14 @@ def bit_to_bool(value: str) -> Optional[bool]:
355
355
def read_demandcontrol (value : str ) -> Optional [int ]:
356
356
i = float (value )
357
357
if i >= 43 and i <= 234 :
358
- return round ((i - 43 ) / (234 - 43 ) * 100 )
358
+ i = (i - 43 ) / (234 - 43 )
359
+ return round (i * 95 ) + 5
359
360
return None
360
361
361
362
362
363
def write_demandcontrol (value : int ) -> str :
363
- return str (int (value / 100 * (234 - 43 ) + 43 ))
364
+ value = (value - 5 ) / 95 # 5% -> 100% to 0% -> 95% for remapping
365
+ return str (int (value * (234 - 43 ) + 43 ))
364
366
365
367
366
368
def read_smart_grid_mode (value : str ) -> str :
@@ -645,7 +647,7 @@ def build_numbers(mqtt_prefix: str) -> list[HeishaMonNumberEntityDescription]:
645
647
name = "Demand Control" ,
646
648
entity_category = EntityCategory .CONFIG ,
647
649
native_unit_of_measurement = "%" ,
648
- native_min_value = 20 ,
650
+ native_min_value = 5 ,
649
651
native_max_value = 100 ,
650
652
native_step = 5 ,
651
653
state = read_demandcontrol ,
You can’t perform that action at this time.
0 commit comments