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

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

[插件集成] 我真真的好无聊。。。。判断是否节假日【2020-1-1更新】

  [复制链接]

19

主题

417

帖子

2467

积分

金牌会员

Rank: 6Rank: 6

积分
2467
金钱
2045
HASS币
20
发表于 2020-1-20 16:39:32 | 显示全部楼层
来看看咋样 不知道能行不  我以前的那个 总错
回复

使用道具 举报

0

主题

22

帖子

105

积分

注册会员

Rank: 2

积分
105
金钱
83
HASS币
0
发表于 2020-1-22 02:40:32 | 显示全部楼层
学习代码!!
回复

使用道具 举报

0

主题

17

帖子

73

积分

注册会员

Rank: 2

积分
73
金钱
56
HASS币
0
发表于 2020-1-23 23:27:30 | 显示全部楼层
支持支持支持支持
回复

使用道具 举报

10

主题

320

帖子

1643

积分

金牌会员

Rank: 6Rank: 6

积分
1643
金钱
1323
HASS币
0
发表于 2020-1-25 23:58:36 来自手机 | 显示全部楼层
这个看看,学习了
回复

使用道具 举报

15

主题

297

帖子

1511

积分

论坛技术达人

积分
1511
金钱
1209
HASS币
30
发表于 2020-1-26 23:30:48 | 显示全部楼层
看看是啥
回复

使用道具 举报

0

主题

41

帖子

292

积分

论坛积极会员

积分
292
金钱
251
HASS币
0
发表于 2020-1-30 11:09:11 | 显示全部楼层

这个看看,学习了
回复

使用道具 举报

3

主题

207

帖子

971

积分

高级会员

Rank: 4

积分
971
金钱
764
HASS币
0
发表于 2020-2-2 16:52:51 | 显示全部楼层
本帖最后由 xiaoguaileo 于 2020-2-2 16:54 编辑

docker里安装的homeassistant
1-5号后更新的,有几天是正常的,后面就不行了
ubuntu下面直接安装的homeassistant没有此问题出问题的是节假日插件,我试着安装https://bbs.hassbian.com/forum.p ... 9133&highlight=节假日,这个帖子里的插件也是一样报错不能使用

报错信息如下:
2020-02-02 16:47:08 ERROR (MainThread) [homeassistant.components.binary_sensor] ha_cloud_music: Error on device update!
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 376, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 334, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7f133f7fb1d0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='sp0.baidu.com', port=443): Max retries exceeded with url: /8aQDcjqpAAV3otqbppnN2DJv/api.php?query=2020%E5%B9%B42%E6%9C%88&co=&resource_id=6018&t=1573873782858&ie=utf8&oe=gbk&cb=op_aladdin_callback&format=json&tn=baidu&cb=&_=1573873715796 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f133f7fb1d0>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 299, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/config/custom_components/ha_cloud_music/binary_sensor.py", line 208, in async_update
    self._state = self.is_holiday(now)
  File "/config/custom_components/ha_cloud_music/binary_sensor.py", line 163, in is_holiday
    + '&co=&resource_id=6018&t=1573873782858&ie=utf8&oe=gbk&cb=op_aladdin_callback&format=json&tn=baidu&cb=&_=1573873715796')
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='sp0.baidu.com', port=443): Max retries exceeded with url: /8aQDcjqpAAV3otqbppnN2DJv/api.php?query=2020%E5%B9%B42%E6%9C%88&co=&resource_id=6018&t=1573873782858&ie=utf8&oe=gbk&cb=op_aladdin_callback&format=json&tn=baidu&cb=&_=1573873715796 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f133f7fb1d0>: Failed to establish a new connection: [Errno 111] Connection refused'))

回复

使用道具 举报

3

主题

207

帖子

971

积分

高级会员

Rank: 4

积分
971
金钱
764
HASS币
0
发表于 2020-2-2 16:56:53 | 显示全部楼层
本帖最后由 xiaoguaileo 于 2020-2-2 16:58 编辑

使用的是hub.docker.com库里的homeassistant/home-assistant镜像安装的,网络是host模式
回复

使用道具 举报

3

主题

207

帖子

971

积分

高级会员

Rank: 4

积分
971
金钱
764
HASS币
0
发表于 2020-2-2 17:26:34 | 显示全部楼层
我重新开了一个容器,只加了节假日这个插件

报错信息如下:

2020-02-02 17:21:07 ERROR (MainThread) [homeassistant.components.binary_sensor] ha_cloud_music: Error on device update!
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 376, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 334, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7f5a26297e10>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='sp0.baidu.com', port=443): Max retries exceeded with url: /8aQDcjqpAAV3otqbppnN2DJv/api.php?query=2020%E5%B9%B42%E6%9C%88&co=&resource_id=6018&t=1573873782858&ie=utf8&oe=gbk&cb=op_aladdin_callback&format=json&tn=baidu&cb=&_=1573873715796 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f5a26297e10>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 299, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/config/custom_components/ha_cloud_music/binary_sensor.py", line 208, in async_update
    self._state = self.is_holiday(now)
  File "/config/custom_components/ha_cloud_music/binary_sensor.py", line 163, in is_holiday
    + '&co=&resource_id=6018&t=1573873782858&ie=utf8&oe=gbk&cb=op_aladdin_callback&format=json&tn=baidu&cb=&_=1573873715796')
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='sp0.baidu.com', port=443): Max retries exceeded with url: /8aQDcjqpAAV3otqbppnN2DJv/api.php?query=2020%E5%B9%B42%E6%9C%88&co=&resource_id=6018&t=1573873782858&ie=utf8&oe=gbk&cb=op_aladdin_callback&format=json&tn=baidu&cb=&_=1573873715796 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f5a26297e10>: Failed to establish a new connection: [Errno 111] Connection refused'))
回复

使用道具 举报

0

主题

68

帖子

431

积分

中级会员

Rank: 3Rank: 3

积分
431
金钱
363
HASS币
0
发表于 2020-2-5 15:47:31 | 显示全部楼层
感谢分享。。
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-25 20:24 , Processed in 0.265231 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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