Skip to content

Commit

Permalink
Migrate weather entity to native_* (fix #132)
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed Jul 18, 2022
1 parent 5a40d76 commit 77f6fd6
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 23 deletions.
2 changes: 1 addition & 1 deletion custom_components/gismeteo/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# Base component constants
NAME: Final = "Gismeteo"
DOMAIN: Final = "gismeteo"
VERSION: Final = "2.4.0"
VERSION: Final = "2.4.1-alpha"
ATTRIBUTION: Final = "Data provided by Gismeteo"
ISSUE_URL: Final = "https://github.com/Limych/ha-gismeteo/issues"

Expand Down
30 changes: 15 additions & 15 deletions custom_components/gismeteo/manifest.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"domain": "gismeteo",
"name": "Gismeteo",
"version": "2.4.0",
"documentation": "https://github.com/Limych/ha-gismeteo",
"issue_tracker": "https://github.com/Limych/ha-gismeteo/issues",
"dependencies": [
"weather"
],
"config_flow": true,
"codeowners": [
"@Limych"
],
"requirements": [],
"iot_class": "cloud_polling"
}
"domain": "gismeteo",
"name": "Gismeteo",
"version": "2.4.1-alpha",
"documentation": "https://github.com/Limych/ha-gismeteo",
"issue_tracker": "https://github.com/Limych/ha-gismeteo/issues",
"dependencies": [
"weather"
],
"config_flow": true,
"codeowners": [
"@Limych"
],
"requirements": [],
"iot_class": "cloud_polling"
}
22 changes: 17 additions & 5 deletions custom_components/gismeteo/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
CONF_MODE,
CONF_NAME,
CONF_PLATFORM,
PRESSURE_MMHG,
SPEED_KILOMETERS_PER_HOUR,
TEMP_CELSIUS,
)
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -131,19 +133,24 @@ def condition(self):
return self._gismeteo.condition()

@property
def temperature(self):
def native_temperature(self):
"""Return the current temperature."""
return self._gismeteo.temperature()

@property
def temperature_unit(self):
def native_temperature_unit(self):
"""Return the unit of measurement."""
return TEMP_CELSIUS

@property
def pressure(self):
def native_pressure(self):
"""Return the current pressure."""
return self._gismeteo.pressure_hpa()
return self._gismeteo.pressure_mmhg()

@property
def native_pressure_unit(self):
"""Return the unit of measurement."""
return PRESSURE_MMHG

@property
def humidity(self):
Expand All @@ -156,10 +163,15 @@ def wind_bearing(self):
return self._gismeteo.wind_bearing()

@property
def wind_speed(self):
def native_wind_speed(self):
"""Return the current windspeed."""
return self._gismeteo.wind_speed_kmh()

@property
def native_wind_speed_unit(self):
"""Return the native unit of measurement for wind speed."""
return SPEED_KILOMETERS_PER_HOUR

@property
def forecast(self):
"""Return the forecast array."""
Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Gismeteo",
"hacs": "1.6.0",
"homeassistant": "2022.6.0"
"homeassistant": "2022.7.0"
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
homeassistant>=2022.6.0
homeassistant>=2022.7.0

0 comments on commit 77f6fd6

Please sign in to comment.