fix(weather): remove duplicate visibility property and update manifest metadata
Remove deprecated `visibility` property in favor of `native_visibility`, move `UnitOfLength` import to module-level, and update manifest.json with correct codeowner, documentation URLs, weather dependency, and bump version to 1.0.1.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"domain": "hass_weather_baidu",
|
||||
"name": "百度天气",
|
||||
"codeowners": ["@your-github-username"],
|
||||
"codeowners": ["@xyzmos"],
|
||||
"config_flow": true,
|
||||
"dependencies": [],
|
||||
"documentation": "https://github.com/your-github-username/hass_weather_baidu",
|
||||
"dependencies": ["weather"],
|
||||
"documentation": "https://github.com/xyzmos/hass_weather_baidu",
|
||||
"iot_class": "cloud_polling",
|
||||
"issue_tracker": "https://github.com/your-github-username/hass_weather_baidu/issues",
|
||||
"issue_tracker": "https://github.com/xyzmos/hass_weather_baidu/issues",
|
||||
"requirements": ["aiohttp>=3.8.0"],
|
||||
"version": "1.0.0"
|
||||
"version": "1.0.1"
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ from homeassistant.components.weather import (
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
UnitOfLength,
|
||||
UnitOfPressure,
|
||||
UnitOfSpeed,
|
||||
UnitOfTemperature,
|
||||
@@ -144,26 +145,17 @@ class BaiduWeatherEntity(CoordinatorEntity[BaiduWeatherCoordinator], WeatherEnti
|
||||
return self._now_data.get("clouds")
|
||||
|
||||
@property
|
||||
def visibility(self) -> float | None:
|
||||
"""Return the visibility in km."""
|
||||
def native_visibility(self) -> float | None:
|
||||
"""Return visibility in km."""
|
||||
vis = self._now_data.get("vis")
|
||||
if vis is None:
|
||||
return None
|
||||
# API returns meters, convert to km
|
||||
return vis / 1000.0
|
||||
|
||||
@property
|
||||
def native_visibility(self) -> float | None:
|
||||
"""Return visibility in km."""
|
||||
vis = self._now_data.get("vis")
|
||||
if vis is None:
|
||||
return None
|
||||
return vis / 1000.0
|
||||
|
||||
@property
|
||||
def native_visibility_unit(self) -> str:
|
||||
"""Return the visibility unit."""
|
||||
from homeassistant.const import UnitOfLength
|
||||
return UnitOfLength.KILOMETERS
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user