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

Add hive boost to climate and water_heater #26789

Merged
merged 33 commits into from Sep 27, 2019

Conversation

@KJonline
Copy link
Contributor

commented Sep 21, 2019

Description:

Add the ability to call the boost function for the hive hot water. it will also allow a time period to be set for the climate boost by implementing a hive boost service.

Related issue (if applicable): fixes #25536

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#10407

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.
KJonline and others added 18 commits Sep 4, 2019
…t into feature/add_boost
* dev: (42 commits)
  Remove default host for Plex config (#26583)
  Add Obihai integration (#26537)
  Add switch platform to iaqualink integration (#26545)
  Fix GTFS sensor wrong timezone (#26580)
  Make uk_transport sensor timezone/DST aware (#26577)
  Updated frontend to 20190911.0 (#26578)
  bump dependencies (#26576)
  Bump UPC connect / fix auth issue (#26570)
  Cleanup stale script stuff (#26573)
  Improve startup of devcontainer (#26572)
  Ignore test output
  [ci skip] Translation update
  deCONZ device automations (#26366)
  Nuki less strict (#26542)
  osram cluster (#26555)
  fix events for smartthings acceleration cluster (#26557)
  Fix tests
  Refactor Cast (#26550)
  Add sensor platform to iaqualink component (#26544)
  Bump geniushub-client to 0.6.13 (#26554)
  ...
…t into feature/add_boost

* 'feature/add_boost' of github.com:KJonline/home-assistant:
  Update Libary to 0.2.19
* dev: (38 commits)
  Fix Environment Canada weather forecast, retain icon_code sensor (#26646)
  Rename MockToggleDevice to MockToggleEntity (#26644)
  Refactor nzbget to support future platform changes (#26462)
  deCONZ - Remove mechanisms to import a configuration from configuration.yaml (#26648)
  deCONZ - battery sensor instead of battery attribute (#26591)
  Add built in weather to Homematic IP Cloud (#26642)
  Move deCONZ services to their own file (#26645)
  Add group attribute to Homematic IP Cloud (#26618)
  Add iaqualink binary sensor and unique_id (#26616)
  zha ZCL color loop effect (#26549)
  [ci skip] Translation update
  deCONZ -  create deconz_events through sensor platform (#26592)
  Update azure-pipelines-wheels.yml for Azure Pipelines
  Update azure-pipelines-wheels.yml
  Refactor Bluetooth Tracker to async (#26614)
  Fix Typo (#26612)
  [ci skip] Translation update
  Disable Watson TTS Telemetry (#26253)
  Improve bluetooth tracker device code (#26067)
  Bump zigpy-zigate to 0.3.1 (#26600)
  ...
* dev: (92 commits)
  Bump pynws version to 0.8.1 (#26770)
  Bump HAP-python to 2.6.0 for homekit (#26783)
  [ci skip] Translation update
  Add integration scaffolding script (#26777)
  Bump simplisafe-python to 5.0.1 (#26775)
  Bump aiowwlln to 2.0.2 (#26769)
  ZHA siren and warning device support (#26046)
  Add transport data from maps.yandex.ru api (#26766)
  Type hint additions (#26765)
  Bump openwrt-luci-rpc to version 1.1.1 (#26759)
  Revert "Add transport data from maps.yandex.ru api (#26252)" (#26762)
  [ci skip] Translation update
  Updated frontend to 20190919.0
  deCONZ improve gateway tests (#26709)
  Add transport data from maps.yandex.ru api (#26252)
  Update codeowners (#26733)
  Bump influxdb to 5.2.3 (#26743)
  Izone component (#24550)
  Bump restrictedpython to 5.0 (#26741)
  Bumped version to 0.99.1
  ...
@project-bot project-bot bot added this to Needs review in Dev Sep 21, 2019
@KJonline KJonline referenced this pull request Sep 21, 2019
2 of 2 tasks complete
homeassistant/components/hive/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/hive/climate.py Outdated Show resolved Hide resolved
homeassistant/components/hive/climate.py Outdated Show resolved Hide resolved
homeassistant/components/hive/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/hive/climate.py Outdated Show resolved Hide resolved
homeassistant/components/hive/water_heater.py Outdated Show resolved Hide resolved
Dev automation moved this from Needs review to Review in progress Sep 21, 2019
@MartinHjelmare MartinHjelmare changed the title Feature/add boost - Add Hives boost functionality to the climate and water_heater component Add hive boost to climate and water_heater Sep 21, 2019
homeassistant/components/hive/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/hive/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/hive/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/hive/climate.py Outdated Show resolved Hide resolved
homeassistant/components/hive/climate.py Outdated Show resolved Hide resolved
homeassistant/components/hive/climate.py Outdated Show resolved Hide resolved
homeassistant/components/hive/climate.py Outdated Show resolved Hide resolved
KJonline added 2 commits Sep 22, 2019
@KJonline

This comment has been minimized.

Copy link
Contributor Author

commented Sep 24, 2019

Hi @MartinHjelmare, I have amended post your recent comments and updated the files passing a list through to Add Entities and introducing a base class for the callback, along with the other changes.

self.session.core.update_data(self.node_id)
self.attributes = self.session.attributes.state_attributes(self.node_id)

def update(self):

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Sep 24, 2019

Member

This looks like it has been outdented too far.

homeassistant/components/hive/__init__.py Outdated Show resolved Hide resolved
@KJonline

This comment has been minimized.

Copy link
Contributor Author

commented Sep 26, 2019

Hi @MartinHjelmare, i have committed the latest changes following your last review.

* dev: (87 commits)
  Add ecobee services to create and delete vacations (#26923)
  Centralize rainbird config and add binary sensor platform (#26393)
  Add config flow to transmission (#26434)
  Add Plex config options support (#26870)
  Bump pyobihai, add unique ID and availability (#26922)
  Add mysensors codeowner (#26917)
  [ci skip] Translation update
  Add MySensors ACK (#26894)
  Remove lamps and groups from ha when removed from Hue (#26881)
  Add config flow to ecobee (#26634)
  deCONZ - Increase bridge discovery robustness in config flow (#26911)
  Add call direction sensor for Obihai (#26867)
  Bumped version to 0.99.3
  HM-CC-TC was not recognized (#26623)
  Add google_assistant alarm_control_panel (#26249)
  deCONZ - Improve ssdp discovery by storing uuid in config entry (#26882)
  Fix missing whitespace around arithmetic operator (#26908)
  Fix bed_activity history chart of the Xiaomi Aqara vibration sensor (#26875)
  Add voltage attribute to Xiaomi Aqara devices (#26876)
  Bump ndms2-client to 0.0.9 (#26899)
  ...
homeassistant/components/hive/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/hive/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/hive/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/hive/binary_sensor.py Outdated Show resolved Hide resolved
KJonline and others added 4 commits Sep 26, 2019
Co-Authored-By: Martin Hjelmare <marhje52@kth.se>
Co-Authored-By: Martin Hjelmare <marhje52@kth.se>
Co-Authored-By: Martin Hjelmare <marhje52@kth.se>
@KJonline

This comment has been minimized.

Copy link
Contributor Author

commented Sep 26, 2019

Hi @MartinHjelmare, i have updated moving the variables to the parent class. i have had to leave one variable in the light child class as it has an extra piece of data which is only available if the device is light.

@KJonline

This comment has been minimized.

Copy link
Contributor Author

commented Sep 26, 2019

Hi @MartinHjelmare, it looks like the pylint check is failing on the platform classes that call the parent class but don’t do anything else within the initialisation process e.g binary_sensor. Where as the climate and light platform which calls the parent and assigns a variable in the child class aren’t being flagged by pylint. Any ideas?

@MartinHjelmare

This comment has been minimized.

Copy link
Member

commented Sep 27, 2019

In the child classes that doesn't do anything but call the parent class init, we can remove the init method in the child class.

"""Representation of a Hive binary sensor."""

def __init__(self, hivesession, hivedevice):
def __init__(self, hive_session, hive_device):

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Sep 27, 2019

Member

Remove this.

"""Hive Sensor Entity."""

def __init__(self, hivesession, hivedevice):
def __init__(self, hive_session, hive_device):

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Sep 27, 2019

Member

Remove this.

"""Hive Active Plug."""

def __init__(self, hivesession, hivedevice):
def __init__(self, hive_session, hive_device):

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Sep 27, 2019

Member

Remove this.

"""Hive Water Heater Device."""

def __init__(self, hivesession, hivedevice):
def __init__(self, hive_session, hive_device):

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Sep 27, 2019

Member

Remove this.

@KJonline

This comment has been minimized.

Copy link
Contributor Author

commented Sep 27, 2019

Hi @MartinHjelmare, apoligies i am not familiar with using super(). but when i remove the init method from the child classes i get an error advising

  File "/Users/kholejones/Git/home-assistant/homeassistant/components/hive/sensor.py", line 31, in <module>
    class HiveSensorEntity(HiveEntity, Entity):
  File "/Users/kholejones/Git/home-assistant/homeassistant/components/hive/sensor.py", line 34, in HiveSensorEntity
    super().__init__(hive_session, hive_device)
RuntimeError: super(): no arguments`

I have updated the classes to be the below but keep getting the above error.

class HiveSensorEntity(HiveEntity, Entity):

    super().__init__(hive_session, hive_device)

    @property
    def unique_id(self):
        """Return unique ID of entity."""
        return self._unique_id`
@MartinHjelmare

This comment has been minimized.

Copy link
Member

commented Sep 27, 2019

Remove the whole init method including the call to super().

@KJonline

This comment has been minimized.

Copy link
Contributor Author

commented Sep 27, 2019

Hi @MartinHjelmare, that’s seems to have passed all the checks now. I just wanted to say thanks for all your help with this. I started learning python with this component and this had been a massive learning curve. Thanks for your patience with me/this and there is still a lot for me to learn but I am looking forward to it.

Dev automation moved this from Review in progress to Reviewer approved Sep 27, 2019
Copy link
Member

left a comment

Great!

@MartinHjelmare MartinHjelmare merged commit fc3f516 into home-assistant:dev Sep 27, 2019
11 checks passed
11 checks passed
CI Build #20190927.49 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch Coverage not affected when comparing c194f4a...1ed828e
Details
codecov/project 94.19% (target 90%)
Details
Dev automation moved this from Reviewer approved to Done Sep 27, 2019

_LOGGER = logging.getLogger(__name__)

DOMAIN = "hive"
DATA_HIVE = "data_hive"
SERVICES = ["Heating", "HotWater"]
SERVICE_BOOST_HOTWATER = "boost_hotwater"

This comment has been minimized.

Copy link
@frenck

frenck Sep 28, 2019

Member

Noticed during the review of the documentation: hotwater is not one word. So I expected it to be hot_water ?

@KJonline KJonline referenced this pull request Sep 28, 2019
2 of 2 tasks complete
@lock lock bot locked and limited conversation to collaborators Sep 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
5 participants
You can’t perform that action at this time.