From 00235cf6f0a2fc80bcc35ea2461927ae2b114a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=B8yer=20Iversen?= Date: Wed, 14 Nov 2018 19:35:12 +0100 Subject: [PATCH] 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 --- homeassistant/components/climate/mill.py | 15 ++++++++++----- requirements_all.txt | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/climate/mill.py b/homeassistant/components/climate/mill.py index f4615ee6517..bfeaba001b8 100644 --- a/homeassistant/components/climate/mill.py +++ b/homeassistant/components/climate/mill.py @@ -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) diff --git a/requirements_all.txt b/requirements_all.txt index 5f9fd0d7c21..1a880b5d7d3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -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