* Added some extra attributes Added the extra attributes wind_gust_speed and thunder_probability that were already implemented in the underlaying library (joysoftware / pypi_smhi). Also for the existing extra attribute cloudiness, it is added if "is not None" instead of just "if self.cloudiness" which would make it False (and therefore not available) if cloudiness = 0. * Trying to solve the style issues Removed white spaces and changed order of list as suggested by the tests. * New try to solve the style issues Removed some more white spaces... * Changed dictionary handling as suggested Changed dictionary handling as suggested by MartinHjelmare. * Updated test Updated test_weather.py to include the new attributes wind_gust_speed and thunder_probability. * Added missing imports Added the missing imports ATTR_SMHI_THUNDER_PROBABILITY, ATTR_SMHI_WIND_GUST_SPEED, * Renaming self.thunder to self.thunder_probability and correcting test valuesfor Renamed the new internal attribute thunder to thunder_probability, same as the exposed attribute for improved consistency. Corrected test values according to smhi.json. * Forgot to change to self.thunder_probability in one place. sorry.
13 lines
425 B
Python
13 lines
425 B
Python
"""Constants in smhi component."""
|
|
from homeassistant.components.weather import DOMAIN as WEATHER_DOMAIN
|
|
|
|
ATTR_SMHI_CLOUDINESS = "cloudiness"
|
|
ATTR_SMHI_WIND_GUST_SPEED = "wind_gust_speed"
|
|
ATTR_SMHI_THUNDER_PROBABILITY = "thunder_probability"
|
|
|
|
DOMAIN = "smhi"
|
|
|
|
HOME_LOCATION_NAME = "Home"
|
|
|
|
ENTITY_ID_SENSOR_FORMAT = WEATHER_DOMAIN + ".smhi_{}"
|
|
ENTITY_ID_SENSOR_FORMAT_HOME = ENTITY_ID_SENSOR_FORMAT.format(HOME_LOCATION_NAME)
|