Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Make RainMachine async #14879

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

Merged
merged 7 commits into from
Jun 10, 2018
Merged

Conversation

bachya
Copy link
Contributor

@bachya bachya commented Jun 8, 2018

Description:

This PR:

  • Bumps the underlying library (regenmaschine) to 1.0.1.
  • Makes everything async – holy cow, is it fast...
  • Makes adjustments to ensure that the UI updates responsively in all scenarios (program switch updates zone switches, services only trigger updates for the appropriate switch entities, etc.).
  • Makes some style consistency updates

Related issue (if applicable): N/A

Pull request in home-assistant.github.io with documentation (if applicable): N/A

Example entry for configuration.yaml (if applicable):

rainmachine:
  ip_address: 192.168.1.100
  password: password123

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated in home-assistant.github.io

If the code communicates with devices, web services, or third-party tools:
- [ ] New dependencies have been added to the REQUIREMENTS variable (example).
- [ ] New dependencies are only imported inside functions that use them (example).
- [ ] New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
- [ ] New files were added to .coveragerc.

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is Python 3.6 required for the regenmaschine library? Home assistant only requires Python 3.5.3.

async def refresh_sensors(event_time):
"""Refresh RainMachine sensor data."""
_LOGGER.debug('Updating RainMachine sensor data')
await hass.data[DATA_RAINMACHINE].async_update()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rainmachine is directly accessible here so no need to access the dict to get it.

@@ -20,7 +20,10 @@
_LOGGER = logging.getLogger(__name__)


def setup_platform(hass, config, add_devices, discovery_info=None):
async def async_setup_platform(hass,
Copy link
Member

@MartinHjelmare MartinHjelmare Jun 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please break line after the parenthesis instead, and fill out as much as possible of the line. That's more in line with home assistant style.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I found a lot of other style inconsistencies based on your above request, so I went ahead and addressed them.

@bachya
Copy link
Contributor Author

bachya commented Jun 9, 2018

@MartinHjelmare 3.6 was a mistake on my part; changed the library to require 3.5 as the minimum. Thanks for catching!

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@MartinHjelmare MartinHjelmare merged commit 8aca2e8 into home-assistant:dev Jun 10, 2018
@ghost ghost removed the in progress label Jun 10, 2018
@bachya bachya deleted the rainmachine-async branch June 11, 2018 21:59
@balloob balloob mentioned this pull request Jun 22, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Dec 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants