Git Product home page Git Product logo

heweather's Introduction

和风天气 homeassistant插件

我使用的插件最早引用自瀚思彼岸智能家居技术论坛 Golden_Soap大佬的插件,但该插件很久没有更新过配置,导致我的环境一直无法运行,自己肝的原因主要是懒得改之前的参数配置,换插件全得改一遍,有的数据还没了,又正好借着这个机会能再学习下插件的逻辑,哈哈哈。

如果觉得对你有帮助,就来b站支持一波吧:小愚

使用说明:

1.使用和风官方apiv7版本

2.必须申请开发者账号里的免费api,请务必升级到开发者账号(免费,但要提交身份证审核,api权限会比普通用户高一些)https://console.qweather.com/#/console

3.appkey申请需要先创建应用,后选添加数据key,选wabapi即可

国内的城市区域location关系:https://github.com/qwd/LocationList/blob/master/China-City-List-latest.csv

4.新版本整合优化了sensor以及相关中文名字,图标。将原有的24小时天天气预报从sensor中转移到weather里

配置方法

1.天气预报,默认支持7天和24小时预报,放在weather里,

weather:
  - platform: heweather
    location: 101210106    # 填写你所在区域代码Location_ID,https://github.com/qwd/LocationList/blob/master/China-City-List-latest.csv
    key: ABCDE             # api平台申请的key

2.天气情况、空气质量、自然灾害预警、各种生活指数,放在sensor里

sensor:
  - platform: heweather
    location: 101210106     # 填写你所在区域代码Location_ID,https://github.com/qwd/LocationList/blob/master/China-City-List-latest.csv
    key: ABCDE              # api平台申请的key
    disasterlevel: 3
    disastermsg: allmsg

两个参数:

disasterlevel的数字表示关注的自然灾害等级,配置3表示关注 >=3级的灾害

Standard    标准的   1
Minor       次要的   2
Moderate    中等的   3
Major       主要     4
Severe      严重     5
Extreme     极端     6

disastermsg表示灾害预警是否显示灾害的明细信息 title 只显示标题 allmsg 显示标题+明细信息

自动化配置实例

https://www.bilibili.com/read/cv18078640

heweather's People

Contributors

c1pher-cn avatar detecti1 avatar lazydan avatar vergilgao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

heweather's Issues

安装问题

通过HACS添加本仓库为自定义存储库 再安装
安装后目录结构为

[core-ssh ~]$ ls config/custom_components/
hacs heweather pyscript xiaomi_gateway3 xiaomi_miio_cooker xiaomi_miot
[core-ssh ~]$ ls config/custom_components/heweather/
__pycache__ _forecast _hourlyforecast manifest.json sensor.py

配置文件无法正常加载

是不是安装方式不对

升级 homeassistant core 2024.1.6后 heweather 实体不可用

错误:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1282, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 945, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1066, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1003, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 1000, in state
return self.condition
^^^^^^^^^^^^^^
File "/config/custom_components/heweather/weather.py", line 230, in condition
return [k for k, v in CONDITION_CLASSES.items() if
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: list index out of range

WeatherEntity不能用了

custom_components.heweather_forecast.weather::LocalWeather is overriding deprecated methods on an instance of WeatherEntity, this is not valid and will be unsupported from Home Assistant 2023.1. Please report it to the custom integration author.

七日天气预报 无法使用

大佬好,感谢大佬的组件,使用中遇到了heweather_forecast无法使用,其他组件正常

HA版本:2022.9.4

配置文件:
Screen Shot 2022-09-19 at 17 34 38

错误日志:
2022-09-19 05:25:12.327 ERROR (MainThread) [homeassistant.components.weather] Error while setting up heweather_forecast platform for weather Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/heweather_forecast/weather.py", line 69, in async_setup_platform async_add_devices([LocalWeather(data)], True) File "/config/custom_components/heweather_forecast/weather.py", line 81, in __init__ self._temperature_unit = None AttributeError: can't set attribute '_temperature_unit'

升级失效了,请大佬适配下 ha 2023.6.0之后运行出错

Unexpected exception importing platform custom_components.heweather_forecast.weather
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 833, in get_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 850, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/config/custom_components/heweather_forecast/weather.py", line 68, in
@asyncio.coroutine
^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'coroutine'

配置sensor时出错

麻烦看下,配置sensor时出错,但是配置weather没有问题
配置如下:
sensor:
 - platform: heweather
  location: 101200112 # 填写你所在区域代码Location_ID,https://github.com/qwd/LocationList/blob/master/China-City-List-latest.csv
  key: xxxxxxx # api平台申请的key
  disasterlevel: 3
  disastermsg: allmsg

错误信息如下:
Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:230
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 22:29:53 (1 occurrences)
Last logged: 22:29:53

[547095428160] The system cannot restart because the configuration is not valid: Integration error:   key - Integration '  key' not found. Integration error:   disasterlevel - Integration '  disasterlevel' not found. Integration error:  - - Integration ' -' not found. Integration error:   disastermsg - Integration '  disastermsg' not found. Integration error:   location - Integration '  location' not found.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 230, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 986, in admin_handler
await result
File "/usr/src/homeassistant/homeassistant/components/homeassistant/init.py", line 191, in async_handle_core_service
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: The system cannot restart because the configuration is not valid: Integration error:   key - Integration '  key' not found.
Integration error:   disasterlevel - Integration '  disasterlevel' not found.
Integration error:  - - Integration ' -' not found.
Integration error:   disastermsg - Integration '  disastermsg' not found.
Integration error:   location - Integration '  location' not found.

有api马上要取消了

custom_components.heweather_forecast.weather::LocalWeather is overriding deprecated methods on an instance of WeatherEntity, this is not valid and will be unsupported from Home Assistant 2023.1. Please report it to the custom integration author.

Home Assistant 2023.6.0插件报错

image
image

Platform error sensor.heweather_hourlyforecast - Exception importing custom_components.heweather_hourlyforecast.sensor
Platform error weather.heweather_forecast - Exception importing custom_components.heweather_forecast.weather

what can i do ?

The heweather_forecast custom integration is using deprecated weather forecast
此项在版本 2024.3.0 中无法工作。请在升级之前解决。
The custom integration heweather_forecast implements the forecast property or sets self._attr_forecast in a subclass of WeatherEntity.

Please create a bug report at https://github.com/c1pher-cn/heweather/issues.

Once an updated version of heweather_forecast is available, install it and restart Home Assistant to fix this issue.

可不可以给名字加个前缀

ha里所有的实体默认情况下都带有集成或设备号之类的前缀, 这是我唯一见过没有前缀的, 在开发者工具里完全无从搜起, 每一个项目都是独立的拼音名称, 所有的实体只能去实体列表里按集成排序再找到它们, 现在大部分非老旧集成都是会跟着集成页面走的, 可以看到全部设备/实体的同时也可以在ui里定制比如前缀之类, 然后希望能以英文命名实体, 实在是拼音配下划线反而一眼看不出是什么

配置

大佬 ,。我在Git上下载了文件放入custom_components目录后除了写配置文件之外我还需要做什么吗?,请问 配置文件写在哪里呢?是在HA里写?还是在目录里面新建yaml文件来做配置呢?如果新建的各个配置是在一个文件里面还是在其对应的文件夹里面呢?谢谢

大佬请问这个错误怎么解决?custom_components.heweather_forecast.weather::LocalWeather is overriding deprecated methods on an instance of WeatherEntity, this is not valid and will be unsupported from Home Assistant 2023.1. Please report it to the custom integration author.

Logger: homeassistant.components.weather
Source: components/weather/init.py:278
Integration: 天气 (documentation, issues)
First occurred: 10:53:10 (1 occurrences)
Last logged: 10:53:10

custom_components.heweather_forecast.weather::LocalWeather is overriding deprecated methods on an instance of WeatherEntity, this is not valid and will be unsupported from Home Assistant 2023.1. Please report it to the custom integration

这个是要更新什么吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.