Fix BOM weather '-' value#14042
Conversation
|
|
||
| self.assertEqual('Fine', self.hass.states.get(f'sensor.bom_fake_weather').state) | ||
| self.assertEqual('1021.7', self.hass.states.get(f'sensor.bom_fake_pressure_mb').state) | ||
| self.assertEqual('25.0', self.hass.states.get(f'sensor.bom_fake_feels_like_c').state) |
There was a problem hiding this comment.
line too long (93 > 79 characters)
| self.hass, sensor.DOMAIN, {'sensor': VALID_CONFIG})) | ||
|
|
||
| self.assertEqual('Fine', self.hass.states.get(f'sensor.bom_fake_weather').state) | ||
| self.assertEqual('1021.7', self.hass.states.get(f'sensor.bom_fake_pressure_mb').state) |
There was a problem hiding this comment.
line too long (94 > 79 characters)
| self.assertTrue(setup_component( | ||
| self.hass, sensor.DOMAIN, {'sensor': VALID_CONFIG})) | ||
|
|
||
| self.assertEqual('Fine', self.hass.states.get(f'sensor.bom_fake_weather').state) |
There was a problem hiding this comment.
line too long (88 > 79 characters)
| self.assertTrue(setup_component(self.hass, sensor.DOMAIN, { | ||
| 'sensor': VALID_CONFIG})) | ||
|
|
||
| fake_entities = ['bom_fake_feels_like_c', 'bom_fake_pressure_mb', 'bom_fake_weather'] |
There was a problem hiding this comment.
line too long (93 > 79 characters)
| from homeassistant.setup import setup_component | ||
| from homeassistant.components import sensor | ||
|
|
||
| from tests.common import (get_test_home_assistant, assert_setup_component, load_fixture) |
There was a problem hiding this comment.
line too long (88 > 79 characters)
| item_filter = lambda x: True | ||
| if condition in ['weather', 'sea_state']: | ||
| # Take the first non '-' reading. | ||
| item_filter = lambda x: x is not None and x != '-' |
There was a problem hiding this comment.
do not assign a lambda expression, use a def
| Iterators are used in this method to avoid iterating needlessly | ||
| iterating through the entire BOM provided dataset | ||
| """ | ||
| item_filter = lambda x: True |
There was a problem hiding this comment.
do not assign a lambda expression, use a def
| @property | ||
| def latest_data(self): | ||
| """Return the latest data object""" | ||
| if self._data and len(self._data) > 0: |
There was a problem hiding this comment.
The second condition len(self._data) is unnecessary here, because if self._data already checks for a "truthy" value. If self._data is None or is an empty list, then if self._data will already evaluate to False.
| if self.rest.data and self._condition in self.rest.data: | ||
| return self.rest.data[self._condition] | ||
| reading = self.rest.get_reading(self._condition) | ||
| if reading is not None and reading != '-': |
There was a problem hiding this comment.
- I think the latter condition here
reading != '-'is unnecessary becauseget_readingalready checks for'-'values for the weather condition. I would suggest removing it here to avoid having the same logic in multiple places which could eventually lead to bugs. - You can just
return readinghere without the None check. When entity.state returnsNoneit is automatically converted to anunknownstate. In fact, it's even recommended to indicate an unknown state with aNonevalue and returningSTATE_UNKNOWNis not recommended.
There was a problem hiding this comment.
get_reading already checks for '-' values for the weather condition.
Yep, for the weather condition, but it also exists for other conditions like cloud_type , which sometimes will sometimes be - because there are no clouds (so using a historical value isn't right) (and Unknown should be the value shown in the frontend)
See: http://www.bom.gov.au/fwo/IDN60901/IDN60901.94767.json
Do you think this case should also be handled in BOMCurrentData.get_reading (i.e. BOMCurrentData will do the conversion of '-' to None?
As an aside, I will update the STATE_UNKNOWN to return None instead.
There was a problem hiding this comment.
Yes then I would move that logic into get_reading.
| return True | ||
|
|
||
| condition_readings = (entry[condition] for entry in self._data) | ||
| latest_reading = next((x for x in condition_readings if item_filter(x)), None) |
There was a problem hiding this comment.
line too long (86 > 79 characters)
|
Shouldn't we just delay our scan interval so that there is always a reading? |
I don't think that's an ideal solution. The time frame between each "real" reading is about 3 hours, so 3 hour old weather data isn't very useful for the other conditions. Also, whilst it appears BOM give data every 3 hours between |
|
But we can be a bit smarter though? The moment we get a proper reading we will not do another update for 3 hours? |
Yes we could do that, but: 1. What if BOM changes the update interval?Yes, it's unlikely, so probably not a huge issue, but say they take 3 hours and 15 minutes to provide new data, what happens at the refresh we do at the 3 hour mark when there still is no valid data? Do we wait for another 3 hours and expect valid data to come in? What if it never comes in? Do we revert to checking at a higher frequency? It seems like there would be a few edge cases around timing that would need to be handled (and IMO quite complex to deal with) 2. What about other conditions like current temperature?If we want to keep updating these at a higher frequency, (which we would, since BOM provide higher frequency measurements for these properties), then we need to consider the |
|
Hey @balloob @OttoWinter any update on this? |
OttoWinter
left a comment
There was a problem hiding this comment.
As one API call updates several conditions and some condition have a higher update frequency, I agree we shouldn't set the global update interval to 3 hours.
| @@ -202,13 +234,13 @@ def update(self): | |||
|
|
|||
There was a problem hiding this comment.
Not really part of this PR, but in the if statement above we check if the last update was within 35 minutes.
Can't we just set MIN_TIME_BETWEEN_UPDATES to 35 minutes? The Throttle should take care of it. I'm a bit confused.
There was a problem hiding this comment.
Sounds good to me I'll raise another PR
| latest_reading = next( | ||
| (x for x in condition_readings if should_include_value(x)), None) | ||
| if latest_reading == '-': | ||
| # Show a unknown state if a '-' value is encountered. |
There was a problem hiding this comment.
It's weird that - values in the state are handled differently for weather conditions than for other conditions. Shouldn't we just always take the first non - value?
Like this:
condition_readings = (entry[condition] for entry in self._data)
return next((x for x in condition_readings if x != '-'), None)There was a problem hiding this comment.
I think we can. I was under the impression that weather was some special case, but it looks like I can't see why this would negatively impact other conditions, like cloud.
I had a look through the data paying attentions to cloud and weather to see if we could take this approach, and it looks like it'd be fine to do.
Also, it seems my previous assumption about weather being updated only every 3 hours is incorrect - there are some extra readings in there where it looks like the condition changed prematurely, so this is good reason to forego the update interval change.
{"local_date_time":"02/07:00am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"02/06:30am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"02/06:00am","weather":"Fine","cloud":"Mostly cloudy","cloud_base_m":2500,"cloud_oktas":7,"cloud_type_id":30,"cloud_type":"-"}
{"local_date_time":"02/05:30am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"02/05:00am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"02/04:30am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"02/04:00am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"02/03:30am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"02/03:00am","weather":"Fine","cloud":"Mostly cloudy","cloud_base_m":2500,"cloud_oktas":6,"cloud_type_id":30,"cloud_type":"-"}
{"local_date_time":"02/02:30am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"02/02:00am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"02/01:30am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"02/01:00am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"02/12:30am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"02/12:00am","weather":"Fine","cloud":"Mostly cloudy","cloud_base_m":2500,"cloud_oktas":7,"cloud_type_id":30,"cloud_type":"-"}
{"local_date_time":"01/11:30pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/11:00pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/10:30pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/10:00pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/09:30pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/09:00pm","weather":"Fine","cloud":"Partly cloudy","cloud_base_m":2500,"cloud_oktas":4,"cloud_type_id":30,"cloud_type":"-"}
{"local_date_time":"01/08:30pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/08:00pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/07:30pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/07:00pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/06:30pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/06:00pm","weather":"Fine","cloud":"Mostly clear","cloud_base_m":2500,"cloud_oktas":1,"cloud_type_id":30,"cloud_type":"-"}
{"local_date_time":"01/05:30pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/05:00pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/04:30pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/04:00pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/03:30pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/03:00pm","weather":"Fine","cloud":"Mostly clear","cloud_base_m":2500,"cloud_oktas":1,"cloud_type_id":30,"cloud_type":"-"}
{"local_date_time":"01/02:30pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/02:00pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/01:30pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/01:00pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/12:30pm","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/12:00pm","weather":"Fine","cloud":"Mostly clear","cloud_base_m":2500,"cloud_oktas":1,"cloud_type_id":30,"cloud_type":"-"}
{"local_date_time":"01/11:30am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/11:00am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/10:30am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/10:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":1020,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"01/09:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":960,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"01/09:00am","weather":"Fine","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":2,"cloud_type_id":31,"cloud_type":"-"}
{"local_date_time":"01/08:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"01/08:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":720,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"01/07:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":660,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"01/07:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":660,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"01/06:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":660,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"01/06:00am","weather":"Fine","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":31,"cloud_type":"-"}
{"local_date_time":"01/05:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"01/05:00am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/04:30am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/04:00am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/03:30am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/03:00am","weather":"Fine","cloud":"Clear","cloud_base_m":2500,"cloud_oktas":0,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/02:30am","weather":"-","cloud":"-","cloud_base_m":null,"cloud_oktas":null,"cloud_type_id":null,"cloud_type":"-"}
{"local_date_time":"01/02:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"01/01:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"01/01:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"01/12:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"01/12:00am","weather":"Fine","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":31,"cloud_type":"-"}
{"local_date_time":"30/11:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/11:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/10:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/10:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/09:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/09:00pm","weather":"Fine","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":31,"cloud_type":"-"}
{"local_date_time":"30/08:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/08:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/07:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":540,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/07:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":540,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/06:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":540,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/06:00pm","weather":"Distant precip.","cloud":"Mostly clear","cloud_base_m":300,"cloud_oktas":1,"cloud_type_id":38,"cloud_type":"-"}
{"local_date_time":"30/05:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":540,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/05:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":540,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/04:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":540,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/04:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":2,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/03:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":540,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/03:00pm","weather":"Distant precip.","cloud":"Partly cloudy","cloud_base_m":600,"cloud_oktas":5,"cloud_type_id":38,"cloud_type":"-"}
{"local_date_time":"30/02:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/02:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/01:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":660,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/01:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":660,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/12:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":660,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/12:00pm","weather":"Distant precip.","cloud":"Partly cloudy","cloud_base_m":600,"cloud_oktas":5,"cloud_type_id":38,"cloud_type":"-"}
{"local_date_time":"30/11:30am","weather":"-","cloud":"Partly cloudy","cloud_base_m":810,"cloud_oktas":3,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/11:00am","weather":"-","cloud":"Partly cloudy","cloud_base_m":810,"cloud_oktas":3,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/10:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":2,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/10:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":450,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/09:30am","weather":"-","cloud":"Partly cloudy","cloud_base_m":810,"cloud_oktas":3,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/09:00am","weather":"Distant precip.","cloud":"Partly cloudy","cloud_base_m":600,"cloud_oktas":4,"cloud_type_id":38,"cloud_type":"-"}
{"local_date_time":"30/08:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":450,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/08:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":450,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/07:30am","weather":"Showers","cloud":"Mostly clear","cloud_base_m":450,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/07:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":540,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/06:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":540,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/06:00am","weather":"Distant precip.","cloud":"Partly cloudy","cloud_base_m":300,"cloud_oktas":3,"cloud_type_id":38,"cloud_type":"-"}
{"local_date_time":"30/05:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":540,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/05:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":540,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/04:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/04:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":360,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/03:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":720,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/03:00am","weather":"Recent precip.","cloud":"Partly cloudy","cloud_base_m":300,"cloud_oktas":5,"cloud_type_id":38,"cloud_type":"-"}
{"local_date_time":"30/02:30am","weather":"Showers","cloud":"Mostly clear","cloud_base_m":360,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/02:20am","weather":"Showers","cloud":"Mostly clear","cloud_base_m":360,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/02:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":360,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/01:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":840,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/01:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":450,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"30/12:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":840,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"30/12:00am","weather":"Recent precip.","cloud":"Mostly cloudy","cloud_base_m":600,"cloud_oktas":7,"cloud_type_id":38,"cloud_type":"-"}
{"local_date_time":"29/11:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/11:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":840,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/10:30pm","weather":"Thunder","cloud":"Mostly clear","cloud_base_m":360,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"29/10:15pm","weather":"Thunderstorm","cloud":"Mostly clear","cloud_base_m":360,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"29/10:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":360,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"29/09:53pm","weather":"Showers","cloud":"Mostly clear","cloud_base_m":450,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"29/09:30pm","weather":"Showers","cloud":"Mostly clear","cloud_base_m":300,"cloud_oktas":2,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"29/09:00pm","weather":"Thunderstorm","cloud":"Mostly cloudy","cloud_base_m":300,"cloud_oktas":7,"cloud_type_id":39,"cloud_type":"-"}
{"local_date_time":"29/08:53pm","weather":"Thunderstorm","cloud":"Mostly clear","cloud_base_m":450,"cloud_oktas":1,"cloud_type_id":7,"cloud_type":"Stratus"}
{"local_date_time":"29/08:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":780,"cloud_oktas":2,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/08:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/07:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/07:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/06:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/06:00pm","weather":"Distant precip.","cloud":"Mostly clear","cloud_base_m":600,"cloud_oktas":2,"cloud_type_id":38,"cloud_type":"-"}
{"local_date_time":"29/05:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/05:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/04:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/04:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/03:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/03:00pm","weather":"Fine","cloud":"Mostly cloudy","cloud_base_m":600,"cloud_oktas":7,"cloud_type_id":38,"cloud_type":"-"}
{"local_date_time":"29/02:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/02:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/01:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/01:00pm","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/12:30pm","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/12:00pm","weather":"Fine","cloud":"Mostly cloudy","cloud_base_m":600,"cloud_oktas":6,"cloud_type_id":38,"cloud_type":"-"}
{"local_date_time":"29/11:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/11:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/10:36am","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/10:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/10:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":900,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/09:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/09:00am","weather":"Fine","cloud":"Partly cloudy","cloud_base_m":600,"cloud_oktas":3,"cloud_type_id":38,"cloud_type":"-"}
{"local_date_time":"29/08:30am","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/08:00am","weather":"-","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
{"local_date_time":"29/07:30am","weather":"Showers","cloud":"Mostly clear","cloud_base_m":750,"cloud_oktas":1,"cloud_type_id":8,"cloud_type":"Cumulus"}
5440b2e to
2f6b1ed
Compare
2f6b1ed to
87fbc7e
Compare
87fbc7e to
cd238bf
Compare
|
Hey @OttoWinter changes are up, and I rebased onto |

Description:
BOM weather only provide forecast data every few updates, so the state usually looks like the following:
With occasional data along the way
This PR uses the historical data to show the last, non
-value for theweathersensor to fix this issue forweatheronly.Example entry for
configuration.yaml(if applicable):Checklist:
tox. Your PR cannot be merged unless tests passIf the code communicates with devices, web services, or third-party tools:
New dependencies have been added to theREQUIREMENTSvariable (example).New dependencies are only imported inside functions that use them (example).New dependencies have been added torequirements_all.txtby runningscript/gen_requirements_all.py.New files were added to.coveragerc.If the code does not interact with devices: