Mill device state attributes (#17834)

* Mill device state attributes

* lower case
pull/17792/head
Daniel Høyer Iversen 2018-10-27 09:17:48 +02:00 committed by GitHub
parent 6b7cbca04c
commit 21870e2167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 6 deletions

View File

@ -8,16 +8,18 @@ https://home-assistant.io/components/climate.mill/
import logging
import voluptuous as vol
from homeassistant.components.climate import (
ClimateDevice, PLATFORM_SCHEMA, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_FAN_MODE, SUPPORT_ON_OFF)
ClimateDevice, PLATFORM_SCHEMA,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE,
SUPPORT_ON_OFF)
from homeassistant.const import (
ATTR_TEMPERATURE, CONF_PASSWORD, CONF_USERNAME,
STATE_ON, STATE_OFF, TEMP_CELSIUS)
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession
REQUIREMENTS = ['millheater==0.2.0']
REQUIREMENTS = ['millheater==0.2.1']
_LOGGER = logging.getLogger(__name__)
@ -43,8 +45,7 @@ async def async_setup_platform(hass, config, async_add_entities,
_LOGGER.error("Failed to connect to Mill")
return
await mill_data_connection.update_rooms()
await mill_data_connection.update_heaters()
await mill_data_connection.find_all_heaters()
dev = []
for heater in mill_data_connection.heaters.values():
@ -80,6 +81,17 @@ class MillHeater(ClimateDevice):
"""Return the name of the entity."""
return self._heater.name
@property
def device_state_attributes(self):
"""Return the state attributes."""
if self._heater.room:
room = self._heater.room.name
else:
room = "Independent device"
return {"room": room,
"open_window": self._heater.open_window,
"heating": self._heater.is_heating}
@property
def temperature_unit(self):
"""Return the unit of measurement which this thermostat uses."""

View File

@ -612,7 +612,7 @@ mficlient==0.3.0
miflora==0.4.0
# homeassistant.components.climate.mill
millheater==0.2.0
millheater==0.2.1
# homeassistant.components.sensor.mitemp_bt
mitemp_bt==0.0.1