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 weather platform to template domain #45031

Merged
merged 5 commits into from
Feb 22, 2021

Conversation

dgomes
Copy link
Contributor

@dgomes dgomes commented Jan 11, 2021

Proposed change

Template domain has many platforms, but not weather until now.
The use case is simple: you have separate sensors for temperature/humidity/etc and you want to combine them into a single entity. To top this use case, you can incorporate the forecast from a nearby location provided by another weather integration.

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

Example entry for configuration.yaml:

# Example configuration.yaml

weather:
  - platform: template
    name: teste
    condition_template: "sunny"
    temperature_template: "{{ states('sensor.temperature') | float}}"
    humidity_template: "{{ states('sensor.humidity')| float }}"

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
  • 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

To help with the load of incoming pull requests:

Copy link
Contributor

@MatthewFlamm MatthewFlamm left a comment

Choose a reason for hiding this comment

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

Also according to the dev docs, the condition and temperature forecasts are required. One really nice use case for this template is to use the forecasts and current condition from an existing weather integration and the current temperature from a local temperature sensor.

homeassistant/components/template/weather.py Show resolved Hide resolved
homeassistant/components/template/weather.py Show resolved Hide resolved
@dgomes
Copy link
Contributor Author

dgomes commented Jan 12, 2021

Thank you for the feedback! I've update the PR description :)

@MatthewFlamm
Copy link
Contributor

Since I commented here, I found out that the underlying weather entity requires the integration to implement the humidity method in contrast to the developer documentation. It is now unclear what is the expectation. Thanks for linking this PR to the issue.

@github-actions
Copy link

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@github-actions github-actions bot added the stale label Feb 12, 2021
@dgomes dgomes removed the stale label Feb 12, 2021
@gsdevme
Copy link

gsdevme commented Feb 15, 2021

This looks handy for anyone wanting to bring in MQTT sensors and populate the weather domain to use the lovelace card also as I noticed there isnt a MQTT Weather component yet.

@bdraco
Copy link
Member

bdraco commented Feb 21, 2021

Coverage looks good
homeassistant/components/template/weather.py 91 0 100%

dgomes and others added 2 commits February 21, 2021 17:48
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: J. Nick Koston <nick@koston.org>
Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

LGTM, just needs docs.

Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@bdraco bdraco merged commit 0e44d61 into home-assistant:dev Feb 22, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Feb 23, 2021
@dgomes dgomes deleted the weather_template branch April 7, 2022 18:11
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

5 participants