core icon indicating copy to clipboard operation
core copied to clipboard

Add weather platform to Tessie

Open Bre77 opened this issue 1 year ago • 4 comments

Proposed change

Tessie provides the weather at the vehicles location. This adds the weather platform to expose this data as a weather entity. It requires a seperate Data Coordinator since the weather data requires a different API call, which should be polled much less frequently.

This is probably a little unusual for Home Assistant as it is not the weather of the home.

Type of change

  • [ ] Dependency upgrade
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [ ] New integration (thank you!)
  • [x] 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/30453

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 Ruff (ruff format 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:

  • [ ] 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:

Bre77 avatar Dec 21 '23 05:12 Bre77

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 Dec 22 '23 11:12 home-assistant[bot]

Looks good but I wonder why we're setting up the weather platform instead of just using regular sensors? The main reason for weather would be the forecast services etc. but that's not something we are using here.

I dont understand why I wouldnt put weather data into a weather platform, since the fields match up so perfectly.

Bre77 avatar Dec 22 '23 19:12 Bre77

I dont understand why I wouldnt put weather data into a weather platform, since the fields match up so perfectly.

It's a question as I would assume one would use this likely for their automations/scripts rather than a weather card on a dashboard. Sensors are generally easier to use than attributes of a weather entity and we are also trying to move away from attributes if possible. So how would you use this entity?

gjohansson-ST avatar Dec 22 '23 20:12 gjohansson-ST

I dont understand why I wouldnt put weather data into a weather platform, since the fields match up so perfectly.

It's a question as I would assume one would use this likely for their automations/scripts rather than a weather card on a dashboard. Sensors are generally easier to use than attributes of a weather entity and we are also trying to move away from attributes if possible. So how would you use this entity?

The only usecase I know is to trigger a warning/notification if any cover is open and the weather state is rain. Im sure people could think of others, but I do accept its easier to work with sensors. It just feels odd to put weather data intentionally in a different platform. Regardless its going to require a refactor to move the coordinator, so I'll focus on that first.

Bre77 avatar Dec 22 '23 23:12 Bre77

We should still move this to sensor instead of weather as I notice you're still pushing changes.

gjohansson-ST avatar Dec 29 '23 12:12 gjohansson-ST