Skip to content

Commit

Permalink
Merge pull request #191 from gertjanstulp/fix/deprecated-number-methods
Browse files Browse the repository at this point in the history
Fixed issue with deprecated number methods
  • Loading branch information
CJNE authored Jul 21, 2022
2 parents 0188c40 + 1244e8d commit d39751c
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions custom_components/myenergi/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,25 @@ def name(self):
return f"myenergi {self.device.name} Heater Priority"

@property
def value(self):
def native_value(self):
"""Return the state of the sensor."""
return self.device.heater_priority

async def async_set_value(self, value: float) -> None:
async def async_set_native_value(self, value: float) -> None:
"""Change the selected option."""
await self.device.set_heater_priority(f"heater{int(value)}")
self.async_schedule_update_ha_state()

@property
def min_value(self):
def native_min_value(self):
return 1

@property
def max_value(self):
def native_max_value(self):
return 2

@property
def step(self):
def native_step(self):
return 1


Expand Down Expand Up @@ -99,11 +99,11 @@ def name(self):
return f"myenergi {self.device.name} Device Priority"

@property
def value(self):
def native_value(self):
"""Return the state of the sensor."""
return self.device.priority

async def async_set_value(self, value: float) -> None:
async def async_set_native_value(self, value: float) -> None:
"""Change the selected option."""
await self.device.set_priority(int(value))
self.async_schedule_update_ha_state()
Expand All @@ -114,15 +114,15 @@ def icon(self):
return "mdi:sort-numeric-variant"

@property
def min_value(self):
def native_min_value(self):
return 1

@property
def max_value(self):
def native_max_value(self):
return 10

@property
def step(self):
def native_step(self):
return 1


Expand Down Expand Up @@ -153,23 +153,23 @@ def icon(self):
return "mdi:leaf"

@property
def value(self):
def native_value(self):
"""Return the state of the sensor."""
return self.device.minimum_green_level

async def async_set_value(self, value: float) -> None:
async def async_set_native_value(self, value: float) -> None:
"""Change the selected option."""
await self.device.set_minimum_green_level(int(value))
self.async_schedule_update_ha_state()

@property
def min_value(self):
def native_min_value(self):
return 0

@property
def max_value(self):
def native_max_value(self):
return 100

@property
def step(self):
def native_step(self):
return 1

0 comments on commit d39751c

Please sign in to comment.