mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Cleanup modes & available, bump version requirement (#5606)
* Cleanup modes & available, bump version requirement * check for Noneness on available
This commit is contained in:
parent
976cd545fe
commit
2c31e3ea8c
@ -10,14 +10,14 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
ClimateDevice, PLATFORM_SCHEMA, PRECISION_HALVES,
|
ClimateDevice, PLATFORM_SCHEMA, PRECISION_HALVES,
|
||||||
STATE_UNKNOWN, STATE_AUTO, STATE_ON, STATE_OFF,
|
STATE_AUTO, STATE_ON, STATE_OFF,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_MAC, TEMP_CELSIUS, CONF_DEVICES, ATTR_TEMPERATURE)
|
CONF_MAC, TEMP_CELSIUS, CONF_DEVICES, ATTR_TEMPERATURE)
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['python-eq3bt==0.1.4']
|
REQUIREMENTS = ['python-eq3bt==0.1.5']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -61,15 +61,12 @@ class EQ3BTSmartThermostat(ClimateDevice):
|
|||||||
# we want to avoid name clash with this module..
|
# we want to avoid name clash with this module..
|
||||||
import eq3bt as eq3
|
import eq3bt as eq3
|
||||||
|
|
||||||
self.modes = {None: STATE_UNKNOWN, # When not yet connected.
|
self.modes = {eq3.Mode.Open: STATE_ON,
|
||||||
eq3.Mode.Unknown: STATE_UNKNOWN,
|
|
||||||
eq3.Mode.Auto: STATE_AUTO,
|
|
||||||
# away handled separately, here just for reverse mapping
|
|
||||||
eq3.Mode.Away: STATE_AWAY,
|
|
||||||
eq3.Mode.Closed: STATE_OFF,
|
eq3.Mode.Closed: STATE_OFF,
|
||||||
eq3.Mode.Open: STATE_ON,
|
eq3.Mode.Auto: STATE_AUTO,
|
||||||
eq3.Mode.Manual: STATE_MANUAL,
|
eq3.Mode.Manual: STATE_MANUAL,
|
||||||
eq3.Mode.Boost: STATE_BOOST}
|
eq3.Mode.Boost: STATE_BOOST,
|
||||||
|
eq3.Mode.Away: STATE_AWAY}
|
||||||
|
|
||||||
self.reverse_modes = {v: k for k, v in self.modes.items()}
|
self.reverse_modes = {v: k for k, v in self.modes.items()}
|
||||||
|
|
||||||
@ -79,7 +76,7 @@ class EQ3BTSmartThermostat(ClimateDevice):
|
|||||||
@property
|
@property
|
||||||
def available(self) -> bool:
|
def available(self) -> bool:
|
||||||
"""Return if thermostat is available."""
|
"""Return if thermostat is available."""
|
||||||
return self.current_operation != STATE_UNKNOWN
|
return self.current_operation is not None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
@ -116,6 +113,8 @@ class EQ3BTSmartThermostat(ClimateDevice):
|
|||||||
@property
|
@property
|
||||||
def current_operation(self):
|
def current_operation(self):
|
||||||
"""Current mode."""
|
"""Current mode."""
|
||||||
|
if self._thermostat.mode < 0:
|
||||||
|
return None
|
||||||
return self.modes[self._thermostat.mode]
|
return self.modes[self._thermostat.mode]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -498,7 +498,7 @@ pysnmp==4.3.2
|
|||||||
python-digitalocean==1.10.1
|
python-digitalocean==1.10.1
|
||||||
|
|
||||||
# homeassistant.components.climate.eq3btsmart
|
# homeassistant.components.climate.eq3btsmart
|
||||||
# python-eq3bt==0.1.4
|
# python-eq3bt==0.1.5
|
||||||
|
|
||||||
# homeassistant.components.sensor.darksky
|
# homeassistant.components.sensor.darksky
|
||||||
python-forecastio==1.3.5
|
python-forecastio==1.3.5
|
||||||
|
Loading…
x
Reference in New Issue
Block a user