Skip to content

Commit

Permalink
Mill device state attributes (#17834)
Browse files Browse the repository at this point in the history
* Mill device state attributes

* lower case
  • Loading branch information
Danielhiversen committed Oct 27, 2018
1 parent 6b7cbca commit 21870e2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
22 changes: 17 additions & 5 deletions homeassistant/components/climate/mill.py
Expand Up @@ -8,16 +8,18 @@
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__)

Expand All @@ -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():
Expand Down Expand Up @@ -80,6 +81,17 @@ def name(self):
"""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."""
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Expand Up @@ -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
Expand Down

0 comments on commit 21870e2

Please sign in to comment.