Skip to content

Commit

Permalink
Removed used of undefined constants, not sure if this is correct though
Browse files Browse the repository at this point in the history
  • Loading branch information
CJNE committed Feb 18, 2024
1 parent 494f506 commit 9fdd9a2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions custom_components/myenergi/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
from homeassistant.components.select import SelectEntity
from homeassistant.helpers import entity_platform
from pymyenergi.eddi import EDDI_MODES
from pymyenergi.libbi import LIBBI_MODE_NAMES
from pymyenergi.libbi import LIBBI_MODES
from pymyenergi.libbi import MODE_NORMAL
from pymyenergi.libbi import MODE_STOPPED
from pymyenergi.zappi import CHARGE_MODES

from .const import DOMAIN
from .entity import MyenergiEntity

LIBBI_MODE_NAMES = {
0: 'Stopped',
1: 'Normal',
5: 'Export'
}

ATTR_BOOST_AMOUNT = "amount"
ATTR_BOOST_TIME = "time"
ATTR_BOOST_TARGET = "target"
Expand Down Expand Up @@ -166,9 +169,8 @@ def name(self):
@property
def current_option(self):
"""Return the state of the sensor."""
if self.device.local_mode == LIBBI_MODE_NAMES[MODE_STOPPED]:
return LIBBI_MODES[MODE_STOPPED]
return LIBBI_MODES[MODE_NORMAL]
mode = self.device.local_mode
return LIBBI_MODE_NAMES[mode]

async def async_select_option(self, option: str) -> None:
"""Change the selected option."""
Expand Down

0 comments on commit 9fdd9a2

Please sign in to comment.