Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Climate] Hive Add water heater Component post the refresh of the climate component. #25148

Merged
merged 17 commits into from Jul 14, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Update water_heater

  • Loading branch information...
Rendili committed Jul 8, 2019
commit 191f5df31418a46e779c08d3be3293bab9c6e145
@@ -1,4 +1,5 @@
"""Support for hive water heaters."""
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT

from homeassistant.components.water_heater import (
STATE_ECO, STATE_ON, STATE_OFF, SUPPORT_OPERATION_MODE, WaterHeaterDevice)
@@ -9,13 +10,13 @@

HIVE_TO_HASS_STATE = {
'SCHEDULE': STATE_ECO,
'MANUAL': STATE_ON,
'ON': STATE_ON,
'OFF': STATE_OFF,
}

HASS_TO_HIVE_STATE = {
STATE_ECO: 'SCHEDULE',
STATE_ON: 'MANUAL',
STATE_ON: 'ON',
STATE_OFF: 'OFF',
}

@@ -26,7 +27,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Wink water heater devices."""
if discovery_info is None:
return
if discovery_info["HA_DeviceType"] != "Hotwater":
if discovery_info["HA_DeviceType"] != "HotWater":
return

session = hass.data.get(DATA_HIVE)
@@ -48,6 +49,7 @@ def __init__(self, hivesession, hivedevice):
self.data_updatesource = '{}.{}'.format(
self.device_type, self.node_id)
self._unique_id = '{}-{}'.format(self.node_id, self.device_type)
self._unit_of_measurement = TEMP_CELSIUS
self.session.entities.append(self)

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Jul 15, 2019

Member

Why do we need to append the entity again here? We do it in setup_platform already, right?

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Jul 15, 2019

Member

We should probably move the append to async_added_to_hass to avoid calling self.schedule_update_ha_state before the entity has been added to home assistant.

This comment has been minimized.

Copy link
@KJonline

KJonline Jul 15, 2019

Author Contributor

Hi @MartinHjelmare, since this PR has been merged I will remove the duplication in the next release.

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Jul 16, 2019

Member

If you can make a PR asap, we can adjust this before 0.96 goes out.


@property
@@ -78,12 +80,19 @@ def handle_update(self, updatesource):
@property
def name(self):
"""Return the name of the water heater """
return 'HotWater'
if self.node_name is None:
self.node_name = "Hot Water"
return self.node_name

@property
def temperature_unit(self):
"""Return the unit of measurement."""
return self._unit_of_measurement

@property
def current_operation(self):
""" Return current operation. """
return HIVE_TO_HASS_STATE[self.session.hotwater.get_state(self.node_id)]
return HIVE_TO_HASS_STATE[self.session.hotwater.get_mode(self.node_id)]

@property
def operation_list(self):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.