-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Water heater support #17058
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
Water heater support #17058
Conversation
state = self.hass.states.get(ENTITY_WATER_HEATER) | ||
self.assertEqual("eco", state.attributes.get('operation_mode')) | ||
self.assertEqual("eco", state.state) | ||
water_heater.set_operation_mode(self.hass, "electric", ENTITY_WATER_HEATER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (83 > 79 characters)
For more details about this platform, please refer to the documentation at | ||
https://home-assistant.io/components/water_heater.wink/ | ||
""" | ||
import asyncio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'asyncio' imported but unused
vacation.delete() | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
|
||
def turn_away_mode_on(self): | ||
"""Set a vacation for 1 year.""" | ||
self.add_vacation(None, (datetime.datetime.now() + datetime.timedelta(days=365)).timestamp()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (101 > 79 characters)
self._unit_of_measurement = unit_of_measurement | ||
self._away = away | ||
self._current_operation = current_operation | ||
self._operation_list = ['eco', 'electric', 'performance', 'high_demand', 'heat_pump', 'gas'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (100 > 79 characters)
def setup_platform(hass, config, add_entities, discovery_info=None): | ||
"""Set up the Demo water_heater devices.""" | ||
add_entities([ | ||
DemoWaterHeater('Demo Water Heater', 119, TEMP_FAHRENHEIT, False, 'eco') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (80 > 79 characters)
SUPPORT_TARGET_TEMPERATURE, | ||
SUPPORT_AWAY_MODE, | ||
SUPPORT_OPERATION_MODE) | ||
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT, ATTR_TEMPERATURE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'homeassistant.const.TEMP_CELSIUS' imported but unused
_LOGGER.debug("set_temperature start data=%s", kwargs) | ||
hass.services.call(DOMAIN, SERVICE_SET_TEMPERATURE, kwargs) | ||
|
||
@bind_hass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
|
||
hass.services.call(DOMAIN, SERVICE_SET_AWAY_MODE, data) | ||
|
||
@bind_hass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
from homeassistant.const import ( | ||
ATTR_ENTITY_ID, ATTR_TEMPERATURE, SERVICE_TURN_ON, SERVICE_TURN_OFF, | ||
STATE_ON, STATE_OFF, STATE_UNKNOWN, TEMP_CELSIUS, PRECISION_WHOLE, | ||
PRECISION_TENTHS, TEMP_FAHRENHEIT ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace before ')'
When I run ./script/gen_requirments_all.py i get the following error.
I manually made the update to the file but tarvis doesn't seem to like that. |
FYI, there is a thread discuss about water_heater: home-assistant/architecture#59
|
|
||
|
||
@bind_hass | ||
def set_away_mode(hass, away_mode, entity_id=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop these methods, we have just deleted them from the rest of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So do I need to create a common.py in the test like climate is doing or just remove these can call the services directly?
# Describes the format for available climate services | ||
|
||
set_aux_heat: | ||
description: Turn auxiliary heater on/off for climate device. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
climate?
description: Name(s) of entities to change. | ||
example: 'climate.water_heater' | ||
|
||
sensibo_assume_state: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ehr
@@ -176,8 +176,7 @@ | |||
}) | |||
|
|||
WINK_COMPONENTS = [ | |||
'binary_sensor', 'sensor', 'light', 'switch', 'lock', 'cover', 'climate', | |||
'fan', 'alarm_control_panel', 'scene' | |||
'water_heater' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opps yeah I was using that while testing so I didn't get all of my Wink devices pulled in. Good catch.
@@ -526,6 +525,7 @@ def siren_service_handle(service): | |||
discovery.load_platform(hass, wink_component, DOMAIN, {}, config) | |||
|
|||
component = EntityComponent(_LOGGER, DOMAIN, hass) | |||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
....
Overall this looks good. Could you move wink and econet platforms to each their own PR, to be submitted after the main component + tests + demo platform has been merged. Will also need a PR for the developer website to document the new entity type in the architecture section. |
@balloob Sounds good I'll move the econet and wink stuff out of this and address the other comments. |
@awarecan yeah I think I have had that happen before. If I run python3 setup.py install it doesn't delete old stuff in the build folder. I guess I need to wipe it out and try again. |
c1c9eb3
to
81416ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't look at tests.
cv.has_at_least_one_key( | ||
ATTR_TEMPERATURE), | ||
{ | ||
vol.Exclusive(ATTR_TEMPERATURE, 'temperature'): vol.Coerce(float), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems not updated. This key should be required.
vol.Required(ATTR_AWAY_MODE): cv.boolean, | ||
}) | ||
SET_TEMPERATURE_SCHEMA = vol.Schema(vol.All( | ||
cv.has_at_least_one_key( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this.
return self.current_operation | ||
if self.is_on: | ||
return STATE_ON | ||
return STATE_UNKNOWN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return None
.
|
||
@property | ||
def current_operation(self): | ||
"""Return current operation ie. heat, cool, idle.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stale docstring.
"""Set new target temperature.""" | ||
raise NotImplementedError() | ||
|
||
def async_set_temperature(self, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this a coroutine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this?
|
||
This method must be run in the event loop and returns a coroutine. | ||
""" | ||
return self.hass.async_add_job(self.turn_away_mode_off) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
def async_set_temperature(self, **kwargs): | ||
"""Set new target temperature. | ||
|
||
This method must be run in the event loop and returns a coroutine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update docstring. This shouldn't return a coroutine.
|
||
def set_temperature(self, **kwargs): | ||
"""Set new target temperatures.""" | ||
if kwargs.get(ATTR_TEMPERATURE) is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be a required argument, so we can remove this check.
description: Name(s) of entities to change. | ||
example: 'water_heater.water_heater' | ||
temperature: | ||
description: New target temperature for HVAC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stale description.
example: 'water_heater.water_heater' | ||
operation_mode: | ||
description: New value of operation mode. | ||
example: Eco |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't capitalize eco.
|
||
async def async_set_operation_mode(self, operation_mode): | ||
"""Set new target operation mode.""" | ||
await self.hass.async_add_executor_job(self.set_operation_mode, operation_mode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (87 > 79 characters)
@MartinHjelmare I think I have addressed all of your requests. Let me know if its okay. Thanks for reviewing! |
… wink water_heater files
dcca30e
to
1f220ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Description:
Support for water heater demo platform and tests.
This was requested by @balloob in #13539 awhile back, but I was not able to test as I don't have a water heater compatible with either platform. I finally found a user willing to help out and got around to moving it over.
This requires home-assistant/frontend#1661 in order to work correctly in the frontend.
Related issue (if applicable):
This lays the foundation for resolving #13539.
Pull request in home-assistant.io with documentation (if applicable): home-assistant/developers.home-assistant#113
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices: