Skip to content

Add Rachio Flex Schedules#33533

Merged
bdraco merged 4 commits intohome-assistant:devfrom
brg468:dev
Apr 2, 2020
Merged

Add Rachio Flex Schedules#33533
bdraco merged 4 commits intohome-assistant:devfrom
brg468:dev

Conversation

@brg468
Copy link
Copy Markdown
Contributor

@brg468 brg468 commented Apr 2, 2020

Proposed change

Add Rachio Flex Schedules as switches.

Follow-up to #33421

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

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.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@probot-home-assistant
Copy link
Copy Markdown

Hey there @bdraco, mind taking a look at this pull request as its been labeled with a integration (rachio) you are listed as a codeowner for? Thanks!

Comment thread homeassistant/components/rachio/switch.py Outdated
@bdraco
Copy link
Copy Markdown
Member

bdraco commented Apr 2, 2020

Looks good, I'll have some time to test tonight

Comment thread homeassistant/components/rachio/switch.py Outdated
@bdraco
Copy link
Copy Markdown
Member

bdraco commented Apr 2, 2020

Just tested, flex schedules are not showing up.

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Apr 2, 2020

{
	"flexScheduleRules": [{
		"id": "<snip>",
		"cycleSoak": false,
		"startDay": 30,
		"name": "Main",
		"totalDuration": 20161,
		"operator": "AFTER",
		"startYear": 2019,
		"enabled": true,
		"summary": "As needed end by sunrise",
		"startMonth": 11,
		"externalName": "Main",
		"scheduleJobTypes": ["ANY"],
		"startDate": 1575108000000,
		"type": "FLEX",
		"zones": [{
			"zoneId": "<snip>",
			"sortOrder": 0,
			"duration": 2086
		}, {
			"zoneId": "<snip>",
			"sortOrder": 3,
			"duration": 1390
		}, {
			"zoneId": "<snip>",
			"sortOrder": 4,
			"duration": 2086
		}, {
			"zoneId": "<snip>",
			"sortOrder": 1,
			"duration": 4421
		}, {
			"zoneId": "<snip>",
			"sortOrder": 2,
			"duration": 3920
		}, {
			"zoneId": "<snip>",
			"sortOrder": 5,
			"duration": 2086
		}, {
			"zoneId": "<snip>",
			"sortOrder": 6,
			"duration": 2086
		}, {
			"zoneId": "<snip>",
			"sortOrder": 7,
			"duration": 2086
		}]
	}]
}

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Apr 2, 2020

Just tested, flex schedules are not showing up.

Disregard: I missed the merge conflict so it wasn't up to date. (testing error on my part)

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Apr 2, 2020

Verified ok running from app -> shows in Home Assistant

@brg468
Copy link
Copy Markdown
Contributor Author

brg468 commented Apr 2, 2020

Ha phew! I just built a new schedule to test and it was there so I was about to be real confused.

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Apr 2, 2020

Verified turning off in app shows in Home Assistant

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Apr 2, 2020

Verified on in home assistant show on in app

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Apr 2, 2020

Verified off in home assistant show on in app

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Apr 2, 2020

TEST PASS

@brg468
Copy link
Copy Markdown
Contributor Author

brg468 commented Apr 2, 2020

TEST PASS

👍

@bdraco bdraco merged commit 4caf65d into home-assistant:dev Apr 2, 2020

def _handle_update(self, *args, **kwargs) -> None:
@callback
async def _handle_update(self, *args, **kwargs) -> None:
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare Apr 2, 2020

Choose a reason for hiding this comment

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

A coroutine function can't be a callback.

  • Please remove the async in async def.
  • Rename the function to _async_handle_update.
  • Change self.schedule_update_ha_state to self.async_write_ha_state inside.
  • Do this for all the switch classes and the abstract method.
  • Rename _handle_any_update too, similarly.
  • Decorate all these methods with @callback.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @MartinHjelmare

@brg468 Do you want to do a PR for this?, or I can take care of it needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If you had any other changes you were planning go ahead, if not I can do it in a bit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm working on fixing something in homekit so you'll probably get to it before I do.

@lock lock Bot locked and limited conversation to collaborators Apr 4, 2020
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.

4 participants