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 service to set the AC schedule of renault vehicles #125006

Merged

Conversation

vhkristof
Copy link
Contributor

@vhkristof vhkristof commented Sep 1, 2024

Breaking change

Proposed change

This PR adds the functionality to set the AC schedule of renault vehicles.

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)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

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
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format 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.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented Sep 1, 2024

Hey there @epenet, mind taking a look at this pull request as it has been labeled with an integration (renault) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of renault can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign renault Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@vhkristof
Copy link
Contributor Author

vhkristof commented Sep 1, 2024

Should I create the PR for the documentation update to the 'current' or 'next' branch ? Made it for 'next', hope it is correct

Comment on lines 274 to 275
mock_call_data: list[ChargeSchedule] = mock_action.mock_calls[0][1][0]
assert mock_action.mock_calls[0][1] == (mock_call_data,)
Copy link
Contributor

@epenet epenet Sep 2, 2024

Choose a reason for hiding this comment

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

I think this is wrong (it might be wrong above too) as it's not really testing the values passed.
It's just testing that A == A, when it should be testing that A == expected

Could we use a snapshot assertion here instead?

Suggested change
mock_call_data: list[ChargeSchedule] = mock_action.mock_calls[0][1][0]
assert mock_action.mock_calls[0][1] == (mock_call_data,)
mock_call_data: list[ChargeSchedule] = mock_action.mock_calls[0][1][0]
assert mock_call_data == snapshot

Copy link
Contributor

Choose a reason for hiding this comment

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

Note: I have opened #125064 for the bad existing tests.
You will probable need to rebase once that is merged.

@epenet epenet mentioned this pull request Sep 2, 2024
19 tasks
@epenet
Copy link
Contributor

epenet commented Sep 2, 2024

Should I create the PR for the documentation update to the 'current' or 'next' branch ? Made it for 'next', hope it is correct

Yes, it must be next. It won't be included in 2024.9, but we should be able to get it into 2024.10

Copy link
Contributor

@epenet epenet left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@@ -174,7 +174,7 @@
},
"ac_cancel": {
"name": "Cancel A/C",
"description": "Canceles A/C on vehicle.",
"description": "Cancels A/C on vehicle.",
Copy link
Contributor

Choose a reason for hiding this comment

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

This could have been a separate bugfix PR 😉 but I think it's ok to leave it in here.

Comment on lines 37 to 62
schedules:
example: >-
[
{
"id": 1,
"activated": false
},
{
"id": 2,
"activated": true,
"monday": { "readyAtTime": "T20:45Z" },
"sunday": { "readyAtTime": "T20:45Z" }
},
{
"id": 3,
"activated": false
},
{
"id": 4,
"activated": false
},
{
"id": 5,
"activated": false
}
]
Copy link
Member

Choose a reason for hiding this comment

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

We should not create services that require the user to put in JSON objects. This is too error prone imo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed both examples in the file. Also updated the documentation.

@home-assistant home-assistant bot marked this pull request as draft September 3, 2024 13:52
@home-assistant
Copy link

home-assistant bot commented Sep 3, 2024

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@vhkristof vhkristof marked this pull request as ready for review September 8, 2024 12:20
@vhkristof
Copy link
Contributor Author

@joostlek Can you please review ?

@joostlek joostlek merged commit 1f1ce67 into home-assistant:dev Sep 20, 2024
28 of 29 checks passed
@vhkristof vhkristof deleted the renault-add-service-to-set-ac-schedule branch September 20, 2024 09:51
sarog pushed a commit to sarog/hass-core that referenced this pull request Sep 20, 2024
…t#125006)

* Add service to set the AC schedule of renault vehicles

* Remove executable permission

* Applied review comments (use snapshot)

* Rewrote examples to not use JSON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants