8000 Buienradar newconditions by mjj4791 · Pull Request #8897 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Buienradar newconditions #8897

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

Merged
merged 3 commits into from
Aug 16, 2017
Merged

Buienradar newconditions #8897

merged 3 commits into from
Aug 16, 2017

Conversation

mjj4791
Copy link
Contributor
@mjj4791 mjj4791 commented Aug 8, 2017

Description:

1: Support for new weather card: including min temperature and condition
(or the proposed new weather card: home-assistant/frontend#375):

  • add minimum temperature into forecast
  • add condition into forecast data

2: Add full/detailed current condition into buienradar sensor (can be used in automations for example):

  • condition: weather condition (clear, cloudy, fog, rainy, snowy, lightning)
  • condition code: unique condition code (a..z)
  • detailed condition (clear, partlycloudy, cloudy, partlycloudy-fog, partlycloudy-light-rain, partlycloudy-rain, light-rain, rainy, snowy-rainy, partlycloudy-light-snow, partlycloudy-snow, light-snow, snowy, partlycloudy-lightning, lightning)
  • exact condition in Dutch (as reported by buienradar)
  • exact condition in English (translated)

3: New monitored conditions for buienradar sensor for forecasted data (1..5 days ahead):

  • temperature_d: expected temperature
  • mintemp_d: expected lowest temperature
  • rain_d: expected rainfall in mm
  • snow_d: expected snowfall in cm
  • rainchance_d: chance for rain (%)
  • sunchance_d: chance for sun (%)
  • windforce_d: expected windforce (Bft)
  • condition: expected condition (see condition above)
    • condition_d
    • conditioncode__d
    • conditiondetailed_d
    • conditionexact_d
    • symbol_d

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#3154

Example entry for configuration.yaml with the new monitored conditions configured:

# Weather prediction
sensor:
  - platform: buienradar
    name: buienradar
    monitored_conditions:
      # current condition:
      - condition
      - conditioncode
      - conditiondetailed
      - conditionexact
      - symbol
      # conditions for forecasted data:
      - temperature_1d
      - temperature_2d
      - temperature_3d
      - temperature_4d
      - temperature_5d
      - mintemp_1d
      - mintemp_2d
      - mintemp_3d
      - mintemp_4d
      - mintemp_5d
      - rain_1d
      - rain_2d
      - rain_3d
      - rain_4d
      - rain_5d
      - snow_1d
      - snow_2d
      - snow_3d
      - snow_4d
      - snow_5d
      - rainchance_1d
      - rainchance_2d
      - rainchance_3d
      - rainchance_4d
      - rainchance_5d
      - sunchance_1d
      - sunchance_2d
      - sunchance_3d
      - sunchance_4d
      - sunchance_5d
      - windforce_1d
      - windforce_2d
      - windforce_3d
      - windforce_4d
      - windforce_5d
      - condition_1d
      - condition_2d
      - condition_3d
      - condition_4d
      - condition_5d
      - conditioncode_1d
      - conditioncode_2d
      - conditioncode_3d
      - conditioncode_4d
      - conditioncode_5d
      - conditiondetailed_1d
      - conditiondetailed_2d
      - conditiondetailed_3d
      - conditiondetailed_4d
      - conditiondetailed_5d
      - conditionexact_1d
      - conditionexact_2d
      - conditionexact_3d
      - conditionexact_4d
      - conditionexact_5d
      - symbol_1d
      - symbol_2d
      - symbol_3d
      - symbol_4d
      - symbol_5d

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

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

@mention-bot
Copy link

@mjj4791, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fabaff, @balloob and @rmkraus to be potential reviewers.

if self._data and self._data.condition:
return self.hass.data[DATA_CONDITION][
self._data.condition[CONDCODE]]
return STATE_UNKNOWN
Copy link
Member

Choose a reason for hiding this comment

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

Don't return STATE_UNKNOWN, return None instead.


_LOGGER = logging.getLogger(__name__)

DATA_CONDITION = 'br_condition'
Copy link
Member

Choose a reason for hiding this comment

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

Please include full platform name instead of "br"

return self.hass.data[DATA_CONDITION][
self._data.condition[CONDCODE]]
return STATE_UNKNOWN
except (ValueError, IndexError):
Copy link
Member

Choose a reason for hiding this comment

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

DATA_CONDITION is a dictionary. Dictionaries raise KeyError if the key doesn't exist.

I don't see any way a ValueError could be raised.

Instead, just use .get(key) on a dictionary, instead of raising it will return None, which is what this property is supposed to do when it has no condition data.

@@ -38,6 +40,10 @@
# Key: ['label', unit, icon]
SENSOR_TYPES = {
Copy link
Member

Choose a reason for hiding this comment

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

I think that we should just kill this sensor and have people use the weather platform instead. If people want to get that data they could always decide to use a template sensor to extract it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That will requires quite a bit of work; all functionality should be moved over to the weather component (and all current/future values must be exposed by the weather component)....
Next to that, templating the weather component is not as user-friendly as configuring a sensor....

@balloob balloob merged commit e7ce110 into home-assistant:dev Aug 16, 2017
dethpickle pushed a commit to dethpickle/home-assistant that referenced this pull request Aug 18, 2017
* new monitored conditions and support for new weathercard

* new monitored conditions and support for new weathercard

* minor changes
fabaff pushed a commit to home-assistant/home-assistant.io that referenced this pull request Aug 21, 2017
* update buienradar sensor docs

Update documentation for home-assistant/core#8897

* Update sensor.buienradar.markdown
@balloob balloob mentioned this pull request Aug 25, 2017
@home-assistant home-assistant lo 7E72 cked and limited conversation to collaborators Dec 11, 2017
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.

5 participants
0