From 566f29683513b1a4748d2376726dbe3579d40c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E5=A2=A8?= Date: Thu, 12 Feb 2026 15:59:38 +0800 Subject: [PATCH] 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. --- custom_components/hass_weather_baidu/manifest.json | 10 +++++----- custom_components/hass_weather_baidu/weather.py | 14 +++----------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/custom_components/hass_weather_baidu/manifest.json b/custom_components/hass_weather_baidu/manifest.json index dd6df12..95716be 100644 --- a/custom_components/hass_weather_baidu/manifest.json +++ b/custom_components/hass_weather_baidu/manifest.json @@ -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" } diff --git a/custom_components/hass_weather_baidu/weather.py b/custom_components/hass_weather_baidu/weather.py index c5eaa71..bbc0264 100644 --- a/custom_components/hass_weather_baidu/weather.py +++ b/custom_components/hass_weather_baidu/weather.py @@ -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