Improve support for 1. generation mill heater (#18423)

* Improve support for 1. gen mill heater

* style

* None operation_list for gen 1 heater

* Remove SUPPORT_OPERATION_MODE for gen 1
This commit is contained in:
Daniel Høyer Iversen 2018-11-14 19:35:12 +01:00 committed by GitHub
parent 80e616cacf
commit 00235cf6f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -19,7 +19,7 @@ from homeassistant.const import (
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession
REQUIREMENTS = ['millheater==0.2.3']
REQUIREMENTS = ['millheater==0.2.4']
_LOGGER = logging.getLogger(__name__)
@ -32,8 +32,7 @@ MIN_TEMP = 5
SERVICE_SET_ROOM_TEMP = 'mill_set_room_temperature'
SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE |
SUPPORT_FAN_MODE | SUPPORT_ON_OFF |
SUPPORT_OPERATION_MODE)
SUPPORT_FAN_MODE)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_USERNAME): cv.string,
@ -92,7 +91,9 @@ class MillHeater(ClimateDevice):
@property
def supported_features(self):
"""Return the list of supported features."""
return SUPPORT_FLAGS
if self._heater.is_gen1:
return SUPPORT_FLAGS
return SUPPORT_FLAGS | SUPPORT_ON_OFF | SUPPORT_OPERATION_MODE
@property
def available(self):
@ -157,6 +158,8 @@ class MillHeater(ClimateDevice):
@property
def is_on(self):
"""Return true if heater is on."""
if self._heater.is_gen1:
return True
return self._heater.power_status == 1
@property
@ -177,6 +180,8 @@ class MillHeater(ClimateDevice):
@property
def operation_list(self):
"""List of available operation modes."""
if self._heater.is_gen1:
return None
return [STATE_HEAT, STATE_OFF]
async def async_set_temperature(self, **kwargs):
@ -211,7 +216,7 @@ class MillHeater(ClimateDevice):
"""Set operation mode."""
if operation_mode == STATE_HEAT:
await self.async_turn_on()
elif operation_mode == STATE_OFF:
elif operation_mode == STATE_OFF and not self._heater.is_gen1:
await self.async_turn_off()
else:
_LOGGER.error("Unrecognized operation mode: %s", operation_mode)

View File

@ -628,7 +628,7 @@ mficlient==0.3.0
miflora==0.4.0
# homeassistant.components.climate.mill
millheater==0.2.3
millheater==0.2.4
# homeassistant.components.sensor.mitemp_bt
mitemp_bt==0.0.1