core icon indicating copy to clipboard operation
core copied to clipboard

Add Trello integration

Open ScottG489 opened this issue 2 years ago • 6 comments

Proposed change

Initial integration with Trello. In the interest of keeping this PR as small as possible, scope was limited to allowing you to track the number of cards in the lists on a Trello board. Meaning, an entity represents a list on a given board and it's value is the number of cards in that list. Future plans include services for card creation/update, better auth (I believe OAuth is supported), and shifting it's IoT class to cloud push via webhooks.

I have tested this out personally with two separate Trello accounts, one paid and one free.

We're using the latest version of py-trello for external communication.

Otherwise, I haven't written Python in a while (though I'm a FT SWE), so on top of the usual comments on fixes required for merging, I'm also looking for suggestions on how I can improve so my next PR (or this one) can be even better :)

Type of change

  • [ ] Dependency upgrade
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [x] 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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request: https://github.com/home-assistant/home-assistant.io/pull/27526

Checklist

  • [x] The code change is tested and works locally.
  • [x] Local tests pass. Your PR cannot be merged unless tests pass
  • [x] There is no commented out code in this PR.
  • [x] I have followed the development checklist
  • [x] I have followed the perfect PR recommendations
  • [x] The code has been formatted using Black (black --fast homeassistant tests)
  • [x] 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:

  • [x] The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • [x] New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • [x] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • [x] Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

ScottG489 avatar May 26 '23 04:05 ScottG489

I see we're a little short on coverage. The missing coverage is mostly various one-line filler code or constructors. Is this a hard requirement? Regardless, I'll try to spend some time to look over the tests and get the coverage up.

ScottG489 avatar May 26 '23 12:05 ScottG489

Unfortunately it looks like I might not be able to implement OAuth at all since Trello only supports OAuth 1.0 and I think we only support OAuth 2.0.

Can anyone confirm?

I'm chatting with their support to see if they have any plans to implement OAuth2. They already mentioned they're doing some changes to auth.

ScottG489 avatar Jun 01 '23 04:06 ScottG489

Regarding Trello supporting OAuth2 - support got back to me:

[engineering does] have a project to make the Trello API support OAuth 2.0, it hasn't been scheduled yet, so we can't say for sure how soon that will be. It will happen though — eventually.

So OAuth2 is likely not going to happen with this PR, but as soon as it's available I'll definitely implement it in a follow up PR.

ScottG489 avatar Jun 04 '23 03:06 ScottG489

Before merging dev there was the following failure:

tests/components/recorder/test_purge_v32_schema.py::test_purge_method[False] - assert 8 == 7
 +  where 8 = <bound method Query.count of <sqlalchemy.orm.query.Query object at 0x7fbc34667c50>>()
 +    where <bound method Query.count of <sqlalchemy.orm.query.Query object at 0x7fbc34667c50>> = <sqlalchemy.orm.query.Query object at 0x7fbc34667c50>.count

Doesn't look related to my changes and it passes for me locally.

I took a look at it, but didn't see any recent changes to that test method. I also tried taking a look at recent recorder changes, but I'm afraid I'm not really familiar enough.

ScottG489 avatar Jun 05 '23 14:06 ScottG489

Doesn't look related to my changes and it passes for me locally.

I took a look at it, but didn't see any recent changes to that test method. I also tried taking a look at recent recorder changes, but I'm afraid I'm not really familiar enough.

These sometimes fail, I am also not familiar so unless your tests are failing I wouldn't mind them. (I don't think when editing an integration this would fail, so unless you're actually working on core stuff, don't bother)

joostlek avatar Jun 05 '23 14:06 joostlek

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

Learn more about our pull request process.

home-assistant[bot] avatar Oct 06 '23 16:10 home-assistant[bot]

@ScottG489 If you're done addressing review comments and you want this PR to be reviewed, please click the "Ready for review"-button.

emontnemery avatar Jul 19 '24 07:07 emontnemery

Sorry, it's been a while since I've been able to get back to this, but thanks for taking another look. There are still a few things I need to fix first before it's ready for another review.

ScottG489 avatar Jul 20 '24 14:07 ScottG489