Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions homeassistant/components/climate/mill.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import voluptuous as vol

from homeassistant.components.climate import (
ClimateDevice, PLATFORM_SCHEMA,
ClimateDevice, DOMAIN, PLATFORM_SCHEMA,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE,
SUPPORT_ON_OFF)
from homeassistant.const import (
Expand All @@ -19,12 +19,18 @@
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession

REQUIREMENTS = ['millheater==0.2.1']
REQUIREMENTS = ['millheater==0.2.2']

_LOGGER = logging.getLogger(__name__)

ATTR_AWAY_TEMP = 'away_temp'
ATTR_COMFORT_TEMP = 'comfort_temp'
ATTR_ROOM_NAME = 'room_name'
ATTR_SLEEP_TEMP = 'sleep_temp'
MAX_TEMP = 35
MIN_TEMP = 5
SERVICE_SET_ROOM_TEMP = 'mill_set_room_temperature'

SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE |
SUPPORT_FAN_MODE | SUPPORT_ON_OFF)

Expand All @@ -33,6 +39,13 @@
vol.Required(CONF_PASSWORD): cv.string,
})

SET_ROOM_TEMP_SCHEMA = vol.Schema({
vol.Required(ATTR_ROOM_NAME): cv.string,
vol.Optional(ATTR_AWAY_TEMP): cv.positive_int,
vol.Optional(ATTR_COMFORT_TEMP): cv.positive_int,
vol.Optional(ATTR_SLEEP_TEMP): cv.positive_int,
})


async def async_setup_platform(hass, config, async_add_entities,
discovery_info=None):
Expand All @@ -52,6 +65,20 @@ async def async_setup_platform(hass, config, async_add_entities,
dev.append(MillHeater(heater, mill_data_connection))
async_add_entities(dev)

async def set_room_temp(service):
"""Set room temp."""
room_name = service.data.get(ATTR_ROOM_NAME)
sleep_temp = service.data.get(ATTR_SLEEP_TEMP)
comfort_temp = service.data.get(ATTR_COMFORT_TEMP)
away_temp = service.data.get(ATTR_AWAY_TEMP)
await mill_data_connection.set_room_temperatures_by_name(room_name,
sleep_temp,
comfort_temp,
away_temp)

hass.services.async_register(DOMAIN, SERVICE_SET_ROOM_TEMP,
set_room_temp, schema=SET_ROOM_TEMP_SCHEMA)


class MillHeater(ClimateDevice):
"""Representation of a Mill Thermostat device."""
Expand Down Expand Up @@ -88,9 +115,12 @@ def device_state_attributes(self):
room = self._heater.room.name
else:
room = "Independent device"
return {"room": room,
"open_window": self._heater.open_window,
"heating": self._heater.is_heating}
return {
"room": room,
"open_window": self._heater.open_window,
"heating": self._heater.is_heating,
"controlled_by_tibber": self._heater.tibber_control,
}

@property
def temperature_unit(self):
Expand Down
16 changes: 16 additions & 0 deletions homeassistant/components/climate/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@ ecobee_resume_program:
description: Resume all events and return to the scheduled program. This default to false which removes only the top event.
example: true

mill_set_room_temperature:
description: Set Mill room temperatures.
fields:
room_name:
description: Name of room to change.
example: 'kitchen'
away_temp:
description: Away temp.
example: 12
comfort_temp:
description: Comfort temp.
example: 22
sleep_temp:
description: Sleep temp.
example: 17

nuheat_resume_program:
description: Resume the programmed schedule.
fields:
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ mficlient==0.3.0
miflora==0.4.0

# homeassistant.components.climate.mill
millheater==0.2.1
millheater==0.2.2

# homeassistant.components.sensor.mitemp_bt
mitemp_bt==0.0.1
Expand Down