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 light platform to Linear garage door #111426

Merged
merged 14 commits into from
May 15, 2024

Conversation

IceBotYT
Copy link
Contributor

@IceBotYT IceBotYT commented Feb 25, 2024

Proposed change

Adds the light platform to Linear.
These are not separate lights, but only lights that are inside of garage door openers.

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.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@IceBotYT IceBotYT force-pushed the linear-light-platform branch 2 times, most recently from fa96b4d to 80a8690 Compare March 6, 2024 21:42
@IceBotYT IceBotYT force-pushed the linear-light-platform branch 3 times, most recently from 3aebdb3 to 1351464 Compare April 23, 2024 20:23
homeassistant/components/linear_garage_door/light.py Outdated Show resolved Hide resolved
homeassistant/components/linear_garage_door/light.py Outdated Show resolved Hide resolved
homeassistant/components/linear_garage_door/light.py Outdated Show resolved Hide resolved
tests/components/linear_garage_door/test_light.py Outdated Show resolved Hide resolved
tests/components/linear_garage_door/test_light.py Outdated Show resolved Hide resolved
Comment on lines 64 to 105
patch(
"homeassistant.components.linear_garage_door.light.Linear.login",
return_value=True,
),
patch(
"homeassistant.components.linear_garage_door.light.Linear.get_devices",
return_value=[
{
"id": "test1",
"name": "Test Garage 1",
"subdevices": ["GDO", "Light"],
},
{
"id": "test2",
"name": "Test Garage 2",
"subdevices": ["GDO", "Light"],
},
],
),
patch(
"homeassistant.components.linear_garage_door.light.Linear.get_device_state",
side_effect=lambda id: {
"test1": {
"GDO": {"Open_B": "true", "Open_P": "100"},
"Light": {"On_B": "true", "On_P": "100"},
},
"test2": {
"GDO": {"Open_B": "false", "Open_P": "0"},
"Light": {"On_B": "true", "On_P": "100"},
},
"test3": {
"GDO": {"Open_B": "false", "Opening_P": "0"},
"Light": {"On_B": "false", "On_P": "0"},
},
"test4": {
"GDO": {"Open_B": "true", "Opening_P": "100"},
"Light": {"On_B": "true", "On_P": "100"},
},
}[id],
),
patch(
"homeassistant.components.linear_garage_door.light.Linear.close",
return_value=True,
),
Copy link
Member

Choose a reason for hiding this comment

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

Consider creating a broader patch, checkout analytics_insights or Epion

Copy link
Contributor Author

@IceBotYT IceBotYT Apr 24, 2024

Choose a reason for hiding this comment

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

Take a look at what I did with the patches, is that enough?

Edit: Just realized this makes the tests fail, reverting

@home-assistant
Copy link

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.

@home-assistant home-assistant bot marked this pull request as draft April 23, 2024 20:33
@joostlek
Copy link
Member

I do like the base entity, so if you can maybe open a separate PR to do that before we merge this PR, that'd be nice :)

@IceBotYT
Copy link
Contributor Author

Done #116133

@IceBotYT IceBotYT marked this pull request as ready for review April 27, 2024 23:32
@home-assistant home-assistant bot requested a review from joostlek April 27, 2024 23:32
@emontnemery emontnemery changed the title Add light platform to Linear Add light platform to Linear garage door May 14, 2024
@home-assistant home-assistant bot marked this pull request as draft May 14, 2024 17:53
@IceBotYT IceBotYT marked this pull request as ready for review May 14, 2024 23:35
@home-assistant home-assistant bot marked this pull request as draft May 15, 2024 05:53
@IceBotYT IceBotYT marked this pull request as ready for review May 15, 2024 19:24
@home-assistant home-assistant bot requested a review from joostlek May 15, 2024 19:24
@joostlek joostlek dismissed emontnemery’s stale review May 15, 2024 19:43

Changes implemented

@joostlek joostlek merged commit ebb02a7 into home-assistant:dev May 15, 2024
20 checks passed
@IceBotYT IceBotYT deleted the linear-light-platform branch May 15, 2024 21:19
aschmere pushed a commit to aschmere/hacore2 that referenced this pull request May 16, 2024
* Add light platform

* Fix light test

* Suggestions by CFenner

* Fix tests

* More fixes

* Revert test changes

* Undo base entity

* Rebase

* Fix to use base entity

* Fix name

* More fixes

* Fix tests

* Add translation key

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
@github-actions github-actions bot locked and limited conversation to collaborators May 16, 2024
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.

None yet

4 participants