-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
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
Buienradar newconditions #8897
Conversation
if self._data and self._data.condition: | ||
return self.hass.data[DATA_CONDITION][ | ||
self._data.condition[CONDCODE]] | ||
return STATE_UNKNOWN |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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....
* new monitored conditions and support for new weathercard * new monitored conditions and support for new weathercard * minor changes
* update buienradar sensor docs Update documentation for home-assistant/core#8897 * Update sensor.buienradar.markdown
Description:
1: Support for new weather card: including min temperature and condition
(or the proposed new weather card: home-assistant/frontend#375):
2: Add full/detailed current condition into buienradar sensor (can be used in automations for example):
3: New monitored conditions for buienradar sensor for forecasted data (1..5 days ahead):
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:Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
tox
run successfully. Your PR cannot be merged unless tests passREQUIREMENTS
variable ([example][ex-requir]).requirements_all.txt
by runningscript/gen_requirements_all.py
.