1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Hive water heater - Remove Duplication of appending entities (#25210)

* climate_water_heater

* updated names

* Update water_heater

* Update requirements

* Updated reqirements

* Version update

* updated Versiojn

* Update device list

* Removed unused Attributes

* removed duplicate appending entities

* re-added missing hotwater

* Move call to async_added_to_hass

* Move session append to async_added_to_hass

* White space
This commit is contained in:
Khole
2019-07-17 23:17:44 +01:00
committed by Paulus Schoutsen
parent 9550a38f22
commit 1215398aef
2 changed files with 10 additions and 4 deletions

View File

@@ -35,7 +35,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
climate = HiveClimateEntity(session, discovery_info)
add_entities([climate])
session.entities.append(climate)
class HiveClimateEntity(ClimateDevice):
@@ -52,7 +51,6 @@ class HiveClimateEntity(ClimateDevice):
self.data_updatesource = '{}.{}'.format(
self.device_type, self.node_id)
self._unique_id = '{}-{}'.format(self.node_id, self.device_type)
self.session.entities.append(self)
@property
def unique_id(self):
@@ -145,6 +143,11 @@ class HiveClimateEntity(ClimateDevice):
"""Return a list of available preset modes."""
return SUPPORT_PRESET
async def async_added_to_hass(self):
"""When entity is added to Home Assistant."""
await super().async_added_to_hass()
self.session.entities.append(self)
def set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
new_mode = HASS_TO_HIVE_STATE[hvac_mode]