『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 2548|回复: 15

[求助] 升级到最新版的2022.7.3之后和风天气插件报错了

[复制链接]

15

主题

163

帖子

1939

积分

金牌会员

Rank: 6Rank: 6

积分
1939
金钱
1776
HASS币
0
发表于 2022-7-12 13:24:52 | 显示全部楼层 |阅读模式
升级到最新版的2022.7.3之后和风天气插件报错了,不会修改,大佬们有没有帮忙修复一下的?插件地址:https://github.com/shaonianzhentan/hf_weather
shaonianzhentan/hf_weather: 一个不知道改了几手的和风天气最简单的配置版本 (github.com)
Logger: homeassistant.components.weather
Source: custom_components/hf_weather/weather.py:99
Integration: Weather ([color=var(--primary-color)]documentation
, [color=var(--primary-color)]issues
)
First occurred: 13:09:35 (2 occurrences)
Last logged: 13:11:58
Error while setting up hf_weather platform for weatherTraceback (most recent call last):  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform    await asyncio.shield(task)  File "/config/custom_components/hf_weather/weather.py", line 88, in async_setup_entry    async_add_entities([HeFengWeather(data, name)], True)  File "/config/custom_components/hf_weather/weather.py", line 99, in __init__    self._temperature_unit = NoneAttributeError: can't set attribute '_temperature_unit'

回复

使用道具 举报

76

主题

1356

帖子

1万

积分

元老级技术达人

积分
18143
金钱
16747
HASS币
290
发表于 2022-7-12 23:23:24 | 显示全部楼层
本帖最后由 dscao 于 2022-7-14 23:33 编辑

修复了一下错误提示:

Home Assistant 2022.7.4 前端版本: 20220707.0 - latest


卡片的单位也修改了一下,但小时预报的单位不能随设置变化,只能固定为°C


1.jpg

2.jpg


hf_weather.zip

86.89 KB, 阅读权限: 20, 下载次数: 44

售价: 1 金钱  [记录]

2022.7.14

回复

使用道具 举报

4

主题

225

帖子

4034

积分

元老级技术达人

积分
4034
金钱
3794
HASS币
40
发表于 2022-7-12 14:35:13 | 显示全部楼层
File "/config/custom_components/hf_weather/weather.py", line 99, in __init__    self._temperature_unit = NoneAttributeError: can't set attribute '_temperature_unit'

/config/custom_components/hf_weather/weather.py 这个文件的99行 : self._temperature_unit  前面加#   注释掉  就好了
回复

使用道具 举报

15

主题

163

帖子

1939

积分

金牌会员

Rank: 6Rank: 6

积分
1939
金钱
1776
HASS币
0
 楼主| 发表于 2022-7-12 15:20:23 | 显示全部楼层
貌似不行,改了还是报错,但是错误不一样了

Logger: homeassistant.components.weather
Source: custom_components/hf_weather/weather.py:238
Integration: Weather (documentation, issues)
First occurred: 15:19:12 (1 occurrences)
Last logged: 15:19:12

hf_weather: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 446, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 702, in async_device_update
    await task
  File "/usr/local/lib/python3.10/asyncio/coroutines.py", line 124, in coro
    res = func(*args, **kw)
  File "/config/custom_components/hf_weather/weather.py", line 238, in async_update
    self._temperature_unit = self._data.temperature_unit
AttributeError: can't set attribute '_temperature_unit'
回复

使用道具 举报

15

主题

163

帖子

1939

积分

金牌会员

Rank: 6Rank: 6

积分
1939
金钱
1776
HASS币
0
 楼主| 发表于 2022-7-12 15:21:25 | 显示全部楼层
81795791 发表于 2022-7-12 14:35
File "/config/custom_components/hf_weather/weather.py", line 99, in __init__    self._temperature_un ...

貌似不行,改了还是报错,但是错误不一样了
Logger: homeassistant.components.weather
Source: custom_components/hf_weather/weather.py:238
Integration: Weather (documentation, issues)
First occurred: 15:19:12 (1 occurrences)
Last logged: 15:19:12

hf_weather: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 446, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 702, in async_device_update
    await task
  File "/usr/local/lib/python3.10/asyncio/coroutines.py", line 124, in coro
    res = func(*args, **kw)
  File "/config/custom_components/hf_weather/weather.py", line 238, in async_update
    self._temperature_unit = self._data.temperature_unit
AttributeError: can't set attribute '_temperature_unit'
回复

使用道具 举报

2

主题

90

帖子

888

积分

高级会员

Rank: 4

积分
888
金钱
798
HASS币
0
发表于 2022-7-12 15:47:54 | 显示全部楼层
回复

使用道具 举报

76

主题

1356

帖子

1万

积分

元老级技术达人

积分
18143
金钱
16747
HASS币
290
发表于 2022-7-12 16:02:55 | 显示全部楼层
新版温度单位不能在代码中指定了,由天气实体的UI设置中设置,支持多单位自动转换了。
shaonianzhentan/hf_weather 这个修改版不错,卡片引入都集成了。只要修复一下新版的这个单位问题。
回复

使用道具 举报

15

主题

163

帖子

1939

积分

金牌会员

Rank: 6Rank: 6

积分
1939
金钱
1776
HASS币
0
 楼主| 发表于 2022-7-12 16:44:22 | 显示全部楼层
dscao 发表于 2022-7-12 16:02
新版温度单位不能在代码中指定了,由天气实体的UI设置中设置,支持多单位自动转换了。
shaonianzhentan/hf_ ...

非常感谢,我只是把所有的unit都给屏蔽掉了,可以启动了,但是还有个warning,不影响使用,附件是我简单更改的,仅供大家参考。
Logger: homeassistant.components.weather
Source: components/weather/__init__.py:308
Integration: Weather ([color=var(--primary-color)]documentation
, [color=var(--primary-color)]issues
)
First occurred: 16:37:12 (1 occurrences)
Last logged: 16:37:12
custom_components.hf_weather.weather::HeFengWeather 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 component author

weather.zip

3.97 KB, 下载次数: 15

回复

使用道具 举报

76

主题

1356

帖子

1万

积分

元老级技术达人

积分
18143
金钱
16747
HASS币
290
发表于 2022-7-13 00:06:01 | 显示全部楼层
顺便参考这个方法,把彩云天气也做一下卡片集成。安装集成后不需要单独安装卡片,安装简化了不少。

1.jpg


2.jpg

3.jpg

4.jpg

注意:卡片类型名改成了: type: custom:colorfulclouds_weather-card


colorfulclouds.zip

62.27 KB, 阅读权限: 20, 下载次数: 20

售价: 1 金钱  [记录]

2022.7.12

回复

使用道具 举报

15

主题

163

帖子

1939

积分

金牌会员

Rank: 6Rank: 6

积分
1939
金钱
1776
HASS币
0
 楼主| 发表于 2022-7-13 09:01:56 | 显示全部楼层
dscao 发表于 2022-7-13 00:06
顺便参考这个方法,把彩云天气也做一下卡片集成。安装集成后不需要单独安装卡片,安装简化了不少。

强强强,必须顶一下
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-20 21:25 , Processed in 0.066022 second(s), 37 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表