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

Forecast.io: Added minutely, hourly, and daily summary #1943

Merged
merged 2 commits into from
May 3, 2016
Merged

Forecast.io: Added minutely, hourly, and daily summary #1943

merged 2 commits into from
May 3, 2016

Conversation

aceat64
Copy link
Contributor

@aceat64 aceat64 commented Apr 29, 2016

Description:
Additional summary types, shown on Forecast.io as "next hour", "next 24 hours" and "next 7 days".

Related issue (if applicable): #

Example entry for configuration.yaml (if applicable):

sensor:
  platform: forecast
  api_key: YOUR_APP_KEY
  monitored_conditions:
    - minutely_summary
    - hourly_summary
    - daily_summary

Checklist:

If code communicates with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@fabaff
Copy link
Member

fabaff commented Apr 29, 2016

pylint issue: R:191, 0: Too many instance attributes (9/7) (too-many-instance-attributes)

Otherwise work and looks ok for me.

@aceat64
Copy link
Contributor Author

aceat64 commented Apr 29, 2016

I'm not sure how to fix that, I'm still pretty new to python. My guess is I need to put everything in self.data instead of adding "self.data_minutely", "self.data_hourly", and "self.data_daily".

@fabaff
Copy link
Member

fabaff commented Apr 29, 2016

You could add # pylint: disable=... before the part which causes the error. If there are reasons to do.

Perhaps it's worth to think to only work with self.data = forecast and access/split the information (currently, minutely,hourly,daily) in the update part.

Can you remove the unused import? Seems to be a left-over from the past.

@aceat64
Copy link
Contributor Author

aceat64 commented Apr 29, 2016

I think that import needs to be there, otherwise I get the following:

E:185,15: Undefined variable 'forecastio' (undefined-variable)

@fabaff
Copy link
Member

fabaff commented Apr 29, 2016

Sorry, my bad...the import is needed for catching the exception.

@@ -134,11 +137,20 @@ def update(self):
import forecastio

self.forecast_client.update()
data = self.forecast_client.data
data = self.forecast_client.data.currently()
data_minutely = self.forecast_client.data.minutely()
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't fetch this data unless we need it.

Copy link
Member

Choose a reason for hiding this comment

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

Or does it work just like currently and does it not cause an extra request to the server ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to the python-forecastio docs when we call forecastio.load_forecast() we get all the data, so it shouldn't be any extra requests.

@balloob
Copy link
Member

balloob commented May 3, 2016

Looks good! 🐬

@balloob balloob merged commit a6a5e4f into home-assistant:dev May 3, 2016
@aceat64 aceat64 deleted the forecast-additional-summaries branch May 3, 2016 04:57
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants