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

 找回密码
 立即注册
楼主: jack9603301

[基础教程] HASS集成互联网天气

[复制链接]

2

主题

239

帖子

817

积分

高级会员

Rank: 4

积分
817
金钱
573
HASS币
20
 楼主| 发表于 2021-10-17 02:20:28 | 显示全部楼层
koolca 发表于 2021-9-27 17:20
在sensor文件夹下放入HeWeather.py文件,此版本文件支持0.63以上HA。
楼主这个文件在哪里? ...



custom_components文件夹里创建一个文件夹复制必要文件什么的,但,能不能一个py而没有扩展配置信息,我不知道。都行 clone下也可以
回复

使用道具 举报

7

主题

193

帖子

1551

积分

金牌会员

Rank: 6Rank: 6

积分
1551
金钱
1358
HASS币
0
发表于 2021-10-17 09:19:56 | 显示全部楼层
不是自带的右天气数据了嘛
回复

使用道具 举报

2

主题

239

帖子

817

积分

高级会员

Rank: 4

积分
817
金钱
573
HASS币
20
 楼主| 发表于 2021-10-18 21:39:03 | 显示全部楼层
散步d小螃蟹 发表于 2021-10-17 09:19
不是自带的右天气数据了嘛

国外和国内数据不可能完全一样的,而且还有速度什么的
回复

使用道具 举报

7

主题

193

帖子

1551

积分

金牌会员

Rank: 6Rank: 6

积分
1551
金钱
1358
HASS币
0
发表于 2021-10-19 08:55:19 | 显示全部楼层
jack9603301 发表于 2021-10-18 21:39
国外和国内数据不可能完全一样的,而且还有速度什么的

哦哦  这样啊  看来是有必要要跟着做一套了
回复

使用道具 举报

0

主题

14

帖子

67

积分

注册会员

Rank: 2

积分
67
金钱
53
HASS币
0
发表于 2022-1-18 12:22:41 | 显示全部楼层
本帖最后由 freeedge 于 2022-1-18 12:29 编辑

你好 ,不好意思打扰一下 很多模块都加载不出来数据了,能否再调整一下代码,谢谢!
222.jpg 11111.jpg
回复

使用道具 举报

2

主题

239

帖子

817

积分

高级会员

Rank: 4

积分
817
金钱
573
HASS币
20
 楼主| 发表于 2022-1-21 15:51:11 | 显示全部楼层
freeedge 发表于 2022-1-18 12:22
你好 ,不好意思打扰一下 很多模块都加载不出来数据了,能否再调整一下代码,谢谢!

...

给吓配置?查过日志么?报错是什么?
回复

使用道具 举报

0

主题

14

帖子

67

积分

注册会员

Rank: 2

积分
67
金钱
53
HASS币
0
发表于 2022-1-22 20:03:44 | 显示全部楼层
本帖最后由 freeedge 于 2022-1-22 20:06 编辑

这是其中的一个error
WX20220122-200527@2x.png
此错误来自自定义集成。

Logger: homeassistant.helpers.entity
Source: custom_components/HeWeather/sensor.py:339
Integration: HeWeather (documentation)
First occurred: 2022年1月19日 18:47:33 (1 occurrences)
Last logged: 2022年1月19日 18:47:33

Update for sensor.tian_qi_zhuang_tai fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/local/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 358, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f549020fdf0>: Failed to establish a new connection: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='free-api.heweather.net', port=443): Max retries exceeded with url: /s6/air/now (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f549020fdf0>: Failed to establish a new connection: [Errno -3] Try again'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/HeWeather/sensor.py", line 363, in update
    con_air = self.air()
  File "/config/custom_components/HeWeather/sensor.py", line 339, in air
    r_air = requests.post(self._air_url, self._params)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 117, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='free-api.heweather.net', port=443): Max retries exceeded with url: /s6/air/now (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f549020fdf0>: Failed to establish a new connection: [Errno -3] Try again'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/local/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 358, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f546133ad30>: Failed to establish a new connection: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='free-api.heweather.net', port=443): Max retries exceeded with url: /s6/air/now (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f546133ad30>: Failed to establish a new connection: [Errno -3] Try again'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 487, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 699, in async_device_update
    await task
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/HeWeather/sensor.py", line 139, in update
    self._data.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 195, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/HeWeather/sensor.py", line 366, in update
    con_air = self.air()
  File "/config/custom_components/HeWeather/sensor.py", line 339, in air
    r_air = requests.post(self._air_url, self._params)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 117, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='free-api.heweather.net', port=443): Max retries exceeded with url: /s6/air/now (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f546133ad30>: Failed to establish a new connection: [Errno -3] Try again'))
回复

使用道具 举报

0

主题

14

帖子

67

积分

注册会员

Rank: 2

积分
67
金钱
53
HASS币
0
发表于 2022-1-22 20:04:47 | 显示全部楼层
jack9603301 发表于 2022-1-21 15:51
给吓配置?查过日志么?报错是什么?

感谢 感谢,配置 我跟你的一模一样 没做任何改动,也不会改动
回复

使用道具 举报

2

主题

239

帖子

817

积分

高级会员

Rank: 4

积分
817
金钱
573
HASS币
20
 楼主| 发表于 2022-1-27 18:49:41 | 显示全部楼层
奇怪了,感觉是API接口访问https错误。你确定网络没问题?
回复

使用道具 举报

3

主题

28

帖子

158

积分

注册会员

Rank: 2

积分
158
金钱
130
HASS币
0
发表于 2022-2-4 14:18:37 | 显示全部楼层
兄弟流程图的图片挂掉了,可以补上吗
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-9 03:15 , Processed in 0.247376 second(s), 32 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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