From 71a1c74f099827103440e427e9924910db1615b8 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 25 Feb 2022 12:52:41 +0800 Subject: [PATCH 001/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20ghprox?= =?UTF-8?q?y/fastgit=20mirrors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/base.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 1a81d941d69..5dac13a33d1 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -582,7 +582,32 @@ async def async_download_file(self, url: str) -> bytes | None: self.log.debug("Downloading %s", url) + mirrors = { + "ghproxy": { + "raw": "https://ghproxy.com/raw.githubusercontent.com", + "archive": "https://ghproxy.com/github.com", + "release": "https://ghproxy.com/github.com", + }, + "fastgit": { + "raw": "https://raw.fastgit.org", + "archive": "https://hub.fastgit.org", + "release": "https://hub.fastgit.org", + }, + } + while tries_left > 0: + + mirror = mirrors["ghproxy"] + if tries_left <= 2: + mirror = mirrors["fastgit"] + + if "releases/download/" in url: + url = url.replace("https://github.com/", f"{mirror['release']}/") + elif "archive/refs/" in url: + url = url.replace("https://github.com/", f"{mirror['archive']}/") + else: + url = url.replace("https://raw.githubusercontent.com/", f"{mirror['raw']}/") + try: request = await self.session.get(url=url, timeout=ClientTimeout(total=60)) From 966e877c8db80534a0bf40fde4a287f63da3e709 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 25 Feb 2022 14:08:34 +0800 Subject: [PATCH 002/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20upgrad?= =?UTF-8?q?e=20hacs=20to=20hacs-china?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 5dac13a33d1..7501aa66664 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -582,6 +582,7 @@ async def async_download_file(self, url: str) -> bytes | None: self.log.debug("Downloading %s", url) + url = url.replace("//github.com/hacs/integration", "//github.com/hacs-china/integration") mirrors = { "ghproxy": { "raw": "https://ghproxy.com/raw.githubusercontent.com", From 2c2342e0c78f50035f870f35b4519329f930a92d Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 25 Feb 2022 14:09:01 +0800 Subject: [PATCH 003/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20HACS?= =?UTF-8?q?=20for=20China?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 413a9288106..b7b6d39f8a3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,32 @@ +# HACS 极速版 + +[HACS](https://hacs.xyz)是一款优秀的 [Home Assistant](https://www.home-assistant.io) 集成商店,然而国人想要使用它下载插件或前端卡片却困难重重,主要原因就是国内的网络环境。 +本项目使用了[ghproxy.com](https://ghproxy.com)和[fastgit.org](https://fastgit.org)提供的GitHub镜像服务,可以让大家更快的下载商店里的插件。 + +## 安装 + +> 本项目为HACS官方集成的修改版,安装本项目版本会覆盖官方的集成,但是无需重新配置集成(共用一套配置),因此你可以放心安装。如果想切换到官方版本,使用官方的shell命令再安装即可。 + +### 使用命令行安装 + +```bash +wget -O - https://cdn.jsdelivr.net/gh/hasscc/get/get | DOMAIN=hacs REPO_PATH=hacs-china/integration ARCHIVE_TAG=china bash - +``` + +- 如果是hassos/hassio/supervisor版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 +- 如果是core/docker版本的HA,需要ssh登陆宿主机后,进入到HA配置目录执行 + +### 手动安装 + +- [下载](https://github.com/hacs-china/integration/archive/refs/heads/china.zip)安装包并解压 +- 通过samba/ftp复制解压出来的`custom_components`文件夹到你的HA配置目录 +- 重启HA +- [添加HACS集成](https://my.home-assistant.io/redirect/config_flow_start/?domain=hacs)(仅首次安装) + + +------ + + # HACS (Home Assistant Community Store) [![Total alerts](https://img.shields.io/lgtm/alerts/g/hacs/integration.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/hacs/integration/alerts/) From 72a3200b1e8ae0b0891c0c5d17a0b16e05f6947e Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 25 Feb 2022 15:55:12 +0800 Subject: [PATCH 004/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Fix=20downlo?= =?UTF-8?q?ad=20link?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7b6d39f8a3..45452472c67 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ wget -O - https://cdn.jsdelivr.net/gh/hasscc/get/get | DOMAIN=hacs REPO_PATH=hac ### 手动安装 -- [下载](https://github.com/hacs-china/integration/archive/refs/heads/china.zip)安装包并解压 +- [下载](https://github.com/hacs-china/integration/releases/latest/download/hacs.zip)安装包并解压 - 通过samba/ftp复制解压出来的`custom_components`文件夹到你的HA配置目录 - 重启HA - [添加HACS集成](https://my.home-assistant.io/redirect/config_flow_start/?domain=hacs)(仅首次安装) From 270a024e2e41575ce6e11f8393f47881523d0953 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 25 Feb 2022 21:06:40 +0800 Subject: [PATCH 005/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20mirror?= =?UTF-8?q?.ghproxy.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/base.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 7501aa66664..611d225de89 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -575,32 +575,43 @@ async def async_download_file(self, url: str) -> bytes | None: if url is None: return None - tries_left = 5 + tries_left = 6 if "tags/" in url: url = url.replace("tags/", "") - self.log.debug("Downloading %s", url) - url = url.replace("//github.com/hacs/integration", "//github.com/hacs-china/integration") + mirrors = { + # https://ghproxy.com "ghproxy": { "raw": "https://ghproxy.com/raw.githubusercontent.com", "archive": "https://ghproxy.com/github.com", "release": "https://ghproxy.com/github.com", }, + + # https://mirror.ghproxy.com + "ghproxy2": { + "raw": "https://mirror.ghproxy.com/raw.githubusercontent.com", + "archive": "https://mirror.ghproxy.com/github.com", + "release": "https://mirror.ghproxy.com/github.com", + }, + + # https://doc.fastgit.org/zh-cn/node.html "fastgit": { "raw": "https://raw.fastgit.org", - "archive": "https://hub.fastgit.org", - "release": "https://hub.fastgit.org", + "archive": "https://hub.fastgit.xyz", + "release": "https://hub.fastgit.xyz", }, } while tries_left > 0: mirror = mirrors["ghproxy"] - if tries_left <= 2: + if tries_left <= 4: mirror = mirrors["fastgit"] + if tries_left <= 2: + mirror = mirrors["ghproxy2"] if "releases/download/" in url: url = url.replace("https://github.com/", f"{mirror['release']}/") @@ -609,6 +620,8 @@ async def async_download_file(self, url: str) -> bytes | None: else: url = url.replace("https://raw.githubusercontent.com/", f"{mirror['raw']}/") + self.log.debug("Downloading %s", url) + try: request = await self.session.get(url=url, timeout=ClientTimeout(total=60)) From 901c63db17ac32647b83f741f87ecb5faf3708a9 Mon Sep 17 00:00:00 2001 From: Alone Date: Sun, 27 Feb 2022 01:00:43 +0800 Subject: [PATCH 006/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20HACS?= =?UTF-8?q?=20for=20China?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 45452472c67..5f7d0a0b96e 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,28 @@ # HACS 极速版 [HACS](https://hacs.xyz)是一款优秀的 [Home Assistant](https://www.home-assistant.io) 集成商店,然而国人想要使用它下载插件或前端卡片却困难重重,主要原因就是国内的网络环境。 -本项目使用了[ghproxy.com](https://ghproxy.com)和[fastgit.org](https://fastgit.org)提供的GitHub镜像服务,可以让大家更快的下载商店里的插件。 +本项目使用了[ghproxy.com](https://ghproxy.com)和[fastgit.org](https://fastgit.org)提供的Github镜像服务,可以让大家更快的下载商店里的插件。 ## 安装 -> 本项目为HACS官方集成的修改版,安装本项目版本会覆盖官方的集成,但是无需重新配置集成(共用一套配置),因此你可以放心安装。如果想切换到官方版本,使用官方的shell命令再安装即可。 +> 本项目是HACS官方集成的修改版,安装本项目版本会覆盖官方的集成,但是无需重新配置集成(共用一套配置),因此你可以放心安装。如果想切换到官方版本,使用官方的shell命令再安装即可。 -### 使用命令行安装 +### 使用命令行安装(推荐) ```bash -wget -O - https://cdn.jsdelivr.net/gh/hasscc/get/get | DOMAIN=hacs REPO_PATH=hacs-china/integration ARCHIVE_TAG=china bash - +wget -O - https://cdn.jsdelivr.net/gh/hasscc/get@main/get | DOMAIN=hacs REPO_PATH=hacs-china/integration ARCHIVE_TAG=china bash - ``` -- 如果是hassos/hassio/supervisor版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 -- 如果是core/docker版本的HA,需要ssh登陆宿主机后,进入到HA配置目录执行 +- 如果是haos/hassio/supervisor版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 +- 如果是core/docker版本的HA,需要ssh登陆宿主机后,并cd进入到HA配置目录再执行安装命令 ### 手动安装 -- [下载](https://github.com/hacs-china/integration/releases/latest/download/hacs.zip)安装包并解压 -- 通过samba/ftp复制解压出来的`custom_components`文件夹到你的HA配置目录 +- [点击这里下载](https://github.com/hacs-china/integration/releases/latest/download/hacs.zip)安装包并解压 +- 通过samba/ftp进入HA配置目录 +- 在HA配置目录下创建`custom_components`文件夹(如果已有请忽略) +- 在`custom_components`目录下创建`hacs`文件夹(如果已有请删除重新创建) +- 將解压出来的hacs文件复制到刚创建的`hacs`文件夹 - 重启HA - [添加HACS集成](https://my.home-assistant.io/redirect/config_flow_start/?domain=hacs)(仅首次安装) From be7064f47b7a578de2429492d4cf8b65e7e83084 Mon Sep 17 00:00:00 2001 From: Alone Date: Sun, 27 Feb 2022 12:22:24 +0800 Subject: [PATCH 007/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Improve=20fo?= =?UTF-8?q?r=20mirrors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/base.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 611d225de89..f044f3edb62 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -575,13 +575,6 @@ async def async_download_file(self, url: str) -> bytes | None: if url is None: return None - tries_left = 6 - - if "tags/" in url: - url = url.replace("tags/", "") - - url = url.replace("//github.com/hacs/integration", "//github.com/hacs-china/integration") - mirrors = { # https://ghproxy.com "ghproxy": { @@ -605,13 +598,19 @@ async def async_download_file(self, url: str) -> bytes | None: }, } + tries_keys = list(mirrors.keys()) + tries_left = len(tries_keys) * 2 + + if "tags/" in url: + url = url.replace("tags/", "") + + src = url.replace("//github.com/hacs/integration", "//github.com/hacs-china/integration") + from math import ceil + while tries_left > 0: - mirror = mirrors["ghproxy"] - if tries_left <= 4: - mirror = mirrors["fastgit"] - if tries_left <= 2: - mirror = mirrors["ghproxy2"] + url = src + mirror = mirrors[tries_keys[0 - ceil(tries_left / 2)]] if "releases/download/" in url: url = url.replace("https://github.com/", f"{mirror['release']}/") From 834abef13cc938c42d7fb5b313a776a1421a20d5 Mon Sep 17 00:00:00 2001 From: Alone Date: Sun, 27 Feb 2022 12:25:56 +0800 Subject: [PATCH 008/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Improve=20fo?= =?UTF-8?q?r=20upgrade=20hacs-china?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/enums.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/hacs/enums.py b/custom_components/hacs/enums.py index 9b0b8e365fc..c79b2451f93 100644 --- a/custom_components/hacs/enums.py +++ b/custom_components/hacs/enums.py @@ -7,7 +7,7 @@ class HacsGitHubRepo(str, Enum): """HacsGitHubRepo.""" DEFAULT = "hacs/default" - INTEGRATION = "hacs/integration" + INTEGRATION = "hacs-china/integration" class HacsCategory(str, Enum): From eb8e3f28c1b6ed5105fdbbd1b23da431eef0e9e6 Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 2 Mar 2022 11:33:10 +0800 Subject: [PATCH 009/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Update=20rea?= =?UTF-8?q?dme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5f7d0a0b96e..1e58d6222ef 100644 --- a/README.md +++ b/README.md @@ -13,18 +13,24 @@ wget -O - https://cdn.jsdelivr.net/gh/hasscc/get@main/get | DOMAIN=hacs REPO_PATH=hacs-china/integration ARCHIVE_TAG=china bash - ``` +> 如果上面的命令执行后卡住不动,或没有提示安装成功,请尝试下面的命令 + +```bash +wget -O - https://cdn.jsdelivr.net/gh/hasscc/get@main/get | HUB_DOMAIN=ghproxy.com/github.com DOMAIN=hacs REPO_PATH=hacs-china/integration ARCHIVE_TAG=china bash - +``` + - 如果是haos/hassio/supervisor版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 - 如果是core/docker版本的HA,需要ssh登陆宿主机后,并cd进入到HA配置目录再执行安装命令 ### 手动安装 -- [点击这里下载](https://github.com/hacs-china/integration/releases/latest/download/hacs.zip)安装包并解压 +- [点击这里下载](https://github.com/hacs-china/integration/releases/latest/download/hacs.zip)安装包并解压 (如果下载不了请点[这里](https://ghproxy.com/github.com/hacs-china/integration/releases/latest/download/hacs.zip)或[这里](https://hub.fastgit.xyz/hacs-china/integration/releases/latest/download/hacs.zip)) - 通过samba/ftp进入HA配置目录 -- 在HA配置目录下创建`custom_components`文件夹(如果已有请忽略) -- 在`custom_components`目录下创建`hacs`文件夹(如果已有请删除重新创建) +- 在HA配置目录下创建`custom_components`文件夹 (如果已有请忽略) +- 在`custom_components`目录下创建`hacs`文件夹 (如果已有请删除重新创建) - 將解压出来的hacs文件复制到刚创建的`hacs`文件夹 - 重启HA -- [添加HACS集成](https://my.home-assistant.io/redirect/config_flow_start/?domain=hacs)(仅首次安装) +- [添加HACS集成](https://my.home-assistant.io/redirect/config_flow_start/?domain=hacs) (仅首次安装) ------ From 42f4f071cd604f2f0a1ce43320a2c0445c8fae52 Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 2 Mar 2022 12:34:48 +0800 Subject: [PATCH 010/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Update=20rea?= =?UTF-8?q?dme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 1e58d6222ef..6910d8e7d96 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,11 @@ wget -O - https://cdn.jsdelivr.net/gh/hasscc/get@main/get | HUB_DOMAIN=ghproxy.c - [添加HACS集成](https://my.home-assistant.io/redirect/config_flow_start/?domain=hacs) (仅首次安装) +### 常见问题 + +- [极速版和官方HACS的差别有那些?](https://github.com/hacs-china/integration/compare/main...china) + + ------ From 394331153b37efbdbca4de9f32b917ccf329fd8e Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 4 Mar 2022 17:00:50 +0800 Subject: [PATCH 011/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Update=20rea?= =?UTF-8?q?dme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6910d8e7d96..ca9e6c83262 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -# HACS 极速版 +# HACS 极速版 + +[![version](https://img.shields.io/github/v/release/hacs-china/integration)](https://github.com/hacs-china/integration/releases/latest?include_prereleases) +[![releases](https://img.shields.io/github/downloads/hacs-china/integration/total)](https://github.com/hacs-china/integration/releases) +[![stars](https://img.shields.io/github/stars/hacs-china/integration)](https://github.com/hacs-china/integration/stargazers) [HACS](https://hacs.xyz)是一款优秀的 [Home Assistant](https://www.home-assistant.io) 集成商店,然而国人想要使用它下载插件或前端卡片却困难重重,主要原因就是国内的网络环境。 本项目使用了[ghproxy.com](https://ghproxy.com)和[fastgit.org](https://fastgit.org)提供的Github镜像服务,可以让大家更快的下载商店里的插件。 From 2486f269e3e7ad9ae4d7b711bf40706a0b72b8b7 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 10 Mar 2022 17:16:07 +0800 Subject: [PATCH 012/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Update=20rea?= =?UTF-8?q?dme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ca9e6c83262..439dda6e1c4 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,20 @@ wget -O - https://cdn.jsdelivr.net/gh/hasscc/get@main/get | HUB_DOMAIN=ghproxy.c ### 手动安装 - [点击这里下载](https://github.com/hacs-china/integration/releases/latest/download/hacs.zip)安装包并解压 (如果下载不了请点[这里](https://ghproxy.com/github.com/hacs-china/integration/releases/latest/download/hacs.zip)或[这里](https://hub.fastgit.xyz/hacs-china/integration/releases/latest/download/hacs.zip)) -- 通过samba/ftp进入HA配置目录 +- 通过samba/ftp进入HA配置目录,通常为以下目录: + - `/usr/share/hassio/homeassistant` haos/hassio宿主机 + - `/config` haos/hassio的`Samba`或`Terminal & SSH`加载项 + - `$HOME/.homeassistant` 以core方式安装的HA默认配置目录 + - docker安装的HA为`-v`参数后面映射的目录 - 在HA配置目录下创建`custom_components`文件夹 (如果已有请忽略) - 在`custom_components`目录下创建`hacs`文件夹 (如果已有请删除重新创建) - 將解压出来的hacs文件复制到刚创建的`hacs`文件夹 - 重启HA - [添加HACS集成](https://my.home-assistant.io/redirect/config_flow_start/?domain=hacs) (仅首次安装) +> ⚠️ 请不要通过下图中的位置下载HACS,会缺少文件 +> ![download hacs](https://user-images.githubusercontent.com/4549099/157629602-422a7bbe-7588-4a81-803e-b295491d78fe.png) + ### 常见问题 From 28b44211551500ebd73e76fb4a0f733f2a995395 Mon Sep 17 00:00:00 2001 From: Alone Date: Mon, 28 Mar 2022 13:04:00 +0800 Subject: [PATCH 013/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20zh-Han?= =?UTF-8?q?s=20translation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hacs/translations/zh-Hans.json | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 custom_components/hacs/translations/zh-Hans.json diff --git a/custom_components/hacs/translations/zh-Hans.json b/custom_components/hacs/translations/zh-Hans.json new file mode 100644 index 00000000000..713fa4d079d --- /dev/null +++ b/custom_components/hacs/translations/zh-Hans.json @@ -0,0 +1,53 @@ +{ + "config": { + "abort": { + "single_instance_allowed": "仅允许一个 HACS 配置", + "min_ha_version": "您至少需要版本{version}及以上的Home Assistant来安装HACS", + "github": "无法使用Github进行身份验证,请稍后再试。\n_授权过程未加速,请稍后或更换网络环境再试_", + "not_setup": "HACS 未安装" + }, + "error": { + "auth": "个人访问令牌不正确", + "acc": "在继续之前,您需要勾选确认上一步的所有声明" + }, + "step": { + "user": { + "data": { + "acc_logs": "我知道如何查看 Home Assistant 日志", + "acc_addons": "我知道 HACS 中没有 Supervised 附加组件(add-ons)", + "acc_untested": "我知道 HACS 中的一切都是由社区开发/维护,未经 Home Assistant 官方的测试", + "acc_disable": "我知道如果我的 Home Assistant 遇到的问题,我应该禁用自定义插件" + }, + "description": "在安装 HACS 之前,您需要确认以下声明", + "title": "HACS 极速版" + }, + "device": { + "title": "等待设备激活" + } + }, + "progress": { + "wait_for_device": "1. 打开链接 {url} \n2.粘贴下面的代码以授权HACS: \n```\n{code}\n```\n" + } + }, + "options": { + "abort": { + "not_setup": "HACS 未安装", + "release_limit_value": "版本数量限制在1到100" + }, + "step": { + "user": { + "data": { + "not_in_use": "不能与YAML同时配置", + "country": "根据国家过滤", + "experimental": "启用实验性功能", + "release_limit": "要显示的版本数量", + "debug": "启用调试模式", + "appdaemon": "启用 AppDaemon 应用发现 & 追踪", + "netdaemon": "启用 NetDaemon 应用发现 & 追踪", + "sidepanel_icon": "侧边栏图标", + "sidepanel_title": "侧边栏标题" + } + } + } + } +} \ No newline at end of file From ddef9f471d8a20ac5991ecb7fd15193b93456fac Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 29 Mar 2022 12:25:03 +0800 Subject: [PATCH 014/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20HACS?= =?UTF-8?q?=20for=20China?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hacs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hacs.json b/hacs.json index b2e2c505afd..fb924e10b74 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,5 @@ { - "name": "HACS", + "name": "🇨🇳 HACS 极速版", "zip_release": true, "hide_default_branch": true, "homeassistant": "2021.9.0", From 5465c534d28314a2474d3984c292fa1d7b7d3992 Mon Sep 17 00:00:00 2001 From: Alone Date: Sun, 3 Apr 2022 14:25:03 +0800 Subject: [PATCH 015/140] Update lock.yml --- .github/workflows/lock.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index ad0b6be889c..052af08e377 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -2,7 +2,7 @@ name: "Lock closed issues and PR's" on: schedule: - - cron: "0 * * * *" + - cron: "0 0 1 1 1" concurrency: group: lock @@ -20,4 +20,4 @@ jobs: issue-inactive-days: "14" issue-lock-reason: "" pr-inactive-days: "1" - pr-lock-reason: "" \ No newline at end of file + pr-lock-reason: "" From af0a6f39a92772f444a3c00338b9db6afea065b1 Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 5 Apr 2022 21:44:46 +0800 Subject: [PATCH 016/140] Update validate.yml --- .github/workflows/validate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index efea8e4925c..309b76f5c81 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -8,7 +8,7 @@ on: branches: - main schedule: - - cron: "0 0 * * *" + - cron: "0 0 1 1 1" jobs: validate-hassfest: @@ -81,4 +81,4 @@ jobs: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_ACTION_FAILURE }} uses: Ilshidur/action-discord@0.3.2 with: - args: "[Scheduled action failed!](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})" \ No newline at end of file + args: "[Scheduled action failed!](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})" From 5aa7be14d84299a4224457999cb6c007dcbd773b Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 22 Apr 2022 00:54:13 +0800 Subject: [PATCH 017/140] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index a905f3b7cef..d734c9f088a 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,10 @@ wget -O - https://cdn.jsdelivr.net/gh/hasscc/get@main/get | HUB_DOMAIN=ghproxy.c - [极速版和官方HACS的差别有那些?](https://github.com/hacs-china/integration/compare/main...china) +------ + +## 🎉 `Hassio`/`Supervisor`加载项(`Add-ons`)商店镜像:https://gitee.com/hassio 🎉 + ------ From 3b1c3c8768ea8484086a245babf2f7623f6c10cd Mon Sep 17 00:00:00 2001 From: Alone Date: Sat, 21 May 2022 02:14:27 +0800 Subject: [PATCH 018/140] Set experimental enabled by default --- custom_components/hacs/utils/configuration_schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/hacs/utils/configuration_schema.py b/custom_components/hacs/utils/configuration_schema.py index 268fc4ce64d..e1deb20f270 100644 --- a/custom_components/hacs/utils/configuration_schema.py +++ b/custom_components/hacs/utils/configuration_schema.py @@ -41,7 +41,7 @@ def hacs_config_option_schema(options: dict = {}) -> dict: APPDAEMON: False, COUNTRY: "ALL", DEBUG: False, - EXPERIMENTAL: False, + EXPERIMENTAL: True, NETDAEMON: False, RELEASE_LIMIT: 5, SIDEPANEL_ICON: "hacs:hacs", From 155528d6fd4947945b3fc8ea8385a6dc1a771d24 Mon Sep 17 00:00:00 2001 From: Alone Date: Sat, 21 May 2022 02:24:15 +0800 Subject: [PATCH 019/140] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d734c9f088a..41502bd8f0e 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,13 @@ ### 使用命令行安装(推荐) ```bash -wget -O - https://cdn.jsdelivr.net/gh/hasscc/get@main/get | DOMAIN=hacs REPO_PATH=hacs-china/integration ARCHIVE_TAG=china bash - +wget -O - https://raw.githubusercontent.com/hasscc/get/main/get | DOMAIN=hacs REPO_PATH=hacs-china/integration ARCHIVE_TAG=china bash - ``` > 如果上面的命令执行后卡住不动,或没有提示安装成功,请尝试下面的命令 ```bash -wget -O - https://cdn.jsdelivr.net/gh/hasscc/get@main/get | HUB_DOMAIN=ghproxy.com/github.com DOMAIN=hacs REPO_PATH=hacs-china/integration ARCHIVE_TAG=china bash - +wget -O - https://ghproxy.com/raw.githubusercontent.com/hasscc/get/main/get | HUB_DOMAIN=ghproxy.com/github.com DOMAIN=hacs REPO_PATH=hacs-china/integration ARCHIVE_TAG=china bash - ``` - 如果是haos/hassio/supervisor版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 From 79b034def16b84f6ec4ffa76bfc972939d32c8a0 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 2 Jun 2022 01:13:25 +0800 Subject: [PATCH 020/140] Set experimental enabled by default --- custom_components/hacs/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 7ecd234de3c..4673f6e389e 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -109,7 +109,7 @@ class HacsConfiguration: country: str = "ALL" debug: bool = False dev: bool = False - experimental: bool = False + experimental: bool = True frontend_repo_url: str = "" frontend_repo: str = "" netdaemon_path: str = "netdaemon/apps/" From f2a3303a067450aa7a2b7cbd572437c293b18606 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 2 Jun 2022 01:30:52 +0800 Subject: [PATCH 021/140] Remove hacs/integration on startup --- custom_components/hacs/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 4673f6e389e..ba9c96d9d03 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -587,6 +587,9 @@ async def startup_tasks(self, _=None) -> None: self.set_stage(HacsStage.STARTUP) try: + repo_hacs = self.repositories.get_by_full_name('hacs/integration') + if isinstance(repo_hacs, HacsRepository): + repo_hacs.remove() repository = self.repositories.get_by_full_name(HacsGitHubRepo.INTEGRATION) if repository is None: await self.async_register_repository( From 0b8b5db2a9602004b61d69667f139b52f5648141 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 2 Jun 2022 01:49:12 +0800 Subject: [PATCH 022/140] Remove hacs/integration --- custom_components/hacs/base.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index ba9c96d9d03..a302675450c 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -587,9 +587,6 @@ async def startup_tasks(self, _=None) -> None: self.set_stage(HacsStage.STARTUP) try: - repo_hacs = self.repositories.get_by_full_name('hacs/integration') - if isinstance(repo_hacs, HacsRepository): - repo_hacs.remove() repository = self.repositories.get_by_full_name(HacsGitHubRepo.INTEGRATION) if repository is None: await self.async_register_repository( @@ -842,6 +839,11 @@ async def async_get_category_repositories(self, category: HacsCategory) -> None: ) ) + # remove original hacs + repo_hacs = self.repositories.get_by_full_name('hacs/integration') + if isinstance(repo_hacs, HacsRepository): + repo_hacs.remove() + async def async_update_all_repositories(self, _=None) -> None: """Update all repositories.""" if self.system.disabled: From 3b1e2f10aad404f40f6cc57dce6c3b203a3b1ff8 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 2 Jun 2022 19:16:48 +0800 Subject: [PATCH 023/140] Remove hacs/integration --- custom_components/hacs/base.py | 5 ----- custom_components/hacs/repositories/integration.py | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index a302675450c..4673f6e389e 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -839,11 +839,6 @@ async def async_get_category_repositories(self, category: HacsCategory) -> None: ) ) - # remove original hacs - repo_hacs = self.repositories.get_by_full_name('hacs/integration') - if isinstance(repo_hacs, HacsRepository): - repo_hacs.remove() - async def async_update_all_repositories(self, _=None) -> None: """Update all repositories.""" if self.system.disabled: diff --git a/custom_components/hacs/repositories/integration.py b/custom_components/hacs/repositories/integration.py index 31592fb82b3..7ad7ab3f813 100644 --- a/custom_components/hacs/repositories/integration.py +++ b/custom_components/hacs/repositories/integration.py @@ -138,6 +138,12 @@ async def update_repository(self, ignore_issues=False, force=False): }, ) + # remove original hacs + if self.data.full_name in ['hacs/integration']: + repo_hacs = self.hacs.repositories.get_by_full_name(self.data.full_name) + if isinstance(repo_hacs, HacsRepository): + repo_hacs.remove() + async def reload_custom_components(self): """Reload custom_components (and config flows)in HA.""" self.logger.info("Reloading custom_component cache") From e18cefadf905b610fb938562292b44eddf931ffa Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 6 Jul 2022 17:14:15 +0800 Subject: [PATCH 024/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Update=20rea?= =?UTF-8?q?dme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 41502bd8f0e..398d808dd79 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ wget -O - https://ghproxy.com/raw.githubusercontent.com/hasscc/get/main/get | HU - docker安装的HA为`-v`参数后面映射的目录 - 在HA配置目录下创建`custom_components`文件夹 (如果已有请忽略) - 在`custom_components`目录下创建`hacs`文件夹 (如果已有请删除重新创建) -- 將解压出来的hacs文件复制到刚创建的`hacs`文件夹 +- 將解压出来的文件复制到刚创建的`hacs`文件夹 - 重启HA - [添加HACS集成](https://my.home-assistant.io/redirect/config_flow_start/?domain=hacs) (仅首次安装) From a20d7a176805d196b40d7613fcd98572fa1fccb9 Mon Sep 17 00:00:00 2001 From: Alone Date: Mon, 17 Oct 2022 22:59:02 +0800 Subject: [PATCH 025/140] =?UTF-8?q?=F0=9F=8E=89=20Add=20support=20Github?= =?UTF-8?q?=20API=20mirror?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/__init__.py | 1 + custom_components/hacs/base.py | 1 + custom_components/hacs/translations/en.json | 3 ++- custom_components/hacs/translations/zh-Hans.json | 3 ++- custom_components/hacs/utils/configuration_schema.py | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/custom_components/hacs/__init__.py b/custom_components/hacs/__init__.py index ea831bb1988..96959188fce 100644 --- a/custom_components/hacs/__init__.py +++ b/custom_components/hacs/__init__.py @@ -118,6 +118,7 @@ async def async_initialize_integration( token=hacs.configuration.token, session=clientsession, **{"client_name": f"HACS/{hacs.version}"}, + **{"base_url": hacs.configuration.github_api_base, "timeout": 30}, ) async def async_startup(): diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index bce2ea142e2..ef76cd91947 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -123,6 +123,7 @@ class HacsConfiguration: theme_path: str = "themes/" theme: bool = False token: str = None + github_api_base: str = None def to_json(self) -> str: """Return a json string.""" diff --git a/custom_components/hacs/translations/en.json b/custom_components/hacs/translations/en.json index 7cf9717c731..11c0d549ba3 100644 --- a/custom_components/hacs/translations/en.json +++ b/custom_components/hacs/translations/en.json @@ -49,7 +49,8 @@ "appdaemon": "Enable AppDaemon apps discovery & tracking", "netdaemon": "Enable NetDaemon apps discovery & tracking", "sidepanel_icon": "Side panel icon", - "sidepanel_title": "Side panel title" + "sidepanel_title": "Side panel title", + "github_api_base": "Github API Base (default: https://api.github.com)" } } } diff --git a/custom_components/hacs/translations/zh-Hans.json b/custom_components/hacs/translations/zh-Hans.json index 713fa4d079d..ccaca621c49 100644 --- a/custom_components/hacs/translations/zh-Hans.json +++ b/custom_components/hacs/translations/zh-Hans.json @@ -45,7 +45,8 @@ "appdaemon": "启用 AppDaemon 应用发现 & 追踪", "netdaemon": "启用 NetDaemon 应用发现 & 追踪", "sidepanel_icon": "侧边栏图标", - "sidepanel_title": "侧边栏标题" + "sidepanel_title": "侧边栏标题", + "github_api_base": "Github API根路径 (默认: https://api.github.com)" } } } diff --git a/custom_components/hacs/utils/configuration_schema.py b/custom_components/hacs/utils/configuration_schema.py index e1deb20f270..346570de582 100644 --- a/custom_components/hacs/utils/configuration_schema.py +++ b/custom_components/hacs/utils/configuration_schema.py @@ -54,6 +54,7 @@ def hacs_config_option_schema(options: dict = {}) -> dict: vol.Optional(SIDEPANEL_ICON, default=options.get(SIDEPANEL_ICON)): str, vol.Optional(RELEASE_LIMIT, default=options.get(RELEASE_LIMIT)): int, vol.Optional(COUNTRY, default=options.get(COUNTRY)): vol.In(LOCALE), + vol.Optional("github_api_base", default=options.get("github_api_base", "")): str, vol.Optional(APPDAEMON, default=options.get(APPDAEMON)): bool, vol.Optional(NETDAEMON, default=options.get(NETDAEMON)): bool, vol.Optional(DEBUG, default=options.get(DEBUG)): bool, From 5e48c4970c0940121524baba83edcdbba8f1a50a Mon Sep 17 00:00:00 2001 From: Alone Date: Mon, 17 Oct 2022 23:10:32 +0800 Subject: [PATCH 026/140] =?UTF-8?q?=F0=9F=97=91=EF=B8=8F=20Remove=20mirror?= =?UTF-8?q?.ghproxy.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/base.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index ef76cd91947..138375ab6fc 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -686,13 +686,6 @@ async def async_download_file(self, url: str, *, headers: dict | None = None) -> "release": "https://ghproxy.com/github.com", }, - # https://mirror.ghproxy.com - "ghproxy2": { - "raw": "https://mirror.ghproxy.com/raw.githubusercontent.com", - "archive": "https://mirror.ghproxy.com/github.com", - "release": "https://mirror.ghproxy.com/github.com", - }, - # https://doc.fastgit.org/zh-cn/node.html "fastgit": { "raw": "https://raw.fastgit.org", From d808cd0a2552505f5ad896b012232cf1d2517157 Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 18 Oct 2022 14:43:52 +0800 Subject: [PATCH 027/140] =?UTF-8?q?=F0=9F=8E=89=20Add=20support=20Github?= =?UTF-8?q?=20API=20mirror?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/__init__.py | 1 + custom_components/hacs/repositories/base.py | 3 ++- custom_components/hacs/system_health.py | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/custom_components/hacs/__init__.py b/custom_components/hacs/__init__.py index 96959188fce..5f0add322f8 100644 --- a/custom_components/hacs/__init__.py +++ b/custom_components/hacs/__init__.py @@ -111,6 +111,7 @@ async def async_initialize_integration( "User-Agent": f"HACS/{hacs.version}", "Accept": ACCEPT_HEADERS["preview"], }, + base_url=hacs.configuration.github_api_base, ) ## New GitHub client diff --git a/custom_components/hacs/repositories/base.py b/custom_components/hacs/repositories/base.py index ed4517b5ff4..3a8a2c6b22f 100644 --- a/custom_components/hacs/repositories/base.py +++ b/custom_components/hacs/repositories/base.py @@ -597,7 +597,8 @@ async def download_repository_zip(self): if not ref: raise HacsException("Missing required elements.") - url = f"{BASE_API_URL}/repos/{self.data.full_name}/zipball/{ref}" + api_base = self.hacs.configuration.github_api_base or BASE_API_URL + url = f"{api_base}/repos/{self.data.full_name}/zipball/{ref}" filecontent = await self.hacs.async_download_file( url, diff --git a/custom_components/hacs/system_health.py b/custom_components/hacs/system_health.py index af970467760..904c79d5d2a 100644 --- a/custom_components/hacs/system_health.py +++ b/custom_components/hacs/system_health.py @@ -20,9 +20,10 @@ async def system_health_info(hass): """Get info for the info page.""" hacs: HacsBase = hass.data[DOMAIN] response = await hacs.githubapi.rate_limit() + api_url = hacs.configuration.github_api_base or BASE_API_URL data = { - "GitHub API": system_health.async_check_can_reach_url(hass, BASE_API_URL, GITHUB_STATUS), + "GitHub API": system_health.async_check_can_reach_url(hass, api_url, api_url), "GitHub Content": system_health.async_check_can_reach_url( hass, "https://raw.githubusercontent.com/hacs/integration/main/hacs.json" ), From 27b7d6889946d2b269a70e89b575e9f3c4003a12 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 20 Oct 2022 10:17:23 +0800 Subject: [PATCH 028/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20suppor?= =?UTF-8?q?t=20Chinese=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/repositories/base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/custom_components/hacs/repositories/base.py b/custom_components/hacs/repositories/base.py index 3a8a2c6b22f..bec6ed8a506 100644 --- a/custom_components/hacs/repositories/base.py +++ b/custom_components/hacs/repositories/base.py @@ -663,6 +663,12 @@ def _info_file_variants() -> tuple[str, ...]: else "info" ) return ( + f"{name.upper()}_zh-Hans.md", + f"{name.lower()}_zh-Hans.md", + f"{name.upper()}_zh-CN.md", + f"{name.lower()}_zh-CN.md", + f"{name.upper()}_zh.md", + f"{name.lower()}_zh.md", f"{name.upper()}.md", f"{name}.md", f"{name}.MD", From becd104ebfe2f5251064b46e294c5e5f4ec92965 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 20 Oct 2022 10:26:00 +0800 Subject: [PATCH 029/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20suppor?= =?UTF-8?q?t=20Chinese=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/repositories/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_components/hacs/repositories/base.py b/custom_components/hacs/repositories/base.py index bec6ed8a506..4f6a4055755 100644 --- a/custom_components/hacs/repositories/base.py +++ b/custom_components/hacs/repositories/base.py @@ -669,6 +669,8 @@ def _info_file_variants() -> tuple[str, ...]: f"{name.lower()}_zh-CN.md", f"{name.upper()}_zh.md", f"{name.lower()}_zh.md", + f"{name.upper()}_hans.md", + f"{name.lower()}_hans.md", f"{name.upper()}.md", f"{name}.md", f"{name}.MD", From 92920e310e8cce52aa67047e6af1fee640844e33 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 20 Oct 2022 11:18:59 +0800 Subject: [PATCH 030/140] =?UTF-8?q?=F0=9F=93=9A=20update=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 398d808dd79..6da401f6968 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ [HACS](https://hacs.xyz)是一款优秀的 [Home Assistant](https://www.home-assistant.io) 集成商店,然而国人想要使用它下载插件或前端卡片却困难重重,主要原因就是国内的网络环境。 本项目使用了[ghproxy.com](https://ghproxy.com)和[fastgit.org](https://fastgit.org)提供的Github镜像服务,可以让大家更快的下载商店里的插件。 + ## 安装 > 本项目是HACS官方集成的修改版,安装本项目版本会覆盖官方的集成,但是无需重新配置集成(共用一套配置),因此你可以放心安装。如果想切换到官方版本,使用官方的shell命令再安装即可。 @@ -44,7 +45,40 @@ wget -O - https://ghproxy.com/raw.githubusercontent.com/hasscc/get/main/get | HU > ![download hacs](https://user-images.githubusercontent.com/4549099/157629602-422a7bbe-7588-4a81-803e-b295491d78fe.png) -### 常见问题 + +## 镜像 + +> **Note** +> +> 自v1.27.1.3开始,HACS极速版支持自定义Github API镜像,如果你的HACS无法加载集成列表和集成详情,修改此选项会有所改善。 +> 此前的版本仅能解决集成下载不了,而该版本后能解决大部分Github访问不了导致的大部分问题。 +> +> 不过遗憾的是,首次安装HACS时的授权过程仍然还不能被加速,如果你在授权过程中一直转圈,请稍后再试或使用其他科学的方式。 + +- 社区提供的免费镜像: + - `https://ghapi-cf.hacs.vip/api` - [@al-one](https://github.com/al-one) + - `https://hacs-china.chrome7.com/api` - [@goxofy](https://github.com/goxofy) + - `https://cn.hacs.tk/api` - [@cheny95](https://github.com/cheny95) + - `https://hacs.liangshe.ng/api` - [@louliangsheng](https://github.com/louliangsheng) + - `https://hacs-china.casen.tk/api` - [@CasenChan](https://github.com/CasenChan) + +> **Note** +> +> 以上镜像由贡献者免费提供,是由`Cloudflare Worker`搭建,每个镜像每天有10万次请求次数限制,请随机使用上面的镜像。 +> 我们建议你使用自己的域名创建镜像,当然也可以使用[`freenom.com`](https://freenom.com)的免费域名。 + +- 创建自己的镜像: + - 登陆或注册`Cloudflare`添加自己的域名,并修改域名的NS记录 + - [创建`Worker`服务](https://dash.cloudflare.com/?account=workers),选择`HTTP 处理程序` + - 复制[`index.js`](https://raw.githubusercontent.com/hacs-china/gh-proxy/master/index.js)中的代码,并张贴至Worker的代码编辑器中 + - 部署并在触发器中添加自定义域名,Worker分配的域名是无法被访问的 + - 访问`https://your.mirror.domain/api/`检查是都生效 + - 在HA的集成与服务页面找到已添加的HACS,点击`选项` + - 填入镜像地址`https://your.mirror.domain/api` + + + +## 常见问题 - [极速版和官方HACS的差别有那些?](https://github.com/hacs-china/integration/compare/main...china) From d0df936422e2378b5c16cd61df525bb02d1d6961 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 20 Oct 2022 11:23:26 +0800 Subject: [PATCH 031/140] =?UTF-8?q?=F0=9F=93=9A=20update=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6da401f6968..2d94f843d56 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ wget -O - https://ghproxy.com/raw.githubusercontent.com/hasscc/get/main/get | HU - [创建`Worker`服务](https://dash.cloudflare.com/?account=workers),选择`HTTP 处理程序` - 复制[`index.js`](https://raw.githubusercontent.com/hacs-china/gh-proxy/master/index.js)中的代码,并张贴至Worker的代码编辑器中 - 部署并在触发器中添加自定义域名,Worker分配的域名是无法被访问的 - - 访问`https://your.mirror.domain/api/`检查是都生效 + - 访问`https://your.mirror.domain/api/`检查是否生效 - 在HA的集成与服务页面找到已添加的HACS,点击`选项` - 填入镜像地址`https://your.mirror.domain/api` From b1af423bea0cbc217c1440023d5de557b31165d6 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 20 Oct 2022 11:26:53 +0800 Subject: [PATCH 032/140] =?UTF-8?q?=F0=9F=93=9A=20update=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d94f843d56..b1b632f6c12 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ wget -O - https://ghproxy.com/raw.githubusercontent.com/hasscc/get/main/get | HU > 我们建议你使用自己的域名创建镜像,当然也可以使用[`freenom.com`](https://freenom.com)的免费域名。 - 创建自己的镜像: - - 登陆或注册`Cloudflare`添加自己的域名,并修改域名的NS记录 + - 登陆或注册[`Cloudflare`](https://cloudflare.com)添加自己的域名,并修改域名的NS记录 - [创建`Worker`服务](https://dash.cloudflare.com/?account=workers),选择`HTTP 处理程序` - 复制[`index.js`](https://raw.githubusercontent.com/hacs-china/gh-proxy/master/index.js)中的代码,并张贴至Worker的代码编辑器中 - 部署并在触发器中添加自定义域名,Worker分配的域名是无法被访问的 From 771f769a56ddcd165ef1efaf662619e02b07b728 Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 2 Nov 2022 15:21:33 +0800 Subject: [PATCH 033/140] =?UTF-8?q?=F0=9F=93=9A=20update=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b1b632f6c12..920002882c2 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,13 @@ ### 使用命令行安装(推荐) ```bash -wget -O - https://raw.githubusercontent.com/hasscc/get/main/get | DOMAIN=hacs REPO_PATH=hacs-china/integration ARCHIVE_TAG=china bash - +wget -O - https://hacs.vip/get | bash - ``` > 如果上面的命令执行后卡住不动,或没有提示安装成功,请尝试下面的命令 ```bash -wget -O - https://ghproxy.com/raw.githubusercontent.com/hasscc/get/main/get | HUB_DOMAIN=ghproxy.com/github.com DOMAIN=hacs REPO_PATH=hacs-china/integration ARCHIVE_TAG=china bash - +wget -O - https://hacs.vip/get | HUB_DOMAIN=ghproxy.com/github.com bash - ``` - 如果是haos/hassio/supervisor版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 From b53e18f7d036a28590f99d75b1a1339f100fbf6d Mon Sep 17 00:00:00 2001 From: Alone Date: Sun, 15 Jan 2023 17:03:49 +0800 Subject: [PATCH 034/140] =?UTF-8?q?=F0=9F=92=BC=20Improve=20for=20recuring?= =?UTF-8?q?=20tasks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index d595089c6d3..3ea06156851 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -634,7 +634,7 @@ async def startup_tasks(self, _=None) -> None: ) self.recuring_tasks.append( self.hass.helpers.event.async_track_time_interval( - self.async_update_all_repositories, timedelta(hours=96) + self.async_update_all_repositories, timedelta(hours=50) ) ) self.recuring_tasks.append( @@ -649,7 +649,7 @@ async def startup_tasks(self, _=None) -> None: ) self.recuring_tasks.append( self.hass.helpers.event.async_track_time_interval( - self.async_update_downloaded_repositories, timedelta(hours=48) + self.async_update_downloaded_repositories, timedelta(hours=6) ) ) self.recuring_tasks.append( From 639c03bd13e8283d0ec33f84ccabe83a6646edb6 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 2 Feb 2023 11:33:45 +0800 Subject: [PATCH 035/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Change=20Rep?= =?UTF-8?q?ository=20ID=20for=20hacs-china?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/hacs/const.py b/custom_components/hacs/const.py index 39491af9f13..8eb0ce61d3e 100644 --- a/custom_components/hacs/const.py +++ b/custom_components/hacs/const.py @@ -17,7 +17,7 @@ DEFAULT_CONCURRENT_TASKS = 15 DEFAULT_CONCURRENT_BACKOFF_TIME = 1 -HACS_REPOSITORY_ID = "172733314" +HACS_REPOSITORY_ID = "463389296" # 172733314 HACS_ACTION_GITHUB_API_HEADERS = { "User-Agent": "HACS/action", From 0f369fe0660b4d81d4a4f74aa915e27a14941ea7 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 2 Feb 2023 18:06:25 +0800 Subject: [PATCH 036/140] =?UTF-8?q?=F0=9F=93=A4=20Add=20commit=20hacs=20da?= =?UTF-8?q?ta=20to=20github?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/generate-hacs-data.yml | 37 +++++++----------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/.github/workflows/generate-hacs-data.yml b/.github/workflows/generate-hacs-data.yml index e15654a856d..8169c9b883a 100644 --- a/.github/workflows/generate-hacs-data.yml +++ b/.github/workflows/generate-hacs-data.yml @@ -20,7 +20,7 @@ concurrency: jobs: category-data: runs-on: ubuntu-latest - if: github.repository == 'hacs/integration' + if: github.repository == 'hacs-china/integration' name: Generate ${{ matrix.category }} data strategy: matrix: @@ -86,30 +86,15 @@ jobs: if-no-files-found: error retention-days: 7 - - name: Upload to R2 - if: steps.updated.outputs.updated == 'true' - run: | - aws s3 sync \ - outputdata/${{ matrix.category }} \ - s3://data-v2/${{ matrix.category }} \ - --endpoint-url ${{ secrets.CF_R2_ENDPOINT_DATA }} + - name: Commit to Github env: - AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }} - - - name: Bust Cloudflare cache - if: steps.updated.outputs.updated == 'true' - run: | - curl --silent --show-error --fail -X POST \ - "https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE_ID }}/purge_cache" \ - -H "Authorization: Bearer ${{ secrets.CF_BUST_CACHE_TOKEN }}" \ - -H "Content-Type: application/json" \ - --data '{"files": ["https:\/\/data-v2.hacs.xyz\/${{ matrix.category }}\/data.json", "https:\/\/data-v2.hacs.xyz\/${{ matrix.category }}\/repositories.json"]}' - - - name: Discord notification - if: ${{ github.event_name == 'schedule' && failure() }} + GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }} run: | - curl \ - -H "Content-Type: application/json" \ - -d '{"username": "GitHub action failure", "content": "[Scheduled action failed!](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})"}' \ - ${{ secrets.DISCORD_WEBHOOK_ACTION_FAILURE }} + git config --global user.name github-actions + git config --global user.email github-actions@github.com + git clone https://x-access-token:$GITHUB_TOKEN@github.com/hacs-china/data.git ../hacs-data + cp -rf outputdata/${{ matrix.category }} ../hacs-data/ + cd ../hacs-data + git add -A . + git commit -m "Generated hacs ${{ matrix.category }} data" + git push -u https://x-access-token:$GITHUB_TOKEN@github.com/hacs-china/data.git main From 95ee55543c277faf6e161b0f1387c1c4fc8b5302 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 3 Feb 2023 11:06:01 +0800 Subject: [PATCH 037/140] =?UTF-8?q?=F0=9F=93=A4=20Add=20commit=20hacs=20da?= =?UTF-8?q?ta=20to=20github?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/generate-hacs-data.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generate-hacs-data.yml b/.github/workflows/generate-hacs-data.yml index 8169c9b883a..9a2d87f8485 100644 --- a/.github/workflows/generate-hacs-data.yml +++ b/.github/workflows/generate-hacs-data.yml @@ -46,7 +46,7 @@ jobs: requirements_generate_data.txt - name: Install dependencies - run: | + run: | bash manage/install_frontend pip3 install \ --disable-pip-version-check install \ @@ -55,6 +55,10 @@ jobs: --requirement requirements_generate_data.txt \ --use-deprecated=legacy-resolver + - name: Check API rate limit + run: | + curl -H "Authorization: Bearer ${{ secrets.DATA_GENERATOR_TOKEN }}" \ + https://api.github.com/rate_limit - name: Generate ${{ matrix.category }} data run: python3 -m scripts.data.generate_category_data ${{ matrix.category }} From 274aae280e5c23f1235f712a0dff90951a37670e Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 3 Feb 2023 11:23:52 +0800 Subject: [PATCH 038/140] =?UTF-8?q?=F0=9F=93=A4=20Add=20commit=20hacs=20da?= =?UTF-8?q?ta=20to=20github?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload-critical-removed.yml | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/upload-critical-removed.yml diff --git a/.github/workflows/upload-critical-removed.yml b/.github/workflows/upload-critical-removed.yml new file mode 100644 index 00000000000..6da8e2f17c3 --- /dev/null +++ b/.github/workflows/upload-critical-removed.yml @@ -0,0 +1,69 @@ +name: Upload critical & removed data + +on: + workflow_dispatch: + schedule: + - cron: "0 */1 * * *" + +concurrency: + group: category-data + +jobs: + category-data: + runs-on: ubuntu-latest + name: Upload ${{ matrix.category }} data + strategy: + matrix: + category: + - critical + - removed + steps: + - name: Set up Python + uses: actions/setup-python@v4.5.0 + id: python + with: + python-version: "3.x" + + - name: Handle the ${{ matrix.category }} file + run: | + mkdir -p outputdata/${{ matrix.category }} + wget https://raw.githubusercontent.com/hacs/default/master/${{ matrix.category }} + jq -c . < ${{ matrix.category }} > outputdata/${{ matrix.category }}/data.json + jq -c '[.[].repository]' < ${{ matrix.category }} > outputdata/${{ matrix.category }}/repositories.json + + - name: Check if updated + id: updated + run: | + if test -f "outputdata/${{ matrix.category }}/data.json"; then + echo "updated=true" >> "$GITHUB_OUTPUT" + else + echo "updated=false" >> "$GITHUB_OUTPUT" + fi + + - name: Validate output with JQ + if: steps.updated.outputs.updated == 'true' + run: | + jq -c . outputdata/${{ matrix.category }}/data.json + jq -c . outputdata/${{ matrix.category }}/repositories.json + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + if: steps.updated.outputs.updated == 'true' + with: + name: ${{ matrix.category }} + path: outputdata/${{ matrix.category }} + if-no-files-found: error + retention-days: 7 + + - name: Commit to Github + env: + GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }} + run: | + git config --global user.name github-actions + git config --global user.email github-actions@github.com + git clone https://x-access-token:$GITHUB_TOKEN@github.com/hacs-china/data.git ../hacs-data + cp -rf outputdata/${{ matrix.category }} ../hacs-data/ + cd ../hacs-data + git add -A . + git commit -m "Update hacs ${{ matrix.category }} data" + git push -u https://x-access-token:$GITHUB_TOKEN@github.com/hacs-china/data.git main From 81624bce6d92937603ffc8b7e1a63504e7b24568 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 3 Feb 2023 11:26:42 +0800 Subject: [PATCH 039/140] =?UTF-8?q?=F0=9F=93=A4=20Add=20commit=20hacs=20da?= =?UTF-8?q?ta=20to=20github?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload-critical-removed.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/upload-critical-removed.yml b/.github/workflows/upload-critical-removed.yml index 6da8e2f17c3..f2bf4509a2b 100644 --- a/.github/workflows/upload-critical-removed.yml +++ b/.github/workflows/upload-critical-removed.yml @@ -6,10 +6,10 @@ on: - cron: "0 */1 * * *" concurrency: - group: category-data + group: hacs-default-data jobs: - category-data: + hacs-default-data: runs-on: ubuntu-latest name: Upload ${{ matrix.category }} data strategy: From d56c0293fc2ab3bea16f18fde1637ceef192d48d Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 3 Feb 2023 12:31:23 +0800 Subject: [PATCH 040/140] =?UTF-8?q?=F0=9F=93=A4=20Add=20commit=20hacs=20da?= =?UTF-8?q?ta=20to=20github?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload-critical-removed.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/upload-critical-removed.yml b/.github/workflows/upload-critical-removed.yml index f2bf4509a2b..d841f7c6670 100644 --- a/.github/workflows/upload-critical-removed.yml +++ b/.github/workflows/upload-critical-removed.yml @@ -57,13 +57,18 @@ jobs: - name: Commit to Github env: - GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }} + GITHUB_TOKEN: x-access-token:${{ secrets.API_TOKEN_GITHUB }} run: | git config --global user.name github-actions git config --global user.email github-actions@github.com - git clone https://x-access-token:$GITHUB_TOKEN@github.com/hacs-china/data.git ../hacs-data + git clone https://$GITHUB_TOKEN@github.com/hacs-china/data.git ../hacs-data cp -rf outputdata/${{ matrix.category }} ../hacs-data/ cd ../hacs-data git add -A . - git commit -m "Update hacs ${{ matrix.category }} data" - git push -u https://x-access-token:$GITHUB_TOKEN@github.com/hacs-china/data.git main + if git status | grep -q "Changes to be committed" + then + git commit -m "Update hacs ${{ matrix.category }} data" + git push -u https://$GITHUB_TOKEN@github.com/hacs-china/data.git main + else + echo "No changes detected" + fi From 420862c17c52aeb2ace2b470ee9dfc4f346c4fcf Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 10 Feb 2023 11:38:53 +0800 Subject: [PATCH 041/140] =?UTF-8?q?=F0=9F=93=A4=20Add=20commit=20hacs=20da?= =?UTF-8?q?ta=20to=20github?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload-critical-removed.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upload-critical-removed.yml b/.github/workflows/upload-critical-removed.yml index d841f7c6670..230fd2b9ce9 100644 --- a/.github/workflows/upload-critical-removed.yml +++ b/.github/workflows/upload-critical-removed.yml @@ -3,7 +3,7 @@ name: Upload critical & removed data on: workflow_dispatch: schedule: - - cron: "0 */1 * * *" + - cron: "0 */12 * * *" concurrency: group: hacs-default-data From 9c947e3f2c88f1eaf70daf39d7cb7b526820c058 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 14 Apr 2023 14:15:43 +0800 Subject: [PATCH 042/140] Update generate-hacs-data.yml --- .github/workflows/generate-hacs-data.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-hacs-data.yml b/.github/workflows/generate-hacs-data.yml index 9a2d87f8485..9b658b8d278 100644 --- a/.github/workflows/generate-hacs-data.yml +++ b/.github/workflows/generate-hacs-data.yml @@ -12,7 +12,7 @@ on: - "False" - "True" schedule: - - cron: "0 */2 * * *" + - cron: "0 0 1 1 *" concurrency: group: category-data From 5102ec38067484bb048554715c6933a6858e85a7 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 9 Nov 2023 11:36:03 +0800 Subject: [PATCH 043/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20more?= =?UTF-8?q?=20proxies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++------- custom_components/hacs/base.py | 38 +++++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a5e92526d34..6dc3dd7ec32 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![stars](https://img.shields.io/github/stars/hacs-china/integration)](https://github.com/hacs-china/integration/stargazers) [HACS](https://hacs.xyz)是一款优秀的 [Home Assistant](https://www.home-assistant.io) 集成商店,然而国人想要使用它下载插件或前端卡片却困难重重,主要原因就是国内的网络环境。 -本项目使用了[ghproxy.com](https://ghproxy.com)和[fastgit.org](https://fastgit.org)提供的Github镜像服务,可以让大家更快的下载商店里的插件。 +本项目使用了[gitmirror.com](https://gitmirror.com)和[fastgit.org](https://fastgit.org)等提供的Github镜像服务,可以让大家更快的下载商店里的插件。 ## 安装 @@ -15,13 +15,7 @@ ### 使用命令行安装(推荐) ```bash -wget -O - https://hacs.vip/get | bash - -``` - -> 如果上面的命令执行后卡住不动,或没有提示安装成功,请尝试下面的命令 - -```bash -wget -O - https://hacs.vip/get | HUB_DOMAIN=ghproxy.com/github.com bash - +wget -O - https://hacs.vip/get | HUB_DOMAIN=ghps.cc/github.com bash - ``` - 如果是haos/hassio/supervisor版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index fa2064b420a..a377609d1c3 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -696,11 +696,25 @@ async def async_download_file(self, url: str, *, headers: dict | None = None) -> return None mirrors = { - # https://ghproxy.com - "ghproxy": { - "raw": "https://ghproxy.com/raw.githubusercontent.com", - "archive": "https://ghproxy.com/github.com", - "release": "https://ghproxy.com/github.com", + # https://gitmirror.com + "gitmirror": { + "raw": "https://raw.gitmirror.com", + "archive": "https://hub.gitmirror.com/github.com", + "release": "https://hub.gitmirror.com/github.com", + }, + + # https://ghps.cc + "ghps": { + "raw": "https://ghps.cc/raw.githubusercontent.com", + "archive": "https://ghps.cc/github.com", + "release": "https://ghps.cc/github.com", + }, + + # https://gh.ddlc.top + "ddlc": { + "raw": "https://gh.ddlc.top/raw.githubusercontent.com", + "archive": "https://gh.ddlc.top/github.com", + "release": "https://gh.ddlc.top/github.com", }, # https://doc.fastgit.org/zh-cn/node.html @@ -709,6 +723,20 @@ async def async_download_file(self, url: str, *, headers: dict | None = None) -> "archive": "https://hub.fastgit.xyz", "release": "https://hub.fastgit.xyz", }, + + # https://ghproxy.com + "ghproxy": { + "raw": "https://ghproxy.com/raw.githubusercontent.com", + "archive": "https://ghproxy.com/github.com", + "release": "https://ghproxy.com/github.com", + }, + + # https://github.com + "github": { + "raw": "https://raw.githubusercontent.com", + "archive": "https://github.com", + "release": "https://github.com", + }, } tries_keys = list(mirrors.keys()) From 22e5d4eebc51f117d10ee5a3057cc66733cf66bd Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 9 Nov 2023 11:50:28 +0800 Subject: [PATCH 044/140] =?UTF-8?q?=E2=9A=97=EF=B8=8F=20Set=20experimental?= =?UTF-8?q?=20enabled=20by=20default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/config_flow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/hacs/config_flow.py b/custom_components/hacs/config_flow.py index c7698869476..1058e860997 100644 --- a/custom_components/hacs/config_flow.py +++ b/custom_components/hacs/config_flow.py @@ -134,7 +134,7 @@ async def _show_config_form(self, user_input): ): bool, vol.Required("acc_disable", default=user_input.get("acc_disable", False)): bool, vol.Optional( - "experimental", default=user_input.get("experimental", False) + "experimental", default=user_input.get("experimental", True) ): bool, } ), @@ -157,7 +157,7 @@ async def async_step_device_done(self, user_input: dict[str, bool] | None = None "token": self.activation.access_token, }, options={ - "experimental": self._user_input.get("experimental", False), + "experimental": self._user_input.get("experimental", True), }, ) From b5c890777f74bbe16530de814dc6c7b0fa68f34a Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 9 Nov 2023 14:05:59 +0800 Subject: [PATCH 045/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20more?= =?UTF-8?q?=20proxies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 6dc3dd7ec32..cabd19eaf57 100644 --- a/README.md +++ b/README.md @@ -50,10 +50,9 @@ wget -O - https://hacs.vip/get | HUB_DOMAIN=ghps.cc/github.com bash - > 不过遗憾的是,首次安装HACS时的授权过程仍然还不能被加速,如果你在授权过程中一直转圈,请稍后再试或使用其他科学的方式。 - 社区提供的免费镜像: + - `https://ghapi.hacs.vip` - [@al-one](https://github.com/al-one) - `https://ghapi-cf.hacs.vip/api` - [@al-one](https://github.com/al-one) - `https://hacs-china.chrome7.com/api` - [@goxofy](https://github.com/goxofy) - - `https://cn.hacs.tk/api` - [@cheny95](https://github.com/cheny95) - - `https://hacs.liangshe.ng/api` - [@louliangsheng](https://github.com/louliangsheng) - `https://hacs-china.casen.tk/api` - [@CasenChan](https://github.com/CasenChan) > **Note** From ea26190c1968126c16f880a46862aff032f34464 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 9 Nov 2023 14:19:01 +0800 Subject: [PATCH 046/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Fix=20for=20?= =?UTF-8?q?change=20github=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/config_flow.py | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/hacs/config_flow.py b/custom_components/hacs/config_flow.py index 1058e860997..3805929de8a 100644 --- a/custom_components/hacs/config_flow.py +++ b/custom_components/hacs/config_flow.py @@ -215,6 +215,7 @@ async def async_step_user(self, user_input=None): vol.Optional(SIDEPANEL_ICON, default=hacs.configuration.sidepanel_icon): str, vol.Optional(RELEASE_LIMIT, default=hacs.configuration.release_limit): int, vol.Optional(COUNTRY, default=hacs.configuration.country): vol.In(LOCALE), + vol.Optional("github_api_base", default=hacs.configuration.github_api_base): str, vol.Optional(APPDAEMON, default=hacs.configuration.appdaemon): bool, vol.Optional(NETDAEMON, default=hacs.configuration.netdaemon): bool, vol.Optional(DEBUG, default=hacs.configuration.debug): bool, From 771400d2cafa9d4f754989828228c1c499c5392b Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 4 Jan 2024 15:16:49 +0800 Subject: [PATCH 047/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Update=20rea?= =?UTF-8?q?dme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cabd19eaf57..8ca9b50ea49 100644 --- a/README.md +++ b/README.md @@ -8,20 +8,35 @@ 本项目使用了[gitmirror.com](https://gitmirror.com)和[fastgit.org](https://fastgit.org)等提供的Github镜像服务,可以让大家更快的下载商店里的插件。 -## 安装 + +## 安装/更新 > 本项目是HACS官方集成的修改版,安装本项目版本会覆盖官方的集成,但是无需重新配置集成(共用一套配置),因此你可以放心安装。如果想切换到官方版本,使用官方的shell命令再安装即可。 +> +> 以下几种方法任选其一! -### 使用命令行安装(推荐) +#### 方法1: 使用命令行安装(推荐) -```bash -wget -O - https://hacs.vip/get | HUB_DOMAIN=ghps.cc/github.com bash - +```shell +wget -O - https://hacs.vip/get | bash - ``` - 如果是haos/hassio/supervisor版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 - 如果是core/docker版本的HA,需要ssh登陆宿主机后,并cd进入到HA配置目录再执行安装命令 -### 手动安装 +#### 方法2: `shell_command`服务 + +1. 复制代码到HA配置文件 `configuration.yaml` + ```yaml + shell_command: + update_hacs_china: |- + wget -O - https://hacs.vip/get | bash - + ``` +2. 重启HA +3. +在开发者工具中执行服务 [`service: shell_command.update_hacs_china`](https://my.home-assistant.io/redirect/developer_call_service/?service=shell_command.update_hacs_china) + +#### 方法3: 手动安装 - [点击这里下载](https://github.com/hacs-china/integration/releases/latest/download/hacs.zip)安装包并解压 (如果下载不了请点[这里](https://ghproxy.com/github.com/hacs-china/integration/releases/latest/download/hacs.zip)或[这里](https://hub.fastgit.xyz/hacs-china/integration/releases/latest/download/hacs.zip)) - 通过samba/ftp进入HA配置目录,通常为以下目录: From b88b1398afcfb5b11c45a4f8528093344c0031bd Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 4 Jan 2024 15:19:05 +0800 Subject: [PATCH 048/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Update=20rea?= =?UTF-8?q?dme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 8ca9b50ea49..1deadca03ee 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ 本项目使用了[gitmirror.com](https://gitmirror.com)和[fastgit.org](https://fastgit.org)等提供的Github镜像服务,可以让大家更快的下载商店里的插件。 - ## 安装/更新 > 本项目是HACS官方集成的修改版,安装本项目版本会覆盖官方的集成,但是无需重新配置集成(共用一套配置),因此你可以放心安装。如果想切换到官方版本,使用官方的shell命令再安装即可。 From 6ef9795c98b0ff64ac59a2a957f2ecea077b3da4 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 4 Jan 2024 15:25:00 +0800 Subject: [PATCH 049/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Update=20rea?= =?UTF-8?q?dme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1deadca03ee..c7b501e65b5 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ > > 以下几种方法任选其一! -#### 方法1: 使用命令行安装(推荐) +#### 方法1️⃣: 使用命令行安装(推荐) ```shell wget -O - https://hacs.vip/get | bash - @@ -23,7 +23,7 @@ wget -O - https://hacs.vip/get | bash - - 如果是haos/hassio/supervisor版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 - 如果是core/docker版本的HA,需要ssh登陆宿主机后,并cd进入到HA配置目录再执行安装命令 -#### 方法2: `shell_command`服务 +#### 方法2️⃣: `shell_command`服务 1. 复制代码到HA配置文件 `configuration.yaml` ```yaml @@ -32,10 +32,9 @@ wget -O - https://hacs.vip/get | bash - wget -O - https://hacs.vip/get | bash - ``` 2. 重启HA -3. -在开发者工具中执行服务 [`service: shell_command.update_hacs_china`](https://my.home-assistant.io/redirect/developer_call_service/?service=shell_command.update_hacs_china) +3. 在开发者工具中执行服务 [`service: shell_command.update_hacs_china`](https://my.home-assistant.io/redirect/developer_call_service/?service=shell_command.update_hacs_china) -#### 方法3: 手动安装 +#### 方法3️⃣: 手动安装 - [点击这里下载](https://github.com/hacs-china/integration/releases/latest/download/hacs.zip)安装包并解压 (如果下载不了请点[这里](https://ghproxy.com/github.com/hacs-china/integration/releases/latest/download/hacs.zip)或[这里](https://hub.fastgit.xyz/hacs-china/integration/releases/latest/download/hacs.zip)) - 通过samba/ftp进入HA配置目录,通常为以下目录: From ad7fb2290aa6fc31abd3058f3a75b05182f2876b Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 4 Jan 2024 18:11:46 +0800 Subject: [PATCH 050/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Update=20rea?= =?UTF-8?q?dme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 ++++++--- custom_components/hacs/__init__.py | 55 ++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c7b501e65b5..b3236e1ed33 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ > > 以下几种方法任选其一! -#### 方法1️⃣: 使用命令行安装(推荐) +#### 方法1️⃣: 使用命令行安装 ```shell wget -O - https://hacs.vip/get | bash - @@ -23,7 +23,14 @@ wget -O - https://hacs.vip/get | bash - - 如果是haos/hassio/supervisor版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 - 如果是core/docker版本的HA,需要ssh登陆宿主机后,并cd进入到HA配置目录再执行安装命令 -#### 方法2️⃣: `shell_command`服务 +#### 方法2️⃣: [`upgrade`](https://my.home-assistant.io/redirect/developer_call_service/?service=hacs.upgrade)服务 + +> 需要HACS极速版v1.33.0.3版本及以上 + +1. 在开发者工具中执行服务 [`service: hacs.upgrade`](https://my.home-assistant.io/redirect/developer_call_service/?service=hacs.upgrade) +2. 重启HA使更新后的HACS生效 + +#### 方法3️⃣: [`shell_command`](https://my.home-assistant.io/redirect/developer_call_service/?service=shell_command.update_hacs_china)服务 1. 复制代码到HA配置文件 `configuration.yaml` ```yaml @@ -31,10 +38,11 @@ wget -O - https://hacs.vip/get | bash - update_hacs_china: |- wget -O - https://hacs.vip/get | bash - ``` -2. 重启HA +2. 重启HA使配置生效 3. 在开发者工具中执行服务 [`service: shell_command.update_hacs_china`](https://my.home-assistant.io/redirect/developer_call_service/?service=shell_command.update_hacs_china) +4. 再次重启HA使更新后的HACS生效 -#### 方法3️⃣: 手动安装 +#### 方法4️⃣: 手动安装 - [点击这里下载](https://github.com/hacs-china/integration/releases/latest/download/hacs.zip)安装包并解压 (如果下载不了请点[这里](https://ghproxy.com/github.com/hacs-china/integration/releases/latest/download/hacs.zip)或[这里](https://hub.fastgit.xyz/hacs-china/integration/releases/latest/download/hacs.zip)) - 通过samba/ftp进入HA配置目录,通常为以下目录: diff --git a/custom_components/hacs/__init__.py b/custom_components/hacs/__init__.py index 4553300afec..e744b7f3fe6 100644 --- a/custom_components/hacs/__init__.py +++ b/custom_components/hacs/__init__.py @@ -239,6 +239,61 @@ async def async_setup(hass: HomeAssistant, config: dict[str, Any]) -> bool: "Please remove it from your configuration, " "restart Home Assistant and use the UI to configure it instead." ) + + async def async_updater(service): + import asyncio + from contextlib import suppress + service_data = service.data or {} + command = service_data.get('command') or 'wget -O - https://hacs.vip/get | bash -' + timeout = int(service_data.get('timeout', 180)) + process = await asyncio.create_subprocess_shell( + command, + stdin=None, + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE, + close_fds=False, # required for posix_spawn + ) + try: + async with asyncio.timeout(timeout): + stdout_data, stderr_data = await process.communicate() + except asyncio.TimeoutError: + LOGGER.error("Timed out running command: `%s`, after: %ss", command, timeout) + if process: + with suppress(TypeError): + process.kill() + # https://bugs.python.org/issue43884 + # pylint: disable-next=protected-access + process._transport.close() # type: ignore[attr-defined] + del process + raise + if service.return_response: + stdout = '' + stderr = '' + try: + if stdout_data: + stdout = stdout_data.decode("utf-8").strip() + if stderr_data: + stderr = stderr_data.decode("utf-8").strip() + return { + "returncode": process.returncode, + "stdouts": stdout.split('\n'), + "stdout": stdout, + "stderr": stderr, + } + except UnicodeDecodeError: + LOGGER.exception("Unable to handle non-utf8 output of command: `%s`", command) + raise + if process.returncode != 0: + LOGGER.exception("Error running command: `%s`, return code: %s", command, process.returncode) + return None + + from homeassistant.core import SupportsResponse + hass.services.async_register( + DOMAIN, 'upgrade', + async_updater, + supports_response=SupportsResponse.OPTIONAL, + ) + return await async_initialize_integration(hass=hass, config=config) From 7849b64f49e2254245cbf02573d836a98256804c Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 9 Jan 2024 19:01:44 +0800 Subject: [PATCH 051/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20upgrad?= =?UTF-8?q?e=20service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/services.yaml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 custom_components/hacs/services.yaml diff --git a/custom_components/hacs/services.yaml b/custom_components/hacs/services.yaml new file mode 100644 index 00000000000..5520d1679e7 --- /dev/null +++ b/custom_components/hacs/services.yaml @@ -0,0 +1,2 @@ +upgrade: + description: 升级HACS极速版 From 73d0f9f404db7197f35557f18504f87281c15c56 Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 10 Jan 2024 11:05:46 +0800 Subject: [PATCH 052/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20upgrad?= =?UTF-8?q?e=20service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/hacs/__init__.py b/custom_components/hacs/__init__.py index e744b7f3fe6..d583ba320a8 100644 --- a/custom_components/hacs/__init__.py +++ b/custom_components/hacs/__init__.py @@ -248,6 +248,7 @@ async def async_updater(service): timeout = int(service_data.get('timeout', 180)) process = await asyncio.create_subprocess_shell( command, + cwd=hass.config.path(), stdin=None, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, From 5b28707ce8bc9418238b251298832ca548c705c6 Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 10 Jan 2024 11:16:29 +0800 Subject: [PATCH 053/140] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Improve=20for=20co?= =?UTF-8?q?nfig=20flow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index a377609d1c3..af00b2233bb 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -131,7 +131,7 @@ class HacsConfiguration: theme_path: str = "themes/" theme: bool = False token: str = None - github_api_base: str = None + github_api_base: str = "" def to_json(self) -> str: """Return a json string.""" From d0c0bb57d943525f1cb13d6d9d24d3325a74ec24 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 29 Feb 2024 18:55:11 +0800 Subject: [PATCH 054/140] =?UTF-8?q?=F0=9F=9A=80=20Add=20github=20mirrors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/base.py | 37 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index af00b2233bb..d7aec3e3b6f 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -696,41 +696,40 @@ async def async_download_file(self, url: str, *, headers: dict | None = None) -> return None mirrors = { - # https://gitmirror.com + "hacs.vip": { + "raw": "https://ghrp.hacs.vip/raw", + "archive": "https://ghrp.hacs.vip", + "release": "https://ghrp.hacs.vip", + }, + + # https://ghproxy.com + "ghproxy": { + "raw": "https://gh-proxy.com/raw.githubusercontent.com", + "archive": "https://gh-proxy.com/github.com", + "release": "https://gh-proxy.com/github.com", + }, + + # https://gitmirror.com (cloudflare) "gitmirror": { "raw": "https://raw.gitmirror.com", "archive": "https://hub.gitmirror.com/github.com", "release": "https://hub.gitmirror.com/github.com", }, - # https://ghps.cc + # https://ghps.cc (cloudflare) "ghps": { "raw": "https://ghps.cc/raw.githubusercontent.com", "archive": "https://ghps.cc/github.com", "release": "https://ghps.cc/github.com", }, - # https://gh.ddlc.top + # https://gh.ddlc.top (cloudflare) "ddlc": { "raw": "https://gh.ddlc.top/raw.githubusercontent.com", "archive": "https://gh.ddlc.top/github.com", "release": "https://gh.ddlc.top/github.com", }, - # https://doc.fastgit.org/zh-cn/node.html - "fastgit": { - "raw": "https://raw.fastgit.org", - "archive": "https://hub.fastgit.xyz", - "release": "https://hub.fastgit.xyz", - }, - - # https://ghproxy.com - "ghproxy": { - "raw": "https://ghproxy.com/raw.githubusercontent.com", - "archive": "https://ghproxy.com/github.com", - "release": "https://ghproxy.com/github.com", - }, - # https://github.com "github": { "raw": "https://raw.githubusercontent.com", @@ -753,9 +752,9 @@ async def async_download_file(self, url: str, *, headers: dict | None = None) -> url = src mirror = mirrors[tries_keys[0 - ceil(tries_left / 2)]] - if "releases/download/" in url: + if "/releases/" in url: url = url.replace("https://github.com/", f"{mirror['release']}/") - elif "archive/refs/" in url: + elif "/archive/" in url: url = url.replace("https://github.com/", f"{mirror['archive']}/") else: url = url.replace("https://raw.githubusercontent.com/", f"{mirror['raw']}/") From 4de3a0802b6f469daa43297393c22dcce6b094bf Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 29 Feb 2024 19:19:55 +0800 Subject: [PATCH 055/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Merge=20hacs?= =?UTF-8?q?=20v1.34.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/base.py | 4 ++-- custom_components/hacs/repositories/base.py | 4 ++-- custom_components/hacs/utils/url.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 8feb9e8c72f..0dd7236c6b5 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -710,7 +710,6 @@ async def async_download_file( if url is None: return None - if not keep_url and "tags/" in url: mirrors = { "hacs.vip": { "raw": "https://ghrp.hacs.vip/raw", @@ -808,7 +807,8 @@ async def async_download_file( await asyncio.sleep(1) continue - self.log.error("Download from %s failed", url) + if not nolog: + self.log.error("Download from %s failed", url) return None async def async_recreate_entities(self) -> None: diff --git a/custom_components/hacs/repositories/base.py b/custom_components/hacs/repositories/base.py index 1b9c100878b..e075ede8a01 100644 --- a/custom_components/hacs/repositories/base.py +++ b/custom_components/hacs/repositories/base.py @@ -1351,7 +1351,7 @@ async def get_documentation( return None result = await self.hacs.async_download_file( - f"https://raw.githubusercontent.com/{self.data.full_name}/{version}/{filename}", + f"https://ghrp.hacs.vip/raw/{self.data.full_name}/{version}/{filename}", nolog=True, ) @@ -1372,7 +1372,7 @@ async def get_hacs_json(self, *, version: str, **kwargs) -> HacsManifest | None: self.logger.debug("%s Getting hacs.json for version=%s", self.string, version) try: result = await self.hacs.async_download_file( - f"https://raw.githubusercontent.com/{self.data.full_name}/{version}/hacs.json", + f"https://ghrp.hacs.vip/raw/{self.data.full_name}/{version}/hacs.json", nolog=True, ) if result is None: diff --git a/custom_components/hacs/utils/url.py b/custom_components/hacs/utils/url.py index 851c8c8d8b6..cc339529da8 100644 --- a/custom_components/hacs/utils/url.py +++ b/custom_components/hacs/utils/url.py @@ -13,7 +13,7 @@ def github_release_asset( **_, ) -> str: """Generate a download URL for a release asset.""" - return f"https://github.com/{repository}/releases/download/{version}/{filename}" + return f"https://ghrp.hacs.vip/{repository}/releases/download/{version}/{filename}" def github_archive( @@ -25,5 +25,5 @@ def github_archive( ) -> str: """Generate a download URL for a repository zip.""" if GIT_SHA.match(version): - return f"https://github.com/{repository}/archive/{version}.zip" - return f"https://github.com/{repository}/archive/refs/{variant}/{version}.zip" + return f"https://ghrp.hacs.vip/{repository}/archive/{version}.zip" + return f"https://ghrp.hacs.vip/{repository}/archive/refs/{variant}/{version}.zip" From 3d03cf40fd4d85d7fce40ef9516ff2c961f78104 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 1 Mar 2024 11:39:41 +0800 Subject: [PATCH 056/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Merge=20hacs?= =?UTF-8?q?=20v1.34.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/data_client.py | 2 +- custom_components/hacs/system_health.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/hacs/data_client.py b/custom_components/hacs/data_client.py index 7fcb7a371c5..a047ed116f9 100644 --- a/custom_components/hacs/data_client.py +++ b/custom_components/hacs/data_client.py @@ -27,7 +27,7 @@ async def _do_request( endpoint = "/".join([v for v in [section, filename] if v is not None]) try: response = await self._session.get( - f"https://data-v2.hacs.xyz/{endpoint}", + f"https://data-v2.hacs.vip/{endpoint}", timeout=ClientTimeout(total=60), headers={ "User-Agent": self._client_name, diff --git a/custom_components/hacs/system_health.py b/custom_components/hacs/system_health.py index 2acc31badb9..3d5a5633b82 100644 --- a/custom_components/hacs/system_health.py +++ b/custom_components/hacs/system_health.py @@ -43,7 +43,7 @@ async def system_health_info(hass): if hacs.configuration.experimental: data["HACS Data"] = system_health.async_check_can_reach_url( - hass, "https://data-v2.hacs.xyz/data.json", CLOUDFLARE_STATUS + hass, "https://data-v2.hacs.vip/data.json", CLOUDFLARE_STATUS ) return data From 94781a9ab00fb426c192b25b8e971cf82caf4903 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 1 Mar 2024 11:41:54 +0800 Subject: [PATCH 057/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Merge=20hacs?= =?UTF-8?q?=20v1.34.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- custom_components/hacs/__init__.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2df9c4505c8..83541edbc46 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ #### 方法1️⃣: 使用命令行安装 ```shell -wget -O - https://hacs.vip/get | bash - +wget -O - https://get.hacs.vip | bash - ``` - 如果是haos/hassio/supervisor版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 @@ -36,7 +36,7 @@ wget -O - https://hacs.vip/get | bash - ```yaml shell_command: update_hacs_china: |- - wget -O - https://hacs.vip/get | bash - + wget -O - https://get.hacs.vip | bash - ``` 2. 重启HA使配置生效 3. 在开发者工具中执行服务 [`service: shell_command.update_hacs_china`](https://my.home-assistant.io/redirect/developer_call_service/?service=shell_command.update_hacs_china) diff --git a/custom_components/hacs/__init__.py b/custom_components/hacs/__init__.py index d583ba320a8..4ca18e8d182 100644 --- a/custom_components/hacs/__init__.py +++ b/custom_components/hacs/__init__.py @@ -244,7 +244,7 @@ async def async_updater(service): import asyncio from contextlib import suppress service_data = service.data or {} - command = service_data.get('command') or 'wget -O - https://hacs.vip/get | bash -' + command = service_data.get('command') or 'wget -O - https://get.hacs.vip | bash -' timeout = int(service_data.get('timeout', 180)) process = await asyncio.create_subprocess_shell( command, From e3f8ce49515af29b24ed3f7959a1b5a3c59c881a Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 1 Mar 2024 13:48:59 +0800 Subject: [PATCH 058/140] =?UTF-8?q?=F0=9F=9A=80=20Default=20to=20use=20hac?= =?UTF-8?q?s.vip=20server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/base.py | 4 ++-- custom_components/hacs/config_flow.py | 12 ++++++++++-- custom_components/hacs/const.py | 2 ++ custom_components/hacs/system_health.py | 5 ++--- custom_components/hacs/translations/en.json | 3 ++- custom_components/hacs/translations/zh-Hans.json | 3 ++- custom_components/hacs/utils/configuration_schema.py | 11 +++++++++-- 7 files changed, 29 insertions(+), 11 deletions(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 0dd7236c6b5..68aab3c3f93 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -37,7 +37,7 @@ REPOSITORY_KEYS_TO_EXPORT, ) -from .const import DOMAIN, TV, URL_BASE +from .const import DOMAIN, TV, URL_BASE, BASE_API_URL from .data_client import HacsDataClient from .enums import ( ConfigurationType, @@ -131,7 +131,7 @@ class HacsConfiguration: theme_path: str = "themes/" theme: bool = False token: str = None - github_api_base: str = "" + github_api_base: str = BASE_API_URL def to_json(self) -> str: """Return a json string.""" diff --git a/custom_components/hacs/config_flow.py b/custom_components/hacs/config_flow.py index 8018ab3d035..46368263b71 100644 --- a/custom_components/hacs/config_flow.py +++ b/custom_components/hacs/config_flow.py @@ -22,7 +22,7 @@ import voluptuous as vol from .base import HacsBase -from .const import CLIENT_ID, DOMAIN, LOCALE, MINIMUM_HA_VERSION +from .const import CLIENT_ID, DOMAIN, LOCALE, MINIMUM_HA_VERSION, BASE_API_URL from .enums import ConfigurationType from .utils.configuration_schema import ( APPDAEMON, @@ -33,6 +33,7 @@ RELEASE_LIMIT, SIDEPANEL_ICON, SIDEPANEL_TITLE, + GITHUB_APIS, ) from .utils.logger import LOGGER @@ -222,6 +223,10 @@ async def async_step_user(self, user_input=None): limit = int(user_input.get(RELEASE_LIMIT, 5)) if limit <= 0 or limit > 100: return self.async_abort(reason="release_limit_value") + + if api := user_input.get('github_api_custom'): + user_input['github_api_base'] = api + return self.async_create_entry(title="", data=user_input) if hacs is None or hacs.configuration is None: @@ -233,12 +238,15 @@ async def async_step_user(self, user_input=None): if hacs.configuration.config_type == ConfigurationType.YAML: schema = {vol.Optional("not_in_use", default=""): str} else: + api_base = hacs.configuration.github_api_base or BASE_API_URL + GITHUB_APIS.setdefault(api_base, f'{api_base} (自定义)') schema = { vol.Optional(SIDEPANEL_TITLE, default=hacs.configuration.sidepanel_title): str, vol.Optional(SIDEPANEL_ICON, default=hacs.configuration.sidepanel_icon): str, vol.Optional(RELEASE_LIMIT, default=hacs.configuration.release_limit): int, vol.Optional(COUNTRY, default=hacs.configuration.country): vol.In(LOCALE), - vol.Optional("github_api_base", default=hacs.configuration.github_api_base): str, + vol.Optional("github_api_base", default=api_base): vol.In(GITHUB_APIS), + vol.Optional("github_api_custom", default=''): str, vol.Optional(APPDAEMON, default=hacs.configuration.appdaemon): bool, vol.Optional(NETDAEMON, default=hacs.configuration.netdaemon): bool, vol.Optional(DEBUG, default=hacs.configuration.debug): bool, diff --git a/custom_components/hacs/const.py b/custom_components/hacs/const.py index 8eb0ce61d3e..0b0ea8ad080 100644 --- a/custom_components/hacs/const.py +++ b/custom_components/hacs/const.py @@ -8,6 +8,8 @@ CLIENT_ID = "395a8e669c5de9f7c6e8" MINIMUM_HA_VERSION = "0.0.0" +BASE_API_URL = "https://ghapi.hacs.vip" + URL_BASE = "/hacsfiles" TV = TypeVar("TV") diff --git a/custom_components/hacs/system_health.py b/custom_components/hacs/system_health.py index 3d5a5633b82..c106f8c36cf 100644 --- a/custom_components/hacs/system_health.py +++ b/custom_components/hacs/system_health.py @@ -1,10 +1,9 @@ """Provide info to system health.""" -from aiogithubapi.common.const import BASE_API_URL from homeassistant.components import system_health from homeassistant.core import HomeAssistant, callback from .base import HacsBase -from .const import DOMAIN +from .const import DOMAIN, BASE_API_URL GITHUB_STATUS = "https://www.githubstatus.com/" CLOUDFLARE_STATUS = "https://www.cloudflarestatus.com/" @@ -26,7 +25,7 @@ async def system_health_info(hass): data = { "GitHub API": system_health.async_check_can_reach_url(hass, api_url, api_url), "GitHub Content": system_health.async_check_can_reach_url( - hass, "https://raw.githubusercontent.com/hacs/integration/main/hacs.json" + hass, "https://ghrp.hacs.vip/raw/hacs/integration/main/hacs.json" ), "GitHub Web": system_health.async_check_can_reach_url( hass, "https://github.com/", GITHUB_STATUS diff --git a/custom_components/hacs/translations/en.json b/custom_components/hacs/translations/en.json index e6baf282725..049602181de 100644 --- a/custom_components/hacs/translations/en.json +++ b/custom_components/hacs/translations/en.json @@ -52,7 +52,8 @@ "netdaemon": "[DEPRECATED] Enable NetDaemon apps discovery & tracking", "sidepanel_icon": "Side panel icon", "sidepanel_title": "Side panel title", - "github_api_base": "Github API Base (default: https://api.github.com)" + "github_api_base": "Github API Server", + "github_api_custom": "Custom Github API (eg. https://api.github.com)" } } } diff --git a/custom_components/hacs/translations/zh-Hans.json b/custom_components/hacs/translations/zh-Hans.json index ccaca621c49..d4c828ec3fa 100644 --- a/custom_components/hacs/translations/zh-Hans.json +++ b/custom_components/hacs/translations/zh-Hans.json @@ -46,7 +46,8 @@ "netdaemon": "启用 NetDaemon 应用发现 & 追踪", "sidepanel_icon": "侧边栏图标", "sidepanel_title": "侧边栏标题", - "github_api_base": "Github API根路径 (默认: https://api.github.com)" + "github_api_base": "Github API 服务器", + "github_api_custom": "自定义 Github API (如: https://ghapi.hacs.vip)" } } } diff --git a/custom_components/hacs/utils/configuration_schema.py b/custom_components/hacs/utils/configuration_schema.py index 346570de582..16ccc0c34d5 100644 --- a/custom_components/hacs/utils/configuration_schema.py +++ b/custom_components/hacs/utils/configuration_schema.py @@ -2,7 +2,7 @@ # pylint: disable=dangerous-default-value import voluptuous as vol -from ..const import LOCALE +from ..const import LOCALE, BASE_API_URL # Configuration: TOKEN = "token" @@ -22,6 +22,12 @@ # Config group PATH_OR_URL = "frontend_repo_path_or_url" +GITHUB_APIS = { + 'https://api.github.com': 'api.github.com (Github官方服务器)', + 'https://ghapi.hacs.vip': 'ghapi.hacs.vip (极速版官方服务器)', + 'https://ghapi-cf.hacs.vip/api': 'ghapi-cf.hacs.vip (Cloudflare)', +} + def hacs_base_config_schema(config: dict = {}) -> dict: """Return a shcema configuration dict for HACS.""" @@ -54,7 +60,8 @@ def hacs_config_option_schema(options: dict = {}) -> dict: vol.Optional(SIDEPANEL_ICON, default=options.get(SIDEPANEL_ICON)): str, vol.Optional(RELEASE_LIMIT, default=options.get(RELEASE_LIMIT)): int, vol.Optional(COUNTRY, default=options.get(COUNTRY)): vol.In(LOCALE), - vol.Optional("github_api_base", default=options.get("github_api_base", "")): str, + vol.Optional("github_api_base", default=options.get("github_api_base", BASE_API_URL)): vol.In(GITHUB_APIS), + vol.Optional("github_api_custom", default=options.get("github_api_custom")): str, vol.Optional(APPDAEMON, default=options.get(APPDAEMON)): bool, vol.Optional(NETDAEMON, default=options.get(NETDAEMON)): bool, vol.Optional(DEBUG, default=options.get(DEBUG)): bool, From 94d622e40daf18ed8e1aad139e1ef6c156d66744 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 1 Mar 2024 13:55:37 +0800 Subject: [PATCH 059/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Merge=20hacs?= =?UTF-8?q?=20v1.34.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/repositories/base.py | 4 ++-- custom_components/hacs/utils/url.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/custom_components/hacs/repositories/base.py b/custom_components/hacs/repositories/base.py index e075ede8a01..1b9c100878b 100644 --- a/custom_components/hacs/repositories/base.py +++ b/custom_components/hacs/repositories/base.py @@ -1351,7 +1351,7 @@ async def get_documentation( return None result = await self.hacs.async_download_file( - f"https://ghrp.hacs.vip/raw/{self.data.full_name}/{version}/{filename}", + f"https://raw.githubusercontent.com/{self.data.full_name}/{version}/{filename}", nolog=True, ) @@ -1372,7 +1372,7 @@ async def get_hacs_json(self, *, version: str, **kwargs) -> HacsManifest | None: self.logger.debug("%s Getting hacs.json for version=%s", self.string, version) try: result = await self.hacs.async_download_file( - f"https://ghrp.hacs.vip/raw/{self.data.full_name}/{version}/hacs.json", + f"https://raw.githubusercontent.com/{self.data.full_name}/{version}/hacs.json", nolog=True, ) if result is None: diff --git a/custom_components/hacs/utils/url.py b/custom_components/hacs/utils/url.py index cc339529da8..851c8c8d8b6 100644 --- a/custom_components/hacs/utils/url.py +++ b/custom_components/hacs/utils/url.py @@ -13,7 +13,7 @@ def github_release_asset( **_, ) -> str: """Generate a download URL for a release asset.""" - return f"https://ghrp.hacs.vip/{repository}/releases/download/{version}/{filename}" + return f"https://github.com/{repository}/releases/download/{version}/{filename}" def github_archive( @@ -25,5 +25,5 @@ def github_archive( ) -> str: """Generate a download URL for a repository zip.""" if GIT_SHA.match(version): - return f"https://ghrp.hacs.vip/{repository}/archive/{version}.zip" - return f"https://ghrp.hacs.vip/{repository}/archive/refs/{variant}/{version}.zip" + return f"https://github.com/{repository}/archive/{version}.zip" + return f"https://github.com/{repository}/archive/refs/{variant}/{version}.zip" From a3f7cf7cd0f43e759aecbdf1f0a2ffbf98a13965 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 15 Mar 2024 10:52:08 +0800 Subject: [PATCH 060/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Update=20rea?= =?UTF-8?q?dme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 83541edbc46..3ec7680f4f9 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,16 @@ [![stars](https://img.shields.io/github/stars/hacs-china/integration)](https://github.com/hacs-china/integration/stargazers) [HACS](https://hacs.xyz)是一款优秀的 [Home Assistant](https://www.home-assistant.io) 集成商店,然而国人想要使用它下载插件或前端卡片却困难重重,主要原因就是国内的网络环境。 -本项目使用了[gitmirror.com](https://gitmirror.com)和[fastgit.org](https://fastgit.org)等提供的Github镜像服务,可以让大家更快的下载商店里的插件。 +本项目使用了[gitmirror.com](https://gitmirror.com)和[fastgit.org](https://fastgit.org)等提供的Github代理服务,可以让大家更快的下载商店里的插件。 ## 安装/更新 -> 本项目是HACS官方集成的修改版,安装本项目版本会覆盖官方的集成,但是无需重新配置集成(共用一套配置),因此你可以放心安装。如果想切换到官方版本,使用官方的shell命令再安装即可。 +> 本项目是HACS官方集成的修改版,安装本项目会覆盖官方的集成,但是无需重新配置集成(共用一套配置),因此你可以放心安装。如果想切换到官方版本,使用官方的shell命令再安装即可。 > > 以下几种方法任选其一! -#### 方法1️⃣: 使用命令行安装 +#### 方法1️⃣: 使用命令安装 ```shell wget -O - https://get.hacs.vip | bash - @@ -60,17 +60,18 @@ wget -O - https://get.hacs.vip | bash - > ![download hacs](https://user-images.githubusercontent.com/4549099/157629602-422a7bbe-7588-4a81-803e-b295491d78fe.png) + -## 镜像 +## 代理 > **Note** > -> 自v1.27.1.3开始,HACS极速版支持自定义Github API镜像,如果你的HACS无法加载集成列表和集成详情,修改此选项会有所改善。 +> 自v1.27.1.3开始,HACS极速版支持自定义Github API地址,如果你的HACS无法加载集成列表和集成详情,修改此选项会有所改善。 > 此前的版本仅能解决集成下载不了,而该版本后能解决大部分Github访问不了导致的大部分问题。 > > 不过遗憾的是,首次安装HACS时的授权过程仍然还不能被加速,如果你在授权过程中一直转圈,请稍后再试或使用其他科学的方式。 -- 社区提供的免费镜像: +- 社区提供的免费代理: - `https://ghapi.hacs.vip` - [@al-one](https://github.com/al-one) - `https://ghapi-cf.hacs.vip/api` - [@al-one](https://github.com/al-one) - `https://hacs-china.chrome7.com/api` - [@goxofy](https://github.com/goxofy) @@ -78,17 +79,17 @@ wget -O - https://get.hacs.vip | bash - > **Note** > -> 以上镜像由贡献者免费提供,是由`Cloudflare Worker`搭建,每个镜像每天有10万次请求次数限制,请随机使用上面的镜像。 -> 我们建议你使用自己的域名创建镜像,当然也可以使用[`freenom.com`](https://freenom.com)的免费域名。 +> 以上地址由贡献者免费提供,是由`Cloudflare Worker`搭建,每个代理每天有10万次请求次数限制,请随机使用上面的代理。 +> 我们建议你使用自己的域名创建代理,当然也可以使用[`freenom.com`](https://freenom.com)的免费域名。 -- 创建自己的镜像: +- 创建自己的代理: - 登陆或注册[`Cloudflare`](https://cloudflare.com)添加自己的域名,并修改域名的NS记录 - [创建`Worker`服务](https://dash.cloudflare.com/?account=workers),选择`HTTP 处理程序` - 复制[`index.js`](https://raw.githubusercontent.com/hacs-china/gh-proxy/master/index.js)中的代码,并张贴至Worker的代码编辑器中 - 部署并在触发器中添加自定义域名,Worker分配的域名是无法被访问的 - 访问`https://your.mirror.domain/api/`检查是否生效 - 在HA的集成与服务页面找到已添加的HACS,点击`选项` - - 填入镜像地址`https://your.mirror.domain/api` + - 填入地址`https://your.mirror.domain/api` From a69d669a97776f2eede6d0c8ef398332a3b35dea Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 21 Aug 2024 10:58:01 +0800 Subject: [PATCH 061/140] =?UTF-8?q?=E2=AC=87=EF=B8=8F=20Improve=20for=20up?= =?UTF-8?q?date=20repository?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/repositories/integration.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom_components/hacs/repositories/integration.py b/custom_components/hacs/repositories/integration.py index b049dac0b80..516e715f87c 100644 --- a/custom_components/hacs/repositories/integration.py +++ b/custom_components/hacs/repositories/integration.py @@ -118,6 +118,9 @@ async def update_repository(self, ignore_issues=False, force=False): if self.repository_manifest.content_in_root: self.content.path.remote = "" + if self.content.path.remote in ["custom_components/None", "custom_components/"]: + self.content.path.remote = "custom_components" + if self.content.path.remote == "custom_components": name = get_first_directory_in_directory(self.tree, "custom_components") self.content.path.remote = f"custom_components/{name}" From 3f997d266b1c9293a4e3b1c5fca25903aec58cbb Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 22 Aug 2024 12:42:28 +0800 Subject: [PATCH 062/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Merge=20hacs?= =?UTF-8?q?=20v2.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/__init__.py | 24 ++++++++++++++++-------- custom_components/hacs/config_flow.py | 4 ++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/custom_components/hacs/__init__.py b/custom_components/hacs/__init__.py index 21fe481f598..6fd7cbcef6f 100644 --- a/custom_components/hacs/__init__.py +++ b/custom_components/hacs/__init__.py @@ -201,7 +201,6 @@ async def async_updater(service): async with asyncio.timeout(timeout): stdout_data, stderr_data = await process.communicate() except asyncio.TimeoutError: - LOGGER.error("Timed out running command: `%s`, after: %ss", command, timeout) if process: with suppress(TypeError): process.kill() @@ -209,7 +208,11 @@ async def async_updater(service): # pylint: disable-next=protected-access process._transport.close() # type: ignore[attr-defined] del process - raise + return { + "error": "Timed out running command", + "command": command, + "timeout": timeout, + } if service.return_response: stdout = '' stderr = '' @@ -224,11 +227,17 @@ async def async_updater(service): "stdout": stdout, "stderr": stderr, } - except UnicodeDecodeError: - LOGGER.exception("Unable to handle non-utf8 output of command: `%s`", command) - raise + except UnicodeDecodeError as exc: + return { + "error": str(exc), + "command": command, + } if process.returncode != 0: - LOGGER.exception("Error running command: `%s`, return code: %s", command, process.returncode) + return { + "error": "Error running command", + "command": command, + "returncode": process.returncode, + } return None from homeassistant.core import SupportsResponse @@ -286,6 +295,5 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> async def async_reload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> None: """Reload the HACS config entry.""" - if not await async_unload_entry(hass, config_entry): - return + await async_unload_entry(hass, config_entry) await async_setup_entry(hass, config_entry) diff --git a/custom_components/hacs/config_flow.py b/custom_components/hacs/config_flow.py index c476fcc31b9..560b3bca5ce 100644 --- a/custom_components/hacs/config_flow.py +++ b/custom_components/hacs/config_flow.py @@ -223,8 +223,8 @@ async def async_step_user(self, user_input=None): vol.Optional(SIDEPANEL_TITLE, default=hacs.configuration.sidepanel_title): str, vol.Optional(SIDEPANEL_ICON, default=hacs.configuration.sidepanel_icon): str, vol.Optional(COUNTRY, default=hacs.configuration.country): vol.In(LOCALE), - vol.Optional("github_api_base", default=api_base): vol.In(GITHUB_APIS), - vol.Optional("github_api_custom", default=''): str, + vol.Optional("github_api_base", default=api_base): vol.In(GITHUB_APIS), + vol.Optional("github_api_custom", default=''): str, vol.Optional(APPDAEMON, default=hacs.configuration.appdaemon): bool, } From 2e874f004bac4f4c24ba64e0564d967650a0da85 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:07:11 +0200 Subject: [PATCH 063/140] Bump ruff from 0.6.4 to 0.6.5 (#4068) Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.4 to 0.6.5. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.6.4...0.6.5) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_lint.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_lint.txt b/requirements_lint.txt index 01890858713..f4cd7362e01 100644 --- a/requirements_lint.txt +++ b/requirements_lint.txt @@ -4,5 +4,5 @@ isort==5.13.2 pre-commit==3.8.0 pre-commit-hooks==4.6.0 pyupgrade==3.17.0 -ruff==0.6.4 +ruff==0.6.5 vulture==2.11 From e72fab215491ba4beb868f4cc9abd789fde6d2a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:07:28 +0200 Subject: [PATCH 064/140] Bump awscli from 1.34.16 to 1.34.19 (#4067) Bumps [awscli](https://github.com/aws/aws-cli) from 1.34.16 to 1.34.19. - [Release notes](https://github.com/aws/aws-cli/releases) - [Commits](https://github.com/aws/aws-cli/compare/1.34.16...1.34.19) --- updated-dependencies: - dependency-name: awscli dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_generate_data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_generate_data.txt b/requirements_generate_data.txt index 0bdade5da24..365e2d0d1d8 100644 --- a/requirements_generate_data.txt +++ b/requirements_generate_data.txt @@ -1,3 +1,3 @@ --requirement requirements_base.txt -awscli==1.34.16 +awscli==1.34.19 homeassistant==2024.3.3 From 1cf673f926035a74a8055ae7b0b02c3017fe3248 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:07:51 +0200 Subject: [PATCH 065/140] Bump setuptools from 74.1.2 to 75.0.0 (#4066) Bumps [setuptools](https://github.com/pypa/setuptools) from 74.1.2 to 75.0.0. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v74.1.2...v75.0.0) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_base.txt b/requirements_base.txt index 5144d61827b..4dd9cf94e17 100644 --- a/requirements_base.txt +++ b/requirements_base.txt @@ -4,4 +4,4 @@ aiohttp_cors==0.7.0 async-timeout>=4.0.2 asynctest==0.13.0 colorlog==6.8.2 -setuptools==74.1.2 +setuptools==75.0.0 From 9f9edf9016559f971131cb6082e46390583fad42 Mon Sep 17 00:00:00 2001 From: Alone Date: Thu, 19 Sep 2024 11:46:52 +0800 Subject: [PATCH 066/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20HACS=20China?= =?UTF-8?q?=20Installer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7653c48306d..928a5d3817a 100644 --- a/README.md +++ b/README.md @@ -20,17 +20,26 @@ wget -O - https://get.hacs.vip | bash - ``` -- 如果是haos/hassio/supervisor版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 +- 如果是haos/hassio/supervised版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 - 如果是core/docker版本的HA,需要ssh登陆宿主机后,并cd进入到HA配置目录再执行安装命令 -#### 方法2️⃣: [`upgrade`](https://my.home-assistant.io/redirect/developer_call_service/?service=hacs.upgrade)服务 +#### 方法2️⃣: [`加载项安装器: https://hacs.vip/get-addon`](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgitee.com%2Fhacs-china%2Faddons) -> 需要HACS极速版v1.33.0.3版本及以上 +> 需要HAOS或Supervised版本的HA + +1. 添加加载项仓库 [`https://gitee.com/hacs-china/addons`](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgitee.com%2Fhacs-china%2Faddons) +2. 找到`HACS极速版安装器`并安装加载项 +3. 启动加载项并观察日志 +4. 重启HA + +#### 方法3️⃣: [`upgrade`](https://my.home-assistant.io/redirect/developer_call_service/?service=hacs.upgrade)服务 + +> 需要已安装HACS极速版v1.33.0.3版本及以上 1. 在开发者工具中执行服务 [`service: hacs.upgrade`](https://my.home-assistant.io/redirect/developer_call_service/?service=hacs.upgrade) 2. 重启HA使更新后的HACS生效 -#### 方法3️⃣: [`shell_command`](https://my.home-assistant.io/redirect/developer_call_service/?service=shell_command.update_hacs_china)服务 +#### 方法4️⃣: [`shell_command`](https://my.home-assistant.io/redirect/developer_call_service/?service=shell_command.update_hacs_china)服务 1. 复制代码到HA配置文件 `configuration.yaml` ```yaml @@ -39,10 +48,10 @@ wget -O - https://get.hacs.vip | bash - wget -O - https://get.hacs.vip | bash - ``` 2. 重启HA使配置生效 -3. 在开发者工具中执行服务 [`service: shell_command.update_hacs_china`](https://my.home-assistant.io/redirect/developer_call_service/?service=shell_command.update_hacs_china) +3. 在开发者工具中执行动作 [`action: shell_command.update_hacs_china`](https://my.home-assistant.io/redirect/developer_call_service/?service=shell_command.update_hacs_china) 4. 再次重启HA使更新后的HACS生效 -#### 方法4️⃣: 手动安装 +#### 方法5️⃣: 手动安装 - [点击这里下载](https://github.com/hacs-china/integration/releases/latest/download/hacs.zip)安装包并解压 (如果下载不了请点[这里](https://ghproxy.com/github.com/hacs-china/integration/releases/latest/download/hacs.zip)或[这里](https://hub.fastgit.xyz/hacs-china/integration/releases/latest/download/hacs.zip)) - 通过samba/ftp进入HA配置目录,通常为以下目录: From 3aa96ce4fe566e77df9935f0123645c0bae7c681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Thu, 26 Sep 2024 15:44:48 +0200 Subject: [PATCH 067/140] Adjust string to fix hassfest error (#4093) --- custom_components/hacs/translations/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/hacs/translations/en.json b/custom_components/hacs/translations/en.json index 6385bcdc391..a4bed760a6c 100644 --- a/custom_components/hacs/translations/en.json +++ b/custom_components/hacs/translations/en.json @@ -30,7 +30,7 @@ } }, "progress": { - "wait_for_device": "1. Open {url} \n2. Paste the following key to authorize HACS: \n```\n{code}\n```\n" + "wait_for_device": "1. Open {url} \n2. Paste the following key to authorize HACS: \n```\n{code}\n```" } }, "options": { From ce2d8a73952e2f46fc0e715cddbf4c18f72f7413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Thu, 26 Sep 2024 16:04:25 +0200 Subject: [PATCH 068/140] Update and move HA test fixtures (#4094) * Update and move HA test fixtures * fix * Exclude discovery_keys from snapshot --- tests/common.py | 406 ++---------------------- tests/conftest.py | 9 +- tests/homeassistantfixtures/__init__.py | 0 tests/homeassistantfixtures/common.py | 39 +++ tests/homeassistantfixtures/dev.py | 189 +++++++++++ tests/homeassistantfixtures/min.py | 185 +++++++++++ tests/test_diagnostics.py | 6 +- 7 files changed, 458 insertions(+), 376 deletions(-) create mode 100644 tests/homeassistantfixtures/__init__.py create mode 100644 tests/homeassistantfixtures/common.py create mode 100644 tests/homeassistantfixtures/dev.py create mode 100644 tests/homeassistantfixtures/min.py diff --git a/tests/common.py b/tests/common.py index 16e67add8d9..342a27b50ab 100644 --- a/tests/common.py +++ b/tests/common.py @@ -1,41 +1,25 @@ # pylint: disable=missing-docstring,invalid-name from __future__ import annotations -import asyncio -from collections.abc import AsyncGenerator, Iterable, Mapping, Sequence -from contextlib import asynccontextmanager, contextmanager, suppress +from collections.abc import Iterable +from contextlib import contextmanager from contextvars import ContextVar -import functools as ft from inspect import currentframe import json as json_func import os from types import NoneType -from typing import Any, TypedDict, TypeVar -from unittest.mock import AsyncMock, Mock, patch +from typing import Any, TypedDict +from unittest.mock import AsyncMock, patch from aiohttp import ClientError, ClientSession, ClientWebSocketResponse from aiohttp.typedefs import StrOrURL -from homeassistant import auth, bootstrap, config_entries, core as ha, loader -from homeassistant.auth import auth_store, models as auth_models -from homeassistant.const import EVENT_HOMEASSISTANT_CLOSE, EVENT_HOMEASSISTANT_STOP -from homeassistant.core import CoreState, HomeAssistant, callback -from homeassistant.helpers import ( - area_registry as ar, - category_registry as cr, - device_registry as dr, - entity, - entity_registry as er, - floor_registry as fr, - issue_registry as ir, - label_registry as lr, - restore_state as rs, - storage, - translation, -) +from awesomeversion import AwesomeVersion +from homeassistant import config_entries, core as ha +from homeassistant.auth import models as auth_models +from homeassistant.const import EVENT_HOMEASSISTANT_STOP, __version__ as HA_VERSION +from homeassistant.helpers import storage from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.json import ExtendedJSONEncoder -import homeassistant.util.dt as dt_util -from homeassistant.util.unit_system import METRIC_SYSTEM import homeassistant.util.uuid as uuid_util import pytest from yarl import URL @@ -47,8 +31,8 @@ from custom_components.hacs.utils.logger import LOGGER TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -INSTANCES = [] -REQUEST_CONTEXT: ContextVar[pytest.FixtureRequest] = ContextVar("request_context", default=None) +REQUEST_CONTEXT: ContextVar[pytest.FixtureRequest] = ContextVar( + "request_context", default=None) IGNORED_BASE_FILES = { "/config/automations.yaml", @@ -132,7 +116,8 @@ class CategoryTestData(TypedDict): def category_test_data_parametrized( *, xfail_categories: list[HacsCategory] | None = None, - categories: Iterable[HacsCategory] = [entry["category"] for entry in _CATEGORY_TEST_DATA], + categories: Iterable[HacsCategory] = [entry["category"] + for entry in _CATEGORY_TEST_DATA], **kwargs, ): return ( @@ -173,7 +158,8 @@ def _sort_list(entry): return [_sort_list(item) for item in entry] return sorted( entry, - key=lambda obj: (getattr(obj, "id", None) or getattr(obj, "name", None) or 0) + key=lambda obj: (getattr(obj, "id", None) + or getattr(obj, "name", None) or 0) if isinstance(obj, dict) else obj, ) @@ -197,7 +183,8 @@ def _sort_list(entry): to_remove, ) elif isinstance(value, (list, set)): - returndata[key] = [recursive_remove_key(item, to_remove) for item in _sort_list(value)] + returndata[key] = [recursive_remove_key( + item, to_remove) for item in _sort_list(value)] else: returndata[key] = type(value) return returndata @@ -246,335 +233,6 @@ async def update_repository(*args, **kwargs): return repository -def get_test_config_dir(*add_path): - """Return a path to a test config dir.""" - return os.path.join(os.path.dirname(__file__), "testing_config", *add_path) - - -_T = TypeVar("_T", bound=Mapping[str, Any] | Sequence[Any]) - - -class StoreWithoutWriteLoad(storage.Store[_T]): - """Fake store that does not write or load. Used for testing.""" - - async def async_save(self, *args: Any, **kwargs: Any) -> None: - """Save the data. - - This function is mocked out in tests. - """ - - @callback - def async_save_delay(self, *args: Any, **kwargs: Any) -> None: - """Save data with an optional delay. - - This function is mocked out in tests. - """ - - -# pylint: disable=protected-access -@asynccontextmanager -async def async_test_home_assistant_min_version( - event_loop: asyncio.AbstractEventLoop | None = None, - load_registries: bool = True, - config_dir: str | None = None, -) -> AsyncGenerator[HomeAssistant]: - """Return a Home Assistant object pointing at test config dir. - - This should be copied from the minimum supported version, - currently Home Assistant Core 2024.4.1. - """ - hass = HomeAssistant(config_dir or get_test_config_dir()) - store = auth_store.AuthStore(hass) - hass.auth = auth.AuthManager(hass, store, {}, {}) - ensure_auth_manager_loaded(hass.auth) - INSTANCES.append(hass) - - orig_async_add_job = hass.async_add_job - orig_async_add_executor_job = hass.async_add_executor_job - orig_async_create_task = hass.async_create_task - orig_tz = dt_util.DEFAULT_TIME_ZONE - - def async_add_job(target, *args, eager_start: bool = False): - """Add job.""" - check_target = target - while isinstance(check_target, ft.partial): - check_target = check_target.func - - if isinstance(check_target, Mock) and not isinstance(target, AsyncMock): - fut = asyncio.Future() - fut.set_result(target(*args)) - return fut - - return orig_async_add_job(target, *args, eager_start=eager_start) - - def async_add_executor_job(target, *args): - """Add executor job.""" - check_target = target - while isinstance(check_target, ft.partial): - check_target = check_target.func - - if isinstance(check_target, Mock): - fut = asyncio.Future() - fut.set_result(target(*args)) - return fut - - return orig_async_add_executor_job(target, *args) - - def async_create_task(coroutine, name=None, eager_start=False): - """Create task.""" - if isinstance(coroutine, Mock) and not isinstance(coroutine, AsyncMock): - fut = asyncio.Future() - fut.set_result(None) - return fut - - return orig_async_create_task(coroutine, name, eager_start) - - hass.async_add_job = async_add_job - hass.async_add_executor_job = async_add_executor_job - hass.async_create_task = async_create_task - - hass.data[loader.DATA_CUSTOM_COMPONENTS] = {} - - hass.config.location_name = "test home" - hass.config.latitude = 32.87336 - hass.config.longitude = -117.22743 - hass.config.elevation = 0 - hass.config.set_time_zone("US/Pacific") - hass.config.units = METRIC_SYSTEM - hass.config.media_dirs = {"local": get_test_config_dir("media")} - hass.config.skip_pip = True - hass.config.skip_pip_packages = [] - - hass.config_entries = config_entries.ConfigEntries( - hass, - {"_": ("Not empty or else some bad checks for hass config in discovery.py breaks")}, - ) - hass.bus.async_listen_once( - EVENT_HOMEASSISTANT_STOP, - hass.config_entries._async_shutdown, - run_immediately=True, - ) - - # Load the registries - entity.async_setup(hass) - loader.async_setup(hass) - - # setup translation cache instead of calling translation.async_setup(hass) - hass.data[translation.TRANSLATION_FLATTEN_CACHE] = translation._TranslationCache(hass) - if load_registries: - with ( - patch.object(StoreWithoutWriteLoad, "async_load", return_value=None), - patch( - "homeassistant.helpers.area_registry.AreaRegistryStore", - StoreWithoutWriteLoad, - ), - patch( - "homeassistant.helpers.device_registry.DeviceRegistryStore", - StoreWithoutWriteLoad, - ), - patch( - "homeassistant.helpers.entity_registry.EntityRegistryStore", - StoreWithoutWriteLoad, - ), - patch( - "homeassistant.helpers.storage.Store", # Floor & label registry are different - StoreWithoutWriteLoad, - ), - patch( - "homeassistant.helpers.issue_registry.IssueRegistryStore", - StoreWithoutWriteLoad, - ), - patch( - "homeassistant.helpers.restore_state.RestoreStateData.async_setup_dump", - return_value=None, - ), - patch( - "homeassistant.helpers.restore_state.start.async_at_start", - ), - ): - await ar.async_load(hass) - await cr.async_load(hass) - await dr.async_load(hass) - await er.async_load(hass) - await fr.async_load(hass) - await ir.async_load(hass) - await lr.async_load(hass) - await rs.async_load(hass) - hass.data[bootstrap.DATA_REGISTRIES_LOADED] = None - - hass.set_state(CoreState.running) - - @callback - def clear_instance(event): - """Clear global instance.""" - INSTANCES.remove(hass) - - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_CLOSE, clear_instance) - - yield hass - - # Restore timezone, it is set when creating the hass object - dt_util.DEFAULT_TIME_ZONE = orig_tz - - -@asynccontextmanager -async def async_test_home_assistant_dev( - event_loop: asyncio.AbstractEventLoop | None = None, - load_registries: bool = True, - config_dir: str | None = None, -) -> AsyncGenerator[HomeAssistant]: - """Return a Home Assistant object pointing at test config dir. - - This should be copied from latest Home Assistant version, - currently Home Assistant Core 2024.9.0dev0 (2024-08-14). - https://github.com/home-assistant/core/blob/dev/tests/common.py - """ - hass = HomeAssistant(config_dir or get_test_config_dir()) - store = auth_store.AuthStore(hass) - hass.auth = auth.AuthManager(hass, store, {}, {}) - ensure_auth_manager_loaded(hass.auth) - INSTANCES.append(hass) - - orig_async_add_job = hass.async_add_job - orig_async_add_executor_job = hass.async_add_executor_job - orig_async_create_task_internal = hass.async_create_task_internal - orig_tz = dt_util.get_default_time_zone() - - def async_add_job(target, *args, eager_start: bool = False): - """Add job.""" - check_target = target - while isinstance(check_target, ft.partial): - check_target = check_target.func - - if isinstance(check_target, Mock) and not isinstance(target, AsyncMock): - fut = asyncio.Future() - fut.set_result(target(*args)) - return fut - - return orig_async_add_job(target, *args, eager_start=eager_start) - - def async_add_executor_job(target, *args): - """Add executor job.""" - check_target = target - while isinstance(check_target, ft.partial): - check_target = check_target.func - - if isinstance(check_target, Mock): - fut = asyncio.Future() - fut.set_result(target(*args)) - return fut - - return orig_async_add_executor_job(target, *args) - - def async_create_task_internal(coroutine, name=None, eager_start=True): - """Create task.""" - if isinstance(coroutine, Mock) and not isinstance(coroutine, AsyncMock): - fut = asyncio.Future() - fut.set_result(None) - return fut - - return orig_async_create_task_internal(coroutine, name, eager_start) - - hass.async_add_job = async_add_job - hass.async_add_executor_job = async_add_executor_job - hass.async_create_task_internal = async_create_task_internal - - hass.data[loader.DATA_CUSTOM_COMPONENTS] = {} - - hass.config.location_name = "test home" - hass.config.latitude = 32.87336 - hass.config.longitude = -117.22743 - hass.config.elevation = 0 - await hass.config.async_set_time_zone("US/Pacific") - hass.config.units = METRIC_SYSTEM - hass.config.media_dirs = {"local": get_test_config_dir("media")} - hass.config.skip_pip = True - hass.config.skip_pip_packages = [] - - hass.config_entries = config_entries.ConfigEntries( - hass, - { - "_": ( - "Not empty or else some bad checks for hass config in discovery.py" - " breaks" - ) - }, - ) - hass.bus.async_listen_once( - EVENT_HOMEASSISTANT_STOP, - hass.config_entries._async_shutdown, - ) - - # Load the registries - entity.async_setup(hass) - loader.async_setup(hass) - - # setup translation cache instead of calling translation.async_setup(hass) - hass.data[translation.TRANSLATION_FLATTEN_CACHE] = translation._TranslationCache( - hass - ) - if load_registries: - with ( - patch.object(StoreWithoutWriteLoad, - "async_load", return_value=None), - patch( - "homeassistant.helpers.area_registry.AreaRegistryStore", - StoreWithoutWriteLoad, - ), - patch( - "homeassistant.helpers.device_registry.DeviceRegistryStore", - StoreWithoutWriteLoad, - ), - patch( - "homeassistant.helpers.entity_registry.EntityRegistryStore", - StoreWithoutWriteLoad, - ), - patch( - "homeassistant.helpers.storage.Store", # Floor & label registry are different - StoreWithoutWriteLoad, - ), - patch( - "homeassistant.helpers.issue_registry.IssueRegistryStore", - StoreWithoutWriteLoad, - ), - patch( - "homeassistant.helpers.restore_state.RestoreStateData.async_setup_dump", - return_value=None, - ), - patch( - "homeassistant.helpers.restore_state.start.async_at_start", - ), - ): - await ar.async_load(hass) - await cr.async_load(hass) - await dr.async_load(hass) - await er.async_load(hass) - await fr.async_load(hass) - await ir.async_load(hass) - await lr.async_load(hass) - await rs.async_load(hass) - hass.data[bootstrap.DATA_REGISTRIES_LOADED] = None - - hass.set_state(CoreState.running) - - @callback - def clear_instance(event): - """Clear global instance.""" - # Give aiohttp one loop iteration to close - hass.loop.call_soon(INSTANCES.remove, hass) - - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_CLOSE, clear_instance) - - try: - yield hass - finally: - # Restore timezone, it is set when creating the hass object - dt_util.set_default_time_zone(orig_tz) - # Remove loop shutdown indicator to not interfere with additional hass objects - with suppress(AttributeError): - delattr(hass.loop, "_shutdown_run_callback_threadsafe") - - @ha.callback def ensure_auth_manager_loaded(auth_mgr): """Ensure an auth manager is considered loaded.""" @@ -615,7 +273,8 @@ async def mock_async_load(store): def mock_write_data(store, path, data_to_write): """Mock version of write data.""" # To ensure that the data can be serialized - data[store.key] = json_func.loads(json_func.dumps(data_to_write, cls=store._encoder)) + data[store.key] = json_func.loads( + json_func.dumps(data_to_write, cls=store._encoder)) async def mock_remove(store): """Remove data.""" @@ -697,7 +356,8 @@ async def _async_close_websession(event: ha.Event) -> None: clientsession.detach() - self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_close_websession) + self.hass.bus.async_listen_once( + EVENT_HOMEASSISTANT_STOP, _async_close_websession) self.client = await clientsession.ws_connect( "ws://localhost:8123/api/websocket", @@ -894,16 +554,20 @@ def create_config_entry( data: dict[str, Any] = None, options: dict[str, Any] = None, ) -> MockConfigEntry: - return MockConfigEntry( - version=1, - minor_version=0, - domain=DOMAIN, - title="", - data={"token": TOKEN, **(data or {})}, - source="user", - options={**(options or {})}, - unique_id="12345", - ) + config_entry_data = { + "version": 1, + "minor_version": 0, + "domain": DOMAIN, + "title": "", + "data": {"token": TOKEN, **(data or {})}, + "source": "user", + "options": {**(options or {})}, + "unique_id": "12345", + } + # legacy workaround for tests + if AwesomeVersion(HA_VERSION).dev: + config_entry_data["discovery_keys"] = {} + return MockConfigEntry(**config_entry_data) async def setup_integration(hass: ha.HomeAssistant, config_entry: MockConfigEntry) -> None: diff --git a/tests/conftest.py b/tests/conftest.py index d12ca0bffb2..92f1d24175e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -12,7 +12,6 @@ from typing import Any from unittest.mock import MagicMock, patch -from _pytest.assertion.util import _compare_eq_iterable from awesomeversion import AwesomeVersion import freezegun from homeassistant import loader @@ -52,8 +51,6 @@ ProxyClientSession, ResponseMocker, WSClient, - async_test_home_assistant_dev, - async_test_home_assistant_min_version, client_session_proxy, create_config_entry, dummy_repository_base, @@ -63,6 +60,12 @@ safe_json_dumps, setup_integration as common_setup_integration, ) +from tests.homeassistantfixtures.dev import ( + async_test_home_assistant as async_test_home_assistant_dev, +) +from tests.homeassistantfixtures.min import ( + async_test_home_assistant as async_test_home_assistant_min_version, +) # Set default logger logging.basicConfig(level=logging.INFO) diff --git a/tests/homeassistantfixtures/__init__.py b/tests/homeassistantfixtures/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/homeassistantfixtures/common.py b/tests/homeassistantfixtures/common.py new file mode 100644 index 00000000000..2976ea9c617 --- /dev/null +++ b/tests/homeassistantfixtures/common.py @@ -0,0 +1,39 @@ +from collections.abc import Mapping, Sequence +from pathlib import Path +from typing import Any, TypeVar + +from homeassistant import core as ha +from homeassistant.helpers import storage + +INSTANCES = [] +_T = TypeVar("_T", bound=Mapping[str, Any] | Sequence[Any]) + + +def get_test_config_dir(*add_path): + """Return a path to a test config dir.""" + return Path(Path(__file__).resolve().parent, "testing_config", *add_path) + + +@ha.callback +def ensure_auth_manager_loaded(auth_mgr): + """Ensure an auth manager is considered loaded.""" + store = auth_mgr._store + if store._users is None: + store._set_defaults() + + +class StoreWithoutWriteLoad(storage.Store[_T]): + """Fake store that does not write or load. Used for testing.""" + + async def async_save(self, *args: Any, **kwargs: Any) -> None: + """Save the data. + + This function is mocked out in tests. + """ + + @ha.callback + def async_save_delay(self, *args: Any, **kwargs: Any) -> None: + """Save data with an optional delay. + + This function is mocked out in tests. + """ diff --git a/tests/homeassistantfixtures/dev.py b/tests/homeassistantfixtures/dev.py new file mode 100644 index 00000000000..4bd00aa1a49 --- /dev/null +++ b/tests/homeassistantfixtures/dev.py @@ -0,0 +1,189 @@ +"""Return a Home Assistant object pointing at test config dir. + +This should be copied from latest Home Assistant version, +currently Home Assistant Core 2024.10.0dev0 (2024-09-26). +https://github.com/home-assistant/core/blob/dev/tests/common.py +""" + +from __future__ import annotations + +import asyncio +from collections.abc import AsyncGenerator +from contextlib import asynccontextmanager, suppress +import functools as ft +from unittest.mock import AsyncMock, Mock, patch + +from homeassistant import auth, bootstrap, config_entries, loader +from homeassistant.auth import auth_store +from homeassistant.const import EVENT_HOMEASSISTANT_CLOSE, EVENT_HOMEASSISTANT_STOP +from homeassistant.core import CoreState, HomeAssistant, callback +from homeassistant.helpers import ( + area_registry as ar, + category_registry as cr, + device_registry as dr, + entity, + entity_registry as er, + floor_registry as fr, + issue_registry as ir, + label_registry as lr, + restore_state as rs, + translation, +) +from homeassistant.util.async_ import _SHUTDOWN_RUN_CALLBACK_THREADSAFE +import homeassistant.util.dt as dt_util +from homeassistant.util.unit_system import METRIC_SYSTEM + +from .common import ( + INSTANCES, + StoreWithoutWriteLoad, + ensure_auth_manager_loaded, + get_test_config_dir, +) + + +@asynccontextmanager +async def async_test_home_assistant( + event_loop: asyncio.AbstractEventLoop | None = None, + load_registries: bool = True, + config_dir: str | None = None, + initial_state: CoreState = CoreState.running, +) -> AsyncGenerator[HomeAssistant]: + """Return a Home Assistant object pointing at test config dir.""" + hass = HomeAssistant(config_dir or get_test_config_dir()) + store = auth_store.AuthStore(hass) + hass.auth = auth.AuthManager(hass, store, {}, {}) + ensure_auth_manager_loaded(hass.auth) + INSTANCES.append(hass) + + orig_async_add_job = hass.async_add_job + orig_async_add_executor_job = hass.async_add_executor_job + orig_async_create_task_internal = hass.async_create_task_internal + orig_tz = dt_util.get_default_time_zone() + + def async_add_job(target, *args, eager_start: bool = False): + """Add job.""" + check_target = target + while isinstance(check_target, ft.partial): + check_target = check_target.func + + if isinstance(check_target, Mock) and not isinstance(target, AsyncMock): + fut = asyncio.Future() + fut.set_result(target(*args)) + return fut + + return orig_async_add_job(target, *args, eager_start=eager_start) + + def async_add_executor_job(target, *args): + """Add executor job.""" + check_target = target + while isinstance(check_target, ft.partial): + check_target = check_target.func + + if isinstance(check_target, Mock): + fut = asyncio.Future() + fut.set_result(target(*args)) + return fut + + return orig_async_add_executor_job(target, *args) + + def async_create_task_internal(coroutine, name=None, eager_start=True): + """Create task.""" + if isinstance(coroutine, Mock) and not isinstance(coroutine, AsyncMock): + fut = asyncio.Future() + fut.set_result(None) + return fut + + return orig_async_create_task_internal(coroutine, name, eager_start) + + hass.async_add_job = async_add_job + hass.async_add_executor_job = async_add_executor_job + hass.async_create_task_internal = async_create_task_internal + + hass.data[loader.DATA_CUSTOM_COMPONENTS] = {} + + hass.config.location_name = "test home" + hass.config.latitude = 32.87336 + hass.config.longitude = -117.22743 + hass.config.elevation = 0 + await hass.config.async_set_time_zone("US/Pacific") + hass.config.units = METRIC_SYSTEM + hass.config.media_dirs = {"local": get_test_config_dir("media")} + hass.config.skip_pip = True + hass.config.skip_pip_packages = [] + + hass.config_entries = config_entries.ConfigEntries( + hass, + {"_": ("Not empty or else some bad checks for hass config in discovery.py" " breaks")}, + ) + hass.bus.async_listen_once( + EVENT_HOMEASSISTANT_STOP, + hass.config_entries._async_shutdown, + ) + + # Load the registries + entity.async_setup(hass) + loader.async_setup(hass) + + # setup translation cache instead of calling translation.async_setup(hass) + hass.data[translation.TRANSLATION_FLATTEN_CACHE] = translation._TranslationCache( + hass) + if load_registries: + with ( + patch.object(StoreWithoutWriteLoad, + "async_load", return_value=None), + patch( + "homeassistant.helpers.area_registry.AreaRegistryStore", + StoreWithoutWriteLoad, + ), + patch( + "homeassistant.helpers.device_registry.DeviceRegistryStore", + StoreWithoutWriteLoad, + ), + patch( + "homeassistant.helpers.entity_registry.EntityRegistryStore", + StoreWithoutWriteLoad, + ), + patch( + "homeassistant.helpers.storage.Store", # Floor & label registry are different + StoreWithoutWriteLoad, + ), + patch( + "homeassistant.helpers.issue_registry.IssueRegistryStore", + StoreWithoutWriteLoad, + ), + patch( + "homeassistant.helpers.restore_state.RestoreStateData.async_setup_dump", + return_value=None, + ), + patch( + "homeassistant.helpers.restore_state.start.async_at_start", + ), + ): + await ar.async_load(hass) + await cr.async_load(hass) + await dr.async_load(hass) + await er.async_load(hass) + await fr.async_load(hass) + await ir.async_load(hass) + await lr.async_load(hass) + await rs.async_load(hass) + hass.data[bootstrap.DATA_REGISTRIES_LOADED] = None + + hass.set_state(initial_state) + + @callback + def clear_instance(event): + """Clear global instance.""" + # Give aiohttp one loop iteration to close + hass.loop.call_soon(INSTANCES.remove, hass) + + hass.bus.async_listen_once(EVENT_HOMEASSISTANT_CLOSE, clear_instance) + + try: + yield hass + finally: + # Restore timezone, it is set when creating the hass object + dt_util.set_default_time_zone(orig_tz) + # Remove loop shutdown indicator to not interfere with additional hass objects + with suppress(AttributeError): + delattr(hass.loop, _SHUTDOWN_RUN_CALLBACK_THREADSAFE) diff --git a/tests/homeassistantfixtures/min.py b/tests/homeassistantfixtures/min.py new file mode 100644 index 00000000000..a393d323727 --- /dev/null +++ b/tests/homeassistantfixtures/min.py @@ -0,0 +1,185 @@ +"""Return a Home Assistant object pointing at test config dir. + +This should be copied from the minimum supported version, +currently Home Assistant Core 2024.4.1. +""" + +from __future__ import annotations + +import asyncio +from collections.abc import AsyncGenerator +from contextlib import asynccontextmanager +import functools as ft +from unittest.mock import AsyncMock, Mock, patch + +from homeassistant import auth, bootstrap, config_entries, loader +from homeassistant.auth import auth_store +from homeassistant.const import EVENT_HOMEASSISTANT_CLOSE, EVENT_HOMEASSISTANT_STOP +from homeassistant.core import CoreState, HomeAssistant, callback +from homeassistant.helpers import ( + area_registry as ar, + category_registry as cr, + device_registry as dr, + entity, + entity_registry as er, + floor_registry as fr, + issue_registry as ir, + label_registry as lr, + restore_state as rs, + translation, +) +import homeassistant.util.dt as dt_util +from homeassistant.util.unit_system import METRIC_SYSTEM + +from .common import ( + INSTANCES, + StoreWithoutWriteLoad, + ensure_auth_manager_loaded, + get_test_config_dir, +) + + +# pylint: disable=protected-access +@asynccontextmanager +async def async_test_home_assistant( + event_loop: asyncio.AbstractEventLoop | None = None, + load_registries: bool = True, + config_dir: str | None = None, +) -> AsyncGenerator[HomeAssistant]: + """Return a Home Assistant object pointing at test config dir. + + This should be copied from the minimum supported version, + currently Home Assistant Core 2024.4.1. + """ + hass = HomeAssistant(config_dir or get_test_config_dir()) + store = auth_store.AuthStore(hass) + hass.auth = auth.AuthManager(hass, store, {}, {}) + ensure_auth_manager_loaded(hass.auth) + INSTANCES.append(hass) + + orig_async_add_job = hass.async_add_job + orig_async_add_executor_job = hass.async_add_executor_job + orig_async_create_task = hass.async_create_task + orig_tz = dt_util.DEFAULT_TIME_ZONE + + def async_add_job(target, *args, eager_start: bool = False): + """Add job.""" + check_target = target + while isinstance(check_target, ft.partial): + check_target = check_target.func + + if isinstance(check_target, Mock) and not isinstance(target, AsyncMock): + fut = asyncio.Future() + fut.set_result(target(*args)) + return fut + + return orig_async_add_job(target, *args, eager_start=eager_start) + + def async_add_executor_job(target, *args): + """Add executor job.""" + check_target = target + while isinstance(check_target, ft.partial): + check_target = check_target.func + + if isinstance(check_target, Mock): + fut = asyncio.Future() + fut.set_result(target(*args)) + return fut + + return orig_async_add_executor_job(target, *args) + + def async_create_task(coroutine, name=None, eager_start=False): + """Create task.""" + if isinstance(coroutine, Mock) and not isinstance(coroutine, AsyncMock): + fut = asyncio.Future() + fut.set_result(None) + return fut + + return orig_async_create_task(coroutine, name, eager_start) + + hass.async_add_job = async_add_job + hass.async_add_executor_job = async_add_executor_job + hass.async_create_task = async_create_task + + hass.data[loader.DATA_CUSTOM_COMPONENTS] = {} + + hass.config.location_name = "test home" + hass.config.latitude = 32.87336 + hass.config.longitude = -117.22743 + hass.config.elevation = 0 + hass.config.set_time_zone("US/Pacific") + hass.config.units = METRIC_SYSTEM + hass.config.media_dirs = {"local": get_test_config_dir("media")} + hass.config.skip_pip = True + hass.config.skip_pip_packages = [] + + hass.config_entries = config_entries.ConfigEntries( + hass, + {"_": ("Not empty or else some bad checks for hass config in discovery.py breaks")}, + ) + hass.bus.async_listen_once( + EVENT_HOMEASSISTANT_STOP, + hass.config_entries._async_shutdown, + run_immediately=True, + ) + + # Load the registries + entity.async_setup(hass) + loader.async_setup(hass) + + # setup translation cache instead of calling translation.async_setup(hass) + hass.data[translation.TRANSLATION_FLATTEN_CACHE] = translation._TranslationCache(hass) + if load_registries: + with ( + patch.object(StoreWithoutWriteLoad, "async_load", return_value=None), + patch( + "homeassistant.helpers.area_registry.AreaRegistryStore", + StoreWithoutWriteLoad, + ), + patch( + "homeassistant.helpers.device_registry.DeviceRegistryStore", + StoreWithoutWriteLoad, + ), + patch( + "homeassistant.helpers.entity_registry.EntityRegistryStore", + StoreWithoutWriteLoad, + ), + patch( + "homeassistant.helpers.storage.Store", # Floor & label registry are different + StoreWithoutWriteLoad, + ), + patch( + "homeassistant.helpers.issue_registry.IssueRegistryStore", + StoreWithoutWriteLoad, + ), + patch( + "homeassistant.helpers.restore_state.RestoreStateData.async_setup_dump", + return_value=None, + ), + patch( + "homeassistant.helpers.restore_state.start.async_at_start", + ), + ): + await ar.async_load(hass) + await cr.async_load(hass) + await dr.async_load(hass) + await er.async_load(hass) + await fr.async_load(hass) + await ir.async_load(hass) + await lr.async_load(hass) + await rs.async_load(hass) + hass.data[bootstrap.DATA_REGISTRIES_LOADED] = None + + hass.set_state(CoreState.running) + + @callback + def clear_instance(event): + """Clear global instance.""" + INSTANCES.remove(hass) + + hass.bus.async_listen_once(EVENT_HOMEASSISTANT_CLOSE, clear_instance) + + yield hass + + # Restore timezone, it is set when creating the hass object + dt_util.DEFAULT_TIME_ZONE = orig_tz diff --git a/tests/test_diagnostics.py b/tests/test_diagnostics.py index ab0afadac32..21108c1bb14 100644 --- a/tests/test_diagnostics.py +++ b/tests/test_diagnostics.py @@ -12,7 +12,8 @@ ) from tests.conftest import SnapshotFixture -REMOVE_KEYS = ("entry_id", "last_updated", "local", "minor_version", "created_at", "modified_at") +REMOVE_KEYS = ("entry_id", "last_updated", "local", "minor_version", + "created_at", "modified_at", "discovery_keys") async def test_diagnostics(hacs: HacsBase, snapshots: SnapshotFixture): @@ -24,7 +25,8 @@ async def test_diagnostics(hacs: HacsBase, snapshots: SnapshotFixture): assert TOKEN not in str(diagnostics) snapshots.assert_match( - safe_json_dumps(recursive_remove_key(diagnostics, REMOVE_KEYS)), "diagnostics/base.json" + safe_json_dumps(recursive_remove_key( + diagnostics, REMOVE_KEYS)), "diagnostics/base.json" ) From 9ac8420a4057a77dcaeba5b8527b09a78b951ddf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 17:32:07 +0200 Subject: [PATCH 069/140] Bump setuptools from 75.0.0 to 75.1.0 (#4081) Bumps [setuptools](https://github.com/pypa/setuptools) from 75.0.0 to 75.1.0. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v75.0.0...v75.1.0) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_base.txt b/requirements_base.txt index 4dd9cf94e17..ee85494433e 100644 --- a/requirements_base.txt +++ b/requirements_base.txt @@ -4,4 +4,4 @@ aiohttp_cors==0.7.0 async-timeout>=4.0.2 asynctest==0.13.0 colorlog==6.8.2 -setuptools==75.0.0 +setuptools==75.1.0 From e6b1999f4f95be79bb8863d6387fe2b85e777d86 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 17:32:25 +0200 Subject: [PATCH 070/140] Bump vulture from 2.11 to 2.12 (#4082) Bumps [vulture](https://github.com/jendrikseipp/vulture) from 2.11 to 2.12. - [Release notes](https://github.com/jendrikseipp/vulture/releases) - [Changelog](https://github.com/jendrikseipp/vulture/blob/main/CHANGELOG.md) - [Commits](https://github.com/jendrikseipp/vulture/compare/v2.11...v2.12) --- updated-dependencies: - dependency-name: vulture dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_lint.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_lint.txt b/requirements_lint.txt index f4cd7362e01..1f5607bd2b7 100644 --- a/requirements_lint.txt +++ b/requirements_lint.txt @@ -5,4 +5,4 @@ pre-commit==3.8.0 pre-commit-hooks==4.6.0 pyupgrade==3.17.0 ruff==0.6.5 -vulture==2.11 +vulture==2.12 From 51ded3173a073d4cc56fd91d2ec615e0da8e6561 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 17:36:12 +0200 Subject: [PATCH 071/140] Bump awscli from 1.34.19 to 1.34.27 (#4095) Bumps [awscli](https://github.com/aws/aws-cli) from 1.34.19 to 1.34.27. - [Release notes](https://github.com/aws/aws-cli/releases) - [Commits](https://github.com/aws/aws-cli/compare/1.34.19...1.34.27) --- updated-dependencies: - dependency-name: awscli dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_generate_data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_generate_data.txt b/requirements_generate_data.txt index 365e2d0d1d8..1900d585090 100644 --- a/requirements_generate_data.txt +++ b/requirements_generate_data.txt @@ -1,3 +1,3 @@ --requirement requirements_base.txt -awscli==1.34.19 +awscli==1.34.27 homeassistant==2024.3.3 From 6d29d72396554d397515d91277fe3755668dd07a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 18:09:28 +0200 Subject: [PATCH 072/140] Bump ruff from 0.6.5 to 0.6.8 (#4096) * Bump ruff from 0.6.5 to 0.6.8 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.5 to 0.6.8. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.6.5...0.6.8) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * lint --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: ludeeus --- requirements_lint.txt | 2 +- tests/common.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements_lint.txt b/requirements_lint.txt index 1f5607bd2b7..06334836387 100644 --- a/requirements_lint.txt +++ b/requirements_lint.txt @@ -4,5 +4,5 @@ isort==5.13.2 pre-commit==3.8.0 pre-commit-hooks==4.6.0 pyupgrade==3.17.0 -ruff==0.6.5 +ruff==0.6.8 vulture==2.12 diff --git a/tests/common.py b/tests/common.py index 342a27b50ab..0e68c347603 100644 --- a/tests/common.py +++ b/tests/common.py @@ -387,7 +387,7 @@ async def send_and_receive_json(self, type: str, payload: dict[str, Any]) -> dic class MockedResponse: def __init__(self, **kwargs) -> None: self.kwargs = kwargs - self.exception = kwargs.get("exception", None) + self.exception = kwargs.get("exception") self.keep = kwargs.get("keep", False) @property From c35ff366c63f3f72af9f987a96de10f11e53c182 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:26:39 +0200 Subject: [PATCH 073/140] Bump docker/build-push-action from 6.7.0 to 6.8.0 (#4102) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.7.0 to 6.8.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v6.7.0...v6.8.0) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/action-container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action-container.yml b/.github/workflows/action-container.yml index 23f325d9819..8750cdbcec8 100644 --- a/.github/workflows/action-container.yml +++ b/.github/workflows/action-container.yml @@ -52,7 +52,7 @@ jobs: type=sha - name: Build and push - uses: docker/build-push-action@v6.7.0 + uses: docker/build-push-action@v6.8.0 with: context: . file: action/Dockerfile From 6f74800e95aebff447497ae9771d93e2dc4f2909 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:27:16 +0200 Subject: [PATCH 074/140] Bump actions/checkout from 4.1.7 to 4.2.0 (#4103) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4.1.7...v4.2.0) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/action-container.yml | 2 +- .github/workflows/generate-hacs-data.yml | 4 ++-- .github/workflows/lint.yaml | 4 ++-- .github/workflows/publish.yml | 2 +- .github/workflows/pull_requests_labels.yml | 2 +- .github/workflows/pytest.yml | 4 ++-- .github/workflows/validate.yml | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/action-container.yml b/.github/workflows/action-container.yml index 8750cdbcec8..8aacb673441 100644 --- a/.github/workflows/action-container.yml +++ b/.github/workflows/action-container.yml @@ -30,7 +30,7 @@ jobs: permissions: packages: write steps: - - uses: actions/checkout@v4.1.7 + - uses: actions/checkout@v4.2.0 - name: Login to GitHub Container Registry uses: docker/login-action@v3.3.0 diff --git a/.github/workflows/generate-hacs-data.yml b/.github/workflows/generate-hacs-data.yml index a3d7b0fc351..f2f9d16c8a5 100644 --- a/.github/workflows/generate-hacs-data.yml +++ b/.github/workflows/generate-hacs-data.yml @@ -56,7 +56,7 @@ jobs: category: ${{ fromJSON( needs.generate-matrix.outputs.categories )}} steps: - name: Checkout the repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: Set up Python uses: actions/setup-python@v5.2.0 @@ -226,7 +226,7 @@ jobs: category: ${{ fromJSON(needs.summarize.outputs.changedCategories) }} steps: - name: Checkout the repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: Set up Python uses: actions/setup-python@v5.2.0 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 7ea67c0afb2..75af3419f51 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -31,7 +31,7 @@ jobs: - ruff-format steps: - name: Checkout the repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: Set up Python uses: actions/setup-python@v5.2.0 @@ -56,7 +56,7 @@ jobs: name: With JQ steps: - name: Checkout the repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: Run validation run: jq -r -e -c . tests/fixtures/*.json \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 06d90aad74e..8823872adcc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,7 +20,7 @@ jobs: contents: write steps: - name: 📥 Checkout the repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: 🛠️ Set up Python uses: actions/setup-python@v5.2.0 diff --git a/.github/workflows/pull_requests_labels.yml b/.github/workflows/pull_requests_labels.yml index 028ec56d492..a94661155ca 100644 --- a/.github/workflows/pull_requests_labels.yml +++ b/.github/workflows/pull_requests_labels.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: Check the labels uses: ludeeus/action-require-labels@1.1.0 diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 2fa542475d2..8d8ca7260c0 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 📥 Checkout the repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: 🛠️ Set up Python 3.12 uses: actions/setup-python@v5.2.0 @@ -58,7 +58,7 @@ jobs: - "3.12" steps: - name: 📥 Checkout the repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: 🛠️ Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5.2.0 diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 672de34875d..b0c0b47faf8 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -42,7 +42,7 @@ jobs: name: With hassfest steps: - name: Checkout the repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 # Test files conflict with running hassfest - name: Remove tests @@ -77,7 +77,7 @@ jobs: category: "plugin" steps: - name: Checkout the repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: Build Container run: | @@ -106,7 +106,7 @@ jobs: category: "plugin" steps: - name: Checkout the repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: Set up Python uses: actions/setup-python@v5.2.0 From 9c0817cbd593d5fe488ead4eefe861d0bad7d548 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:27:34 +0200 Subject: [PATCH 075/140] Bump awscli from 1.34.27 to 1.34.29 (#4104) Bumps [awscli](https://github.com/aws/aws-cli) from 1.34.27 to 1.34.29. - [Release notes](https://github.com/aws/aws-cli/releases) - [Commits](https://github.com/aws/aws-cli/compare/1.34.27...1.34.29) --- updated-dependencies: - dependency-name: awscli dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_generate_data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_generate_data.txt b/requirements_generate_data.txt index 1900d585090..4e13e527db1 100644 --- a/requirements_generate_data.txt +++ b/requirements_generate_data.txt @@ -1,3 +1,3 @@ --requirement requirements_base.txt -awscli==1.34.27 +awscli==1.34.29 homeassistant==2024.3.3 From c53e5bd7a9db8bf4b9e98429383844f8ecc2286c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Mon, 7 Oct 2024 16:35:00 +0200 Subject: [PATCH 076/140] Set min changed target to 5 (#4120) --- .github/workflows/generate-hacs-data.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/generate-hacs-data.yml b/.github/workflows/generate-hacs-data.yml index f2f9d16c8a5..13736cd47b9 100644 --- a/.github/workflows/generate-hacs-data.yml +++ b/.github/workflows/generate-hacs-data.yml @@ -157,10 +157,6 @@ jobs: if (!changedPctTarget) { if (!parsed.new_count || parsed.new_count <= 0) { changedPctTarget = 0; - } else if (parsed.new_count > 1500) { - changedPctTarget = 3; - } else if (parsed.new_count > 1000) { - changedPctTarget = 4; } else if (parsed.new_count > 750) { changedPctTarget = 5; } else if (parsed.new_count > 500) { From fc8a183f2590ef85c55fca93b41fda94e9862b94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 19:01:41 +0200 Subject: [PATCH 077/140] Bump restrictedpython from 7.2 to 7.3 (#4107) Bumps [restrictedpython](https://github.com/zopefoundation/RestrictedPython) from 7.2 to 7.3. - [Changelog](https://github.com/zopefoundation/RestrictedPython/blob/master/CHANGES.rst) - [Commits](https://github.com/zopefoundation/RestrictedPython/compare/7.2...7.3) --- updated-dependencies: - dependency-name: restrictedpython dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index c5b004a50e3..99786cddda1 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -6,4 +6,4 @@ pytest-asyncio==0.24.0 pytest-cov==5.0.0 pytest-snapshot==0.9.0 pytest-socket==0.7.0 -RestrictedPython==7.2 +RestrictedPython==7.3 From bb689a07ca0186474e121c23951c634196f7c58a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 19:01:58 +0200 Subject: [PATCH 078/140] Bump vulture from 2.12 to 2.13 (#4115) Bumps [vulture](https://github.com/jendrikseipp/vulture) from 2.12 to 2.13. - [Release notes](https://github.com/jendrikseipp/vulture/releases) - [Changelog](https://github.com/jendrikseipp/vulture/blob/main/CHANGELOG.md) - [Commits](https://github.com/jendrikseipp/vulture/compare/v2.12...v2.13) --- updated-dependencies: - dependency-name: vulture dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_lint.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_lint.txt b/requirements_lint.txt index 06334836387..0b06b913b20 100644 --- a/requirements_lint.txt +++ b/requirements_lint.txt @@ -5,4 +5,4 @@ pre-commit==3.8.0 pre-commit-hooks==4.6.0 pyupgrade==3.17.0 ruff==0.6.8 -vulture==2.12 +vulture==2.13 From 299433e0c419c0285973504dfde31e30b59466a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 19:02:52 +0200 Subject: [PATCH 079/140] Bump docker/build-push-action from 6.8.0 to 6.9.0 (#4119) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.8.0 to 6.9.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v6.8.0...v6.9.0) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/action-container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action-container.yml b/.github/workflows/action-container.yml index 8aacb673441..ec820a09ccf 100644 --- a/.github/workflows/action-container.yml +++ b/.github/workflows/action-container.yml @@ -52,7 +52,7 @@ jobs: type=sha - name: Build and push - uses: docker/build-push-action@v6.8.0 + uses: docker/build-push-action@v6.9.0 with: context: . file: action/Dockerfile From 9eeba494e18976ef89ae747d9299bf812b13dda3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 8 Oct 2024 21:42:05 +0200 Subject: [PATCH 080/140] =?UTF-8?q?Use=203.12-alpine=E2=81=A0=20in=20actio?= =?UTF-8?q?n=20container=20(#4126)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use 3.12-alpine⁠ in action container * Update action/Dockerfile --- action/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/action/Dockerfile b/action/Dockerfile index 04ff2fe256a..95b1d8b161d 100644 --- a/action/Dockerfile +++ b/action/Dockerfile @@ -1,5 +1,4 @@ -FROM python:alpine - +FROM python:3.12-alpine WORKDIR /hacs COPY . /hacs From 9d06e6c124f92b996955a6495b6ec26ccd3dbdf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Wed, 9 Oct 2024 08:25:58 +0200 Subject: [PATCH 081/140] Use uv to install action requirements (#4059) * Use uv to install action requirements * Bump aiogithubapi * Do tuf instead --- action/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/action/Dockerfile b/action/Dockerfile index 95b1d8b161d..4b038fcef40 100644 --- a/action/Dockerfile +++ b/action/Dockerfile @@ -5,7 +5,6 @@ COPY . /hacs ENV \ UV_SYSTEM_PYTHON=true \ - PIP_EXTRA_INDEX_URL="https://wheels.home-assistant.io/musllinux-index/" \ UV_EXTRA_INDEX_URL="https://wheels.home-assistant.io/musllinux-index/" RUN \ @@ -14,7 +13,7 @@ RUN \ apk add --no-cache --virtual .build-deps \ bash \ \ - && bash /hacs/scripts/install/pip_packages \ + && bash /hacs/scripts/install/uv_packages \ -r requirements_action.txt \ \ && bash /hacs/scripts/install/frontend \ From aab1e7d886c35ea1cf9fe87b19ff881dedc29f91 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 08:53:22 +0200 Subject: [PATCH 082/140] Bump ruff from 0.6.8 to 0.6.9 (#4117) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.8 to 0.6.9. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.6.8...0.6.9) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Joakim Sørensen --- requirements_lint.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_lint.txt b/requirements_lint.txt index 0b06b913b20..038b876ac30 100644 --- a/requirements_lint.txt +++ b/requirements_lint.txt @@ -4,5 +4,5 @@ isort==5.13.2 pre-commit==3.8.0 pre-commit-hooks==4.6.0 pyupgrade==3.17.0 -ruff==0.6.8 +ruff==0.6.9 vulture==2.13 From c7816a1a44e00933f23c9a94bac6680a89eb8a3b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:50:23 +0200 Subject: [PATCH 083/140] Bump pre-commit-hooks from 4.6.0 to 5.0.0 (#4118) Bumps [pre-commit-hooks](https://github.com/pre-commit/pre-commit-hooks) from 4.6.0 to 5.0.0. - [Release notes](https://github.com/pre-commit/pre-commit-hooks/releases) - [Changelog](https://github.com/pre-commit/pre-commit-hooks/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit-hooks/compare/v4.6.0...v5.0.0) --- updated-dependencies: - dependency-name: pre-commit-hooks dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_lint.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_lint.txt b/requirements_lint.txt index 038b876ac30..bf5743bff8a 100644 --- a/requirements_lint.txt +++ b/requirements_lint.txt @@ -2,7 +2,7 @@ codespell==2.3.0 isort==5.13.2 pre-commit==3.8.0 -pre-commit-hooks==4.6.0 +pre-commit-hooks==5.0.0 pyupgrade==3.17.0 ruff==0.6.9 vulture==2.13 From eb5608feb555efed0256f62d66a5adc666d68630 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:39:32 +0200 Subject: [PATCH 084/140] Bump pre-commit from 3.8.0 to 4.0.1 (#4124) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.8.0 to 4.0.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.8.0...v4.0.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_lint.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_lint.txt b/requirements_lint.txt index bf5743bff8a..bfc40310a78 100644 --- a/requirements_lint.txt +++ b/requirements_lint.txt @@ -1,7 +1,7 @@ --requirement requirements_base.txt codespell==2.3.0 isort==5.13.2 -pre-commit==3.8.0 +pre-commit==4.0.1 pre-commit-hooks==5.0.0 pyupgrade==3.17.0 ruff==0.6.9 From 2d5c1a506cca28086051a7c85667c3cefb88bbf4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:42:58 +0200 Subject: [PATCH 085/140] Bump awscli from 1.34.29 to 1.35.2 (#4127) Bumps [awscli](https://github.com/aws/aws-cli) from 1.34.29 to 1.35.2. - [Release notes](https://github.com/aws/aws-cli/releases) - [Commits](https://github.com/aws/aws-cli/compare/1.34.29...1.35.2) --- updated-dependencies: - dependency-name: awscli dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_generate_data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_generate_data.txt b/requirements_generate_data.txt index 4e13e527db1..1a8dd013e20 100644 --- a/requirements_generate_data.txt +++ b/requirements_generate_data.txt @@ -1,3 +1,3 @@ --requirement requirements_base.txt -awscli==1.34.29 +awscli==1.35.2 homeassistant==2024.3.3 From 91cf950e9bd366088021efe5d2ebab482ae4f39a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Mon, 28 Oct 2024 09:09:28 +0100 Subject: [PATCH 086/140] Adjust tests to ignore new update entity attributes (#4166) --- tests/conftest.py | 2 +- tests/test_switch.py | 12 ++++++++---- tests/test_update.py | 12 ++++++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 92f1d24175e..cbe91fbeb87 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -264,7 +264,7 @@ def _entity_state(entity: er.RegistryEntry) -> dict[str, Any]: state = hacs.hass.states.get(entity.entity_id) return { "state": state.state if state else None, - "attributes": state.attributes if state else None, + "attributes": recursive_remove_key(state.attributes, ("display_precision", "update_percentage")) if state else None, } snapshot.assert_match( diff --git a/tests/test_switch.py b/tests/test_switch.py index 29724fe89e2..d00374c6d71 100644 --- a/tests/test_switch.py +++ b/tests/test_switch.py @@ -64,7 +64,8 @@ async def test_switch_entity_state( MockedResponse(content=data), ) - er.async_update_entity(er.async_get_entity_id("switch", DOMAIN, repo.data.id), disabled_by=None) + er.async_update_entity(er.async_get_entity_id( + "switch", DOMAIN, repo.data.id), disabled_by=None) await hass.config_entries.async_reload(hacs.configuration.config_entry.entry_id) await hass.async_block_till_done() @@ -77,13 +78,15 @@ async def test_switch_entity_state( states[platform]["initial"] = recursive_remove_key( hass.states.get(entity_id).as_dict(), - ("id", "last_changed", "last_reported", "last_updated"), + ("id", "last_changed", "last_reported", "last_updated", + "display_precision", "update_percentage"), ) await hass.services.async_call( domain="switch", service="turn_on", - service_data={"entity_id": er.async_get_entity_id("switch", DOMAIN, repo.data.id)}, + service_data={"entity_id": er.async_get_entity_id( + "switch", DOMAIN, repo.data.id)}, blocking=True, ) @@ -92,7 +95,8 @@ async def test_switch_entity_state( assert entity_id is not None states[platform]["updated"] = recursive_remove_key( hass.states.get(entity_id).as_dict(), - ("id", "last_changed", "last_reported", "last_updated"), + ("id", "last_changed", "last_reported", "last_updated", + "display_precision", "update_percentage"), ) snapshots.assert_match( diff --git a/tests/test_update.py b/tests/test_update.py index 713c0a7bda8..58aaf424d6d 100644 --- a/tests/test_update.py +++ b/tests/test_update.py @@ -53,11 +53,13 @@ async def test_update_entity_state( # Get initial state state = hass.states.get(entity_id) initial_state = recursive_remove_key( - state.as_dict(), ("id", "last_changed", "last_reported", "last_updated"), + state.as_dict(), ("id", "last_changed", "last_reported", "last_updated", + "display_precision", "update_percentage"), ) # Bump version - fixture_file = f"fixtures/proxy/data-v2.hacs.xyz/{category_test_data['category']}/data.json" + fixture_file = f"fixtures/proxy/data-v2.hacs.xyz/{ + category_test_data['category']}/data.json" fp = os.path.join( os.path.dirname(__file__), fixture_file, @@ -83,10 +85,12 @@ async def test_update_entity_state( # Get updated state state = hass.states.get(entity_id) updated_state = recursive_remove_key( - state.as_dict(), ("id", "last_changed", "last_reported", "last_updated"), + state.as_dict(), ("id", "last_changed", "last_reported", "last_updated", + "display_precision", "update_percentage"), ) snapshots.assert_match( - safe_json_dumps({"initial_state": initial_state, "updated_state": updated_state}), + safe_json_dumps({"initial_state": initial_state, + "updated_state": updated_state}), f"{category_test_data['repository']}/test_update_entity_state.json", ) From 8bb3d25bddd8cdb7e5b82fe5fa7a9128af8456ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 5 Nov 2024 04:49:48 +0100 Subject: [PATCH 087/140] Do not set config_entry in option flow if HA > 24.11.99 (#4181) --- custom_components/hacs/config_flow.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/hacs/config_flow.py b/custom_components/hacs/config_flow.py index 6c368c601ca..ada9d11380c 100644 --- a/custom_components/hacs/config_flow.py +++ b/custom_components/hacs/config_flow.py @@ -196,7 +196,8 @@ class HacsOptionsFlowHandler(OptionsFlow): def __init__(self, config_entry): """Initialize HACS options flow.""" - self.config_entry = config_entry + if AwesomeVersion(HAVERSION) < "2024.11.99": + self.config_entry = config_entry async def async_step_init(self, _user_input=None): """Manage the options.""" From 317b4186b7da024babc52db26b59317428cfcdf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 5 Nov 2024 04:54:25 +0100 Subject: [PATCH 088/140] Update change pct targets (#4182) --- .github/workflows/generate-hacs-data.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate-hacs-data.yml b/.github/workflows/generate-hacs-data.yml index 13736cd47b9..e048e483459 100644 --- a/.github/workflows/generate-hacs-data.yml +++ b/.github/workflows/generate-hacs-data.yml @@ -158,11 +158,11 @@ jobs: if (!parsed.new_count || parsed.new_count <= 0) { changedPctTarget = 0; } else if (parsed.new_count > 750) { - changedPctTarget = 5; + changedPctTarget = 7; } else if (parsed.new_count > 500) { - changedPctTarget = 6; - } else if (parsed.new_count > 250) { changedPctTarget = 8; + } else if (parsed.new_count > 250) { + changedPctTarget = 9; } else if (parsed.new_count > 100) { changedPctTarget = 10; } else if (parsed.new_count > 75) { From 48780fba94de1a573bc9d2d62e637fb4d6fa33a4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:13:07 +0100 Subject: [PATCH 089/140] Bump actions/checkout from 4.2.0 to 4.2.2 (#4165) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4.2.0...v4.2.2) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/action-container.yml | 2 +- .github/workflows/generate-hacs-data.yml | 4 ++-- .github/workflows/lint.yaml | 4 ++-- .github/workflows/publish.yml | 2 +- .github/workflows/pull_requests_labels.yml | 2 +- .github/workflows/pytest.yml | 4 ++-- .github/workflows/validate.yml | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/action-container.yml b/.github/workflows/action-container.yml index ec820a09ccf..6240c54b8f1 100644 --- a/.github/workflows/action-container.yml +++ b/.github/workflows/action-container.yml @@ -30,7 +30,7 @@ jobs: permissions: packages: write steps: - - uses: actions/checkout@v4.2.0 + - uses: actions/checkout@v4.2.2 - name: Login to GitHub Container Registry uses: docker/login-action@v3.3.0 diff --git a/.github/workflows/generate-hacs-data.yml b/.github/workflows/generate-hacs-data.yml index e048e483459..e6fd7852f90 100644 --- a/.github/workflows/generate-hacs-data.yml +++ b/.github/workflows/generate-hacs-data.yml @@ -56,7 +56,7 @@ jobs: category: ${{ fromJSON( needs.generate-matrix.outputs.categories )}} steps: - name: Checkout the repository - uses: actions/checkout@v4.2.0 + uses: actions/checkout@v4.2.2 - name: Set up Python uses: actions/setup-python@v5.2.0 @@ -222,7 +222,7 @@ jobs: category: ${{ fromJSON(needs.summarize.outputs.changedCategories) }} steps: - name: Checkout the repository - uses: actions/checkout@v4.2.0 + uses: actions/checkout@v4.2.2 - name: Set up Python uses: actions/setup-python@v5.2.0 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 75af3419f51..2b8e05aa99c 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -31,7 +31,7 @@ jobs: - ruff-format steps: - name: Checkout the repository - uses: actions/checkout@v4.2.0 + uses: actions/checkout@v4.2.2 - name: Set up Python uses: actions/setup-python@v5.2.0 @@ -56,7 +56,7 @@ jobs: name: With JQ steps: - name: Checkout the repository - uses: actions/checkout@v4.2.0 + uses: actions/checkout@v4.2.2 - name: Run validation run: jq -r -e -c . tests/fixtures/*.json \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8823872adcc..31620a8d027 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,7 +20,7 @@ jobs: contents: write steps: - name: 📥 Checkout the repository - uses: actions/checkout@v4.2.0 + uses: actions/checkout@v4.2.2 - name: 🛠️ Set up Python uses: actions/setup-python@v5.2.0 diff --git a/.github/workflows/pull_requests_labels.yml b/.github/workflows/pull_requests_labels.yml index a94661155ca..65dbc9ae5a1 100644 --- a/.github/workflows/pull_requests_labels.yml +++ b/.github/workflows/pull_requests_labels.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4.2.0 + uses: actions/checkout@v4.2.2 - name: Check the labels uses: ludeeus/action-require-labels@1.1.0 diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 8d8ca7260c0..d571a8c549e 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 📥 Checkout the repository - uses: actions/checkout@v4.2.0 + uses: actions/checkout@v4.2.2 - name: 🛠️ Set up Python 3.12 uses: actions/setup-python@v5.2.0 @@ -58,7 +58,7 @@ jobs: - "3.12" steps: - name: 📥 Checkout the repository - uses: actions/checkout@v4.2.0 + uses: actions/checkout@v4.2.2 - name: 🛠️ Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5.2.0 diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index b0c0b47faf8..2543b1c07ea 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -42,7 +42,7 @@ jobs: name: With hassfest steps: - name: Checkout the repository - uses: actions/checkout@v4.2.0 + uses: actions/checkout@v4.2.2 # Test files conflict with running hassfest - name: Remove tests @@ -77,7 +77,7 @@ jobs: category: "plugin" steps: - name: Checkout the repository - uses: actions/checkout@v4.2.0 + uses: actions/checkout@v4.2.2 - name: Build Container run: | @@ -106,7 +106,7 @@ jobs: category: "plugin" steps: - name: Checkout the repository - uses: actions/checkout@v4.2.0 + uses: actions/checkout@v4.2.2 - name: Set up Python uses: actions/setup-python@v5.2.0 From 87c9a42fcb36f91efa55f62b5c34e04f9218d764 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:18:35 +0100 Subject: [PATCH 090/140] Bump actions/setup-python from 5.2.0 to 5.3.0 (#4164) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.2.0 to 5.3.0. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v5.2.0...v5.3.0) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/generate-hacs-data.yml | 4 ++-- .github/workflows/lint.yaml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/pytest.yml | 4 ++-- .github/workflows/validate.yml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/generate-hacs-data.yml b/.github/workflows/generate-hacs-data.yml index e6fd7852f90..950a193f46a 100644 --- a/.github/workflows/generate-hacs-data.yml +++ b/.github/workflows/generate-hacs-data.yml @@ -59,7 +59,7 @@ jobs: uses: actions/checkout@v4.2.2 - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.3.0 id: python with: python-version: "3.12" @@ -225,7 +225,7 @@ jobs: uses: actions/checkout@v4.2.2 - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.3.0 id: python with: python-version: "3.12" diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 2b8e05aa99c..f80dca78e83 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v4.2.2 - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.3.0 id: python with: python-version: "3.12" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 31620a8d027..2575ab9adc1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v4.2.2 - name: 🛠️ Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.3.0 with: python-version: "3.12" diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index d571a8c549e..a133c9f336f 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v4.2.2 - name: 🛠️ Set up Python 3.12 - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.3.0 with: python-version: "3.12" cache: 'pip' @@ -61,7 +61,7 @@ jobs: uses: actions/checkout@v4.2.2 - name: 🛠️ Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.3.0 with: python-version: ${{ matrix.python-version }} cache: 'pip' diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 2543b1c07ea..ce6b0008ad4 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -109,7 +109,7 @@ jobs: uses: actions/checkout@v4.2.2 - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5.3.0 with: python-version: "3.12" cache: 'pip' From c40edbf0ec73a9be49ebdcda934bd9d2588f62f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:23:44 +0100 Subject: [PATCH 091/140] Bump softprops/action-gh-release from 2.0.8 to 2.0.9 (#4173) Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.0.8 to 2.0.9. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v2.0.8...v2.0.9) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2575ab9adc1..085028cafbf 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,7 +57,7 @@ jobs: zip hacs.zip -r ./ - name: 📤 Upload zip to release - uses: softprops/action-gh-release@v2.0.8 + uses: softprops/action-gh-release@v2.0.9 if: ${{ github.event_name == 'release' }} with: files: ${{ github.workspace }}/custom_components/hacs/hacs.zip From 197a0bfa652b1ab8fd68c4d76e78e059e639a703 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:28:17 +0100 Subject: [PATCH 092/140] Bump actions/upload-artifact from 4.4.0 to 4.4.3 (#4137) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.4.0 to 4.4.3. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4.4.0...v4.4.3) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/generate-hacs-data.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/validate.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate-hacs-data.yml b/.github/workflows/generate-hacs-data.yml index 950a193f46a..11dd7394c75 100644 --- a/.github/workflows/generate-hacs-data.yml +++ b/.github/workflows/generate-hacs-data.yml @@ -106,7 +106,7 @@ jobs: core.summary.write() - name: Upload artifacts - uses: actions/upload-artifact@v4.4.0 + uses: actions/upload-artifact@v4.4.3 with: name: ${{ matrix.category }} path: | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 085028cafbf..a08720016c9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,7 +42,7 @@ jobs: run: ${{ github.workspace }}/scripts/install/frontend - name: 📤 Upload zip to action - uses: actions/upload-artifact@v4.4.0 + uses: actions/upload-artifact@v4.4.3 if: ${{ github.event_name == 'push' }} with: name: hacs diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index ce6b0008ad4..d74c58499f0 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -157,7 +157,7 @@ jobs: python3 -m scripts.data.validate_category_data ${{ matrix.entry.category }} outputdata/${{ matrix.entry.category }}/data.json - name: Upload artifact - uses: actions/upload-artifact@v4.4.0 + uses: actions/upload-artifact@v4.4.3 with: name: "${{ matrix.entry.category }}_${{ strategy.job-index }}" path: | From 3a89857fa3af9846e9c8c5d36cc0899dfdcf9b80 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:28:43 +0100 Subject: [PATCH 093/140] Bump restrictedpython from 7.3 to 7.4 (#4141) Bumps [restrictedpython](https://github.com/zopefoundation/RestrictedPython) from 7.3 to 7.4. - [Changelog](https://github.com/zopefoundation/RestrictedPython/blob/master/CHANGES.rst) - [Commits](https://github.com/zopefoundation/RestrictedPython/compare/7.3...7.4) --- updated-dependencies: - dependency-name: restrictedpython dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index 99786cddda1..8884eda6f29 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -6,4 +6,4 @@ pytest-asyncio==0.24.0 pytest-cov==5.0.0 pytest-snapshot==0.9.0 pytest-socket==0.7.0 -RestrictedPython==7.3 +RestrictedPython==7.4 From 5062d8c9ad8d9406c877e1c8cdd38d334d32703a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:39:09 +0100 Subject: [PATCH 094/140] Bump colorlog from 6.8.2 to 6.9.0 (#4177) Bumps [colorlog](https://github.com/borntyping/python-colorlog) from 6.8.2 to 6.9.0. - [Release notes](https://github.com/borntyping/python-colorlog/releases) - [Commits](https://github.com/borntyping/python-colorlog/compare/v6.8.2...v6.9.0) --- updated-dependencies: - dependency-name: colorlog dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_base.txt b/requirements_base.txt index ee85494433e..42cb20b35b7 100644 --- a/requirements_base.txt +++ b/requirements_base.txt @@ -3,5 +3,5 @@ aiohttp>=3.8.3,<4.0 aiohttp_cors==0.7.0 async-timeout>=4.0.2 asynctest==0.13.0 -colorlog==6.8.2 +colorlog==6.9.0 setuptools==75.1.0 From c716799422c81c998eb1dca4a2c9f56cb1e0d4a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:45:44 +0100 Subject: [PATCH 095/140] Bump ruff from 0.6.9 to 0.7.2 (#4174) Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.9 to 0.7.2. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.6.9...0.7.2) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_lint.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_lint.txt b/requirements_lint.txt index bfc40310a78..afbd6001dee 100644 --- a/requirements_lint.txt +++ b/requirements_lint.txt @@ -4,5 +4,5 @@ isort==5.13.2 pre-commit==4.0.1 pre-commit-hooks==5.0.0 pyupgrade==3.17.0 -ruff==0.6.9 +ruff==0.7.2 vulture==2.13 From aeb2a4426a75d7ae6647f1f9cc3f82dfe6875767 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 07:58:15 +0100 Subject: [PATCH 096/140] Bump docker/metadata-action from 5.5.1 to 5.6.1 (#4221) Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 5.5.1 to 5.6.1. - [Release notes](https://github.com/docker/metadata-action/releases) - [Commits](https://github.com/docker/metadata-action/compare/v5.5.1...v5.6.1) --- updated-dependencies: - dependency-name: docker/metadata-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/action-container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action-container.yml b/.github/workflows/action-container.yml index 6240c54b8f1..9cd6ba745e1 100644 --- a/.github/workflows/action-container.yml +++ b/.github/workflows/action-container.yml @@ -42,7 +42,7 @@ jobs: - name: Docker metadata id: meta - uses: docker/metadata-action@v5.5.1 + uses: docker/metadata-action@v5.6.1 with: images: | ghcr.io/${{ github.repository_owner }}/action From 463260759a02150e082ed61b25e21bdfac2c68e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Fri, 6 Dec 2024 08:20:10 +0100 Subject: [PATCH 097/140] Add Python 3.13 to tests (#4249) --- .github/workflows/pytest.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index a133c9f336f..f2a4a6afb7e 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -56,6 +56,7 @@ jobs: - "dev" python-version: - "3.12" + - "3.13" steps: - name: 📥 Checkout the repository uses: actions/checkout@v4.2.2 From abd03dbedffdbf6369bdbca346260a92d01f1b12 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 08:24:56 +0100 Subject: [PATCH 098/140] Bump pytest from 8.3.3 to 8.3.4 (#4242) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.3.3 to 8.3.4. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.3.3...8.3.4) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Joakim Sørensen --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index 8884eda6f29..cce8574e11d 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,7 +1,7 @@ --requirement requirements_base.txt asynctest==0.13.0 freezegun==1.5.1 -pytest==8.3.3 +pytest==8.3.4 pytest-asyncio==0.24.0 pytest-cov==5.0.0 pytest-snapshot==0.9.0 From 022db44738a3672346097cda7be48a70773b5312 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 14:53:39 +0100 Subject: [PATCH 099/140] Bump awscli from 1.35.2 to 1.36.17 (#4251) Bumps [awscli](https://github.com/aws/aws-cli) from 1.35.2 to 1.36.17. - [Release notes](https://github.com/aws/aws-cli/releases) - [Commits](https://github.com/aws/aws-cli/compare/1.35.2...1.36.17) --- updated-dependencies: - dependency-name: awscli dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_generate_data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_generate_data.txt b/requirements_generate_data.txt index 1a8dd013e20..a2b4f7d274f 100644 --- a/requirements_generate_data.txt +++ b/requirements_generate_data.txt @@ -1,3 +1,3 @@ --requirement requirements_base.txt -awscli==1.35.2 +awscli==1.36.17 homeassistant==2024.3.3 From b0b4188f9f88584a6e97889b3fa02d401c2daa15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Fri, 6 Dec 2024 14:58:16 +0100 Subject: [PATCH 100/140] Update issue templates (#4253) --- .github/ISSUE_TEMPLATE/a_integration.yml | 5 ++++- .github/ISSUE_TEMPLATE/b_frontend.yml | 11 +++++++++++ .github/ISSUE_TEMPLATE/c_bot.yml | 2 ++ .github/ISSUE_TEMPLATE/d_documentation.yml | 2 ++ .github/ISSUE_TEMPLATE/e_action.yml | 2 ++ .github/ISSUE_TEMPLATE/f_addon.yml | 11 +++++++++++ .github/ISSUE_TEMPLATE/removal.yml | 7 +++++++ 7 files changed, 39 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/a_integration.yml b/.github/ISSUE_TEMPLATE/a_integration.yml index 159f45f0ea8..79ea422914a 100644 --- a/.github/ISSUE_TEMPLATE/a_integration.yml +++ b/.github/ISSUE_TEMPLATE/a_integration.yml @@ -8,6 +8,8 @@ body: value: | Learn how to submit an issue here https://hacs.xyz/docs/help/issues/ Before you open a new issue, search through the existing issues to see if others have had the same problem. + + The issue template is not a suggestion, fill out everything that is asked. - type: textarea attributes: label: "System Health details" @@ -58,8 +60,9 @@ body: render: text validations: required: true - - type: textarea attributes: label: "Diagnostics dump" description: "Drag or paste the diagnostics dump file here. (see https://hacs.xyz/docs/use/troubleshooting/diagnostics/ for info)" + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/b_frontend.yml b/.github/ISSUE_TEMPLATE/b_frontend.yml index f7e1fa99fc3..266c7e74e9a 100644 --- a/.github/ISSUE_TEMPLATE/b_frontend.yml +++ b/.github/ISSUE_TEMPLATE/b_frontend.yml @@ -8,6 +8,8 @@ body: value: | Learn how to submit an issue here https://hacs.xyz/docs/help/issues/ Before you open a new issue, search through the existing issues to see if others have had the same problem. + + The issue template is not a suggestion, fill out everything that is asked. - type: markdown attributes: value: "## Installation details" @@ -76,7 +78,16 @@ body: render: text validations: required: true +- type: textarea + attributes: + label: "Debug logs" + description: "To enable debug logs check this https://hacs.xyz/docs/use/troubleshooting/logs/, this **needs** to include _everything_ from startup of Home Assistant to the point where you encounter the issue." + render: text + validations: + required: true - type: textarea attributes: label: "Diagnostics dump" description: "Drag or paste the diagnostics dump file here. (see https://hacs.xyz/docs/use/troubleshooting/diagnostics/ for info)" + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/c_bot.yml b/.github/ISSUE_TEMPLATE/c_bot.yml index a75cdc83809..2e66f30c4ea 100644 --- a/.github/ISSUE_TEMPLATE/c_bot.yml +++ b/.github/ISSUE_TEMPLATE/c_bot.yml @@ -8,6 +8,8 @@ body: value: | Learn how to submit an issue here https://hacs.xyz/docs/help/issues/ Before you open a new issue, search through the existing issues to see if others have had the same problem. + + The issue template is not a suggestion, fill out everything that is asked. - type: textarea attributes: label: Describe the issue diff --git a/.github/ISSUE_TEMPLATE/d_documentation.yml b/.github/ISSUE_TEMPLATE/d_documentation.yml index 62226198a2c..acad8a02c72 100644 --- a/.github/ISSUE_TEMPLATE/d_documentation.yml +++ b/.github/ISSUE_TEMPLATE/d_documentation.yml @@ -8,6 +8,8 @@ body: value: | Learn how to submit an issue here https://hacs.xyz/docs/help/issues/ Before you open a new issue, search through the existing issues to see if others have had the same problem. + + The issue template is not a suggestion, fill out everything that is asked. - type: textarea attributes: label: Describe the issue diff --git a/.github/ISSUE_TEMPLATE/e_action.yml b/.github/ISSUE_TEMPLATE/e_action.yml index 30e01f7913b..311e3ec9491 100644 --- a/.github/ISSUE_TEMPLATE/e_action.yml +++ b/.github/ISSUE_TEMPLATE/e_action.yml @@ -8,6 +8,8 @@ body: value: | Learn how to submit an issue here https://hacs.xyz/docs/help/issues/ Before you open a new issue, search through the existing issues to see if others have had the same problem. + + The issue template is not a suggestion, fill out everything that is asked. - type: textarea attributes: label: Describe the issue diff --git a/.github/ISSUE_TEMPLATE/f_addon.yml b/.github/ISSUE_TEMPLATE/f_addon.yml index a39a727a4c8..8f0ffab44ba 100644 --- a/.github/ISSUE_TEMPLATE/f_addon.yml +++ b/.github/ISSUE_TEMPLATE/f_addon.yml @@ -8,6 +8,8 @@ body: value: | Learn how to submit an issue here https://hacs.xyz/docs/help/issues/ Before you open a new issue, search through the existing issues to see if others have had the same problem. + + The issue template is not a suggestion, fill out everything that is asked. - type: checkboxes attributes: label: Checklist @@ -45,3 +47,12 @@ body: - type: textarea attributes: label: Supervisor logs + validations: + required: true + +- type: textarea + attributes: + label: "Diagnostics dump" + description: "Drag or paste the diagnostics dump file here. (see https://hacs.xyz/docs/use/troubleshooting/diagnostics/ for info)" + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/removal.yml b/.github/ISSUE_TEMPLATE/removal.yml index 567a899a2ea..64381b00bec 100644 --- a/.github/ISSUE_TEMPLATE/removal.yml +++ b/.github/ISSUE_TEMPLATE/removal.yml @@ -4,6 +4,13 @@ description: Flagging of repository that should be removed from HACS labels: flag assignees: ludeeus body: +- type: markdown + attributes: + value: | + Learn how to submit an issue here https://hacs.xyz/docs/help/issues/ + Before you open a new issue, search through the existing issues to see if others have had the same problem. + + The issue template is not a suggestion, fill out everything that is asked. - type: input id: repo attributes: From da266e406e2df141410397c4e1adcb008fb33ac2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 06:50:15 +0100 Subject: [PATCH 101/140] Bump pytest-cov from 5.0.0 to 6.0.0 (#4175) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 5.0.0 to 6.0.0. - [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest-cov/compare/v5.0.0...v6.0.0) --- updated-dependencies: - dependency-name: pytest-cov dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Joakim Sørensen --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index cce8574e11d..95f51ec09c5 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -3,7 +3,7 @@ asynctest==0.13.0 freezegun==1.5.1 pytest==8.3.4 pytest-asyncio==0.24.0 -pytest-cov==5.0.0 +pytest-cov==6.0.0 pytest-snapshot==0.9.0 pytest-socket==0.7.0 RestrictedPython==7.4 From 2d736cb6ff9a5b29a7fef1b9d328f584be13da6f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 06:52:12 +0100 Subject: [PATCH 102/140] Bump docker/build-push-action from 6.9.0 to 6.10.0 (#4239) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.9.0 to 6.10.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v6.9.0...v6.10.0) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/action-container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action-container.yml b/.github/workflows/action-container.yml index 9cd6ba745e1..c55b59a49a9 100644 --- a/.github/workflows/action-container.yml +++ b/.github/workflows/action-container.yml @@ -52,7 +52,7 @@ jobs: type=sha - name: Build and push - uses: docker/build-push-action@v6.9.0 + uses: docker/build-push-action@v6.10.0 with: context: . file: action/Dockerfile From f1509eb0be8483833725be042e10468e6bf62e7f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 07:06:11 +0100 Subject: [PATCH 103/140] Bump softprops/action-gh-release from 2.0.9 to 2.2.0 (#4271) Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.0.9 to 2.2.0. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v2.0.9...v2.2.0) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a08720016c9..123a94dc2b7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,7 +57,7 @@ jobs: zip hacs.zip -r ./ - name: 📤 Upload zip to release - uses: softprops/action-gh-release@v2.0.9 + uses: softprops/action-gh-release@v2.2.0 if: ${{ github.event_name == 'release' }} with: files: ${{ github.workspace }}/custom_components/hacs/hacs.zip From c0c4d3a31ac8e2b3076fb336719c96514f94a0be Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 07:08:10 +0100 Subject: [PATCH 104/140] Bump pytest-asyncio from 0.24.0 to 0.25.0 (#4270) Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.24.0 to 0.25.0. - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.24.0...v0.25.0) --- updated-dependencies: - dependency-name: pytest-asyncio dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index 95f51ec09c5..f6576191368 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -2,7 +2,7 @@ asynctest==0.13.0 freezegun==1.5.1 pytest==8.3.4 -pytest-asyncio==0.24.0 +pytest-asyncio==0.25.0 pytest-cov==6.0.0 pytest-snapshot==0.9.0 pytest-socket==0.7.0 From 095440c7b4d82a02bc4d3fd9e1c4adaff2d1ddb4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 08:04:52 +0100 Subject: [PATCH 105/140] Bump awscli from 1.36.17 to 1.36.25 (#4277) Bumps [awscli](https://github.com/aws/aws-cli) from 1.36.17 to 1.36.25. - [Release notes](https://github.com/aws/aws-cli/releases) - [Commits](https://github.com/aws/aws-cli/compare/1.36.17...1.36.25) --- updated-dependencies: - dependency-name: awscli dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_generate_data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_generate_data.txt b/requirements_generate_data.txt index a2b4f7d274f..230b3785e0e 100644 --- a/requirements_generate_data.txt +++ b/requirements_generate_data.txt @@ -1,3 +1,3 @@ --requirement requirements_base.txt -awscli==1.36.17 +awscli==1.36.25 homeassistant==2024.3.3 From 57fe6fd0bf2d9139f860b481e5e360f66e4c4bfc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 08:12:19 +0100 Subject: [PATCH 106/140] Bump setuptools from 75.1.0 to 75.6.0 (#4218) Bumps [setuptools](https://github.com/pypa/setuptools) from 75.1.0 to 75.6.0. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v75.1.0...v75.6.0) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_base.txt b/requirements_base.txt index 42cb20b35b7..bf087aefaf3 100644 --- a/requirements_base.txt +++ b/requirements_base.txt @@ -4,4 +4,4 @@ aiohttp_cors==0.7.0 async-timeout>=4.0.2 asynctest==0.13.0 colorlog==6.9.0 -setuptools==75.1.0 +setuptools==75.6.0 From ae36b8ca0a0d53ec3d7722ba4e158bc52e65a6cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 08:12:45 +0100 Subject: [PATCH 107/140] Bump vulture from 2.13 to 2.14 (#4258) Bumps [vulture](https://github.com/jendrikseipp/vulture) from 2.13 to 2.14. - [Release notes](https://github.com/jendrikseipp/vulture/releases) - [Changelog](https://github.com/jendrikseipp/vulture/blob/main/CHANGELOG.md) - [Commits](https://github.com/jendrikseipp/vulture/compare/v2.13...v2.14) --- updated-dependencies: - dependency-name: vulture dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_lint.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_lint.txt b/requirements_lint.txt index afbd6001dee..31161e976e7 100644 --- a/requirements_lint.txt +++ b/requirements_lint.txt @@ -5,4 +5,4 @@ pre-commit==4.0.1 pre-commit-hooks==5.0.0 pyupgrade==3.17.0 ruff==0.7.2 -vulture==2.13 +vulture==2.14 From 15cf38058c971f1cf9760da4ca09f0c377845dd5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 09:42:27 +0100 Subject: [PATCH 108/140] Bump pyupgrade from 3.17.0 to 3.19.1 (#4278) Bumps [pyupgrade](https://github.com/asottile/pyupgrade) from 3.17.0 to 3.19.1. - [Commits](https://github.com/asottile/pyupgrade/compare/v3.17.0...v3.19.1) --- updated-dependencies: - dependency-name: pyupgrade dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_lint.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_lint.txt b/requirements_lint.txt index 31161e976e7..4ab19b96f36 100644 --- a/requirements_lint.txt +++ b/requirements_lint.txt @@ -3,6 +3,6 @@ codespell==2.3.0 isort==5.13.2 pre-commit==4.0.1 pre-commit-hooks==5.0.0 -pyupgrade==3.17.0 +pyupgrade==3.19.1 ruff==0.7.2 vulture==2.14 From 5d53aa442cede12285b336053f5d04aed3be809b Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 20 Dec 2024 17:11:43 +0800 Subject: [PATCH 109/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Update=20rea?= =?UTF-8?q?dme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 928a5d3817a..eb7c7a0dfdd 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,10 @@ ```shell wget -O - https://get.hacs.vip | bash - + +# 或 + +curl -fsSL get.hacs.vip | DOMAIN=hacs bash ``` - 如果是haos/hassio/supervised版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 From 8097b8d9e9122bbbe512b4a233429b1fb2948c91 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 20 Dec 2024 17:14:07 +0800 Subject: [PATCH 110/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Update=20rea?= =?UTF-8?q?dme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eb7c7a0dfdd..7e36562287f 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ wget -O - https://get.hacs.vip | bash - # 或 -curl -fsSL get.hacs.vip | DOMAIN=hacs bash +curl -fsSL get.hacs.vip | bash ``` - 如果是haos/hassio/supervised版本的HA,可直接在宿主机或`Terminal & SSH`加载项中执行上面的命令 From 51e8da05bdc7a7cfeb79824174a2739dbb4afdea Mon Sep 17 00:00:00 2001 From: Alone Date: Mon, 23 Dec 2024 15:15:10 +0800 Subject: [PATCH 111/140] =?UTF-8?q?=F0=9F=8E=8A=20Add=20support=20login-fr?= =?UTF-8?q?ee?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/config_flow.py | 34 +++++++++++++++++-- custom_components/hacs/translations/en.json | 4 ++- .../hacs/translations/zh-Hans.json | 4 ++- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/custom_components/hacs/config_flow.py b/custom_components/hacs/config_flow.py index 560b3bca5ce..9eafa75ba1a 100644 --- a/custom_components/hacs/config_flow.py +++ b/custom_components/hacs/config_flow.py @@ -2,6 +2,7 @@ from __future__ import annotations +import aiohttp import asyncio from contextlib import suppress from typing import TYPE_CHECKING @@ -68,9 +69,13 @@ async def async_step_user(self, user_input): self._errors["base"] = "acc" return await self._show_config_form(user_input) - self._user_input = user_input - - return await self.async_step_device(user_input) + if not user_input.get('use_shared'): + self._user_input = user_input + return await self.async_step_device(user_input) + elif not await self.async_get_shard_token(): + self._errors['base'] = 'get_shared' + else: + return await self.async_step_device_done(user_input) # Initial form return await self._show_config_form(user_input) @@ -137,6 +142,7 @@ async def _show_config_form(self, user_input): step_id="user", data_schema=vol.Schema( { + vol.Optional("use_shared", default=user_input.get("use_shared", True)): bool, vol.Required("acc_logs", default=user_input.get("acc_logs", False)): bool, vol.Required("acc_addons", default=user_input.get("acc_addons", False)): bool, vol.Required( @@ -165,6 +171,7 @@ async def async_step_device_done(self, user_input: dict[str, bool] | None = None }, options={ "experimental": True, + "use_shared": user_input.get('use_shared', False), }, ) @@ -191,6 +198,27 @@ async def async_step_reauth_confirm(self, user_input=None): def async_get_options_flow(config_entry): return HacsOptionsFlowHandler(config_entry) + async def async_get_shard_token(self): + api = 'https://tokenhub.hacs.vip/api/token/get' + try: + integration = await async_get_integration(self.hass, DOMAIN) + http = aiohttp_client.async_get_clientsession(self.hass) + res = await http.get( + api, + timeout=aiohttp.ClientTimeout(total=10), + headers={ + 'User-Agent': f'HACS China/{integration.version}', + }, + ) + dat = await res.json() + token = dat.get('data', {}).get('token') + except Exception: + return None + self._activation = GitHubLoginOauthModel({ + 'access_token': token, + }) + return token + class HacsOptionsFlowHandler(OptionsFlow): """HACS config flow options handler.""" diff --git a/custom_components/hacs/translations/en.json b/custom_components/hacs/translations/en.json index d0c7dbe4b3a..b4fa43fcf87 100644 --- a/custom_components/hacs/translations/en.json +++ b/custom_components/hacs/translations/en.json @@ -9,11 +9,13 @@ }, "error": { "auth": "Personal Access Token is not correct", - "acc": "You need to acknowledge all the statements before continuing" + "acc": "You need to acknowledge all the statements before continuing", + "get_shared": "Get shared token failed, please try again" }, "step": { "user": { "data": { + "use_shared": "Use shared github token", "acc_logs": "I know how to access Home Assistant logs", "acc_addons": "I know that there are no add-ons in HACS", "acc_untested": "I know that everything inside HACS including HACS itself is custom and untested by Home Assistant", diff --git a/custom_components/hacs/translations/zh-Hans.json b/custom_components/hacs/translations/zh-Hans.json index d4c828ec3fa..af7d36c08fb 100644 --- a/custom_components/hacs/translations/zh-Hans.json +++ b/custom_components/hacs/translations/zh-Hans.json @@ -8,11 +8,13 @@ }, "error": { "auth": "个人访问令牌不正确", - "acc": "在继续之前,您需要勾选确认上一步的所有声明" + "acc": "在继续之前,您需要勾选确认上一步的所有声明", + "get_shared": "获取共享的Github令牌失败,请重试" }, "step": { "user": { "data": { + "use_shared": "使用共享的Github令牌(免登录)", "acc_logs": "我知道如何查看 Home Assistant 日志", "acc_addons": "我知道 HACS 中没有 Supervised 附加组件(add-ons)", "acc_untested": "我知道 HACS 中的一切都是由社区开发/维护,未经 Home Assistant 官方的测试", From 284da501365771f209d3272dc08d93a93c4c5115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Sat, 4 Jan 2025 20:15:16 +0100 Subject: [PATCH 112/140] Downgrade softprops/action-gh-release (#4316) --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 123a94dc2b7..407a2fe6cd7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,7 +57,7 @@ jobs: zip hacs.zip -r ./ - name: 📤 Upload zip to release - uses: softprops/action-gh-release@v2.2.0 + uses: softprops/action-gh-release@v2.1.0 if: ${{ github.event_name == 'release' }} with: files: ${{ github.workspace }}/custom_components/hacs/hacs.zip From 3959b6008bb935978ea2d9d2981a3743a2e80a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Sun, 5 Jan 2025 09:34:29 +0100 Subject: [PATCH 113/140] Guard set_repository_id during restore (#4315) --- custom_components/hacs/utils/data.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/custom_components/hacs/utils/data.py b/custom_components/hacs/utils/data.py index 7b548d9c378..f540272e62d 100644 --- a/custom_components/hacs/utils/data.py +++ b/custom_components/hacs/utils/data.py @@ -266,8 +266,13 @@ def async_restore_repository(self, entry: str, repository_data: dict[str, Any]): if not repository: return + try: + self.hacs.repositories.set_repository_id(repository, entry) + except ValueError as exception: + self.logger.warning(" duplicate IDs %s", exception) + return + # Restore repository attributes - self.hacs.repositories.set_repository_id(repository, entry) repository.data.authors = repository_data.get("authors", []) repository.data.description = repository_data.get("description", "") repository.data.downloads = repository_data.get("downloads", 0) From 4e825b2d84daa8054bfb3f54a1a4d3da7add5a17 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 15:00:45 +0100 Subject: [PATCH 114/140] Bump actions/upload-artifact from 4.4.3 to 4.5.0 (#4288) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.4.3 to 4.5.0. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4.4.3...v4.5.0) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/generate-hacs-data.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/validate.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate-hacs-data.yml b/.github/workflows/generate-hacs-data.yml index 11dd7394c75..f8a0850b403 100644 --- a/.github/workflows/generate-hacs-data.yml +++ b/.github/workflows/generate-hacs-data.yml @@ -106,7 +106,7 @@ jobs: core.summary.write() - name: Upload artifacts - uses: actions/upload-artifact@v4.4.3 + uses: actions/upload-artifact@v4.5.0 with: name: ${{ matrix.category }} path: | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 407a2fe6cd7..af566f42a9c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,7 +42,7 @@ jobs: run: ${{ github.workspace }}/scripts/install/frontend - name: 📤 Upload zip to action - uses: actions/upload-artifact@v4.4.3 + uses: actions/upload-artifact@v4.5.0 if: ${{ github.event_name == 'push' }} with: name: hacs diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index d74c58499f0..b7a82ca58b0 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -157,7 +157,7 @@ jobs: python3 -m scripts.data.validate_category_data ${{ matrix.entry.category }} outputdata/${{ matrix.entry.category }}/data.json - name: Upload artifact - uses: actions/upload-artifact@v4.4.3 + uses: actions/upload-artifact@v4.5.0 with: name: "${{ matrix.entry.category }}_${{ strategy.job-index }}" path: | From d2776738143d11c0b6ff76b7929817db6ded25fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 14:24:03 +0100 Subject: [PATCH 115/140] Bump awscli from 1.36.25 to 1.36.33 (#4326) Bumps [awscli](https://github.com/aws/aws-cli) from 1.36.25 to 1.36.33. - [Release notes](https://github.com/aws/aws-cli/releases) - [Commits](https://github.com/aws/aws-cli/compare/1.36.25...1.36.33) --- updated-dependencies: - dependency-name: awscli dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_generate_data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_generate_data.txt b/requirements_generate_data.txt index 230b3785e0e..67562045b0a 100644 --- a/requirements_generate_data.txt +++ b/requirements_generate_data.txt @@ -1,3 +1,3 @@ --requirement requirements_base.txt -awscli==1.36.25 +awscli==1.36.33 homeassistant==2024.3.3 From 7718544ca347ac199da4229b1e54a4d393178129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 7 Jan 2025 15:08:55 +0100 Subject: [PATCH 116/140] Mock out the zeroconf resolver (#4338) * Mock out the zeroconf resolver * make it conditional * Fix it --- tests/conftest.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index cbe91fbeb87..a2f0723757f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,8 +10,9 @@ import os import shutil from typing import Any -from unittest.mock import MagicMock, patch +from unittest.mock import MagicMock, _patch, patch +from aiohttp import AsyncResolver from awesomeversion import AwesomeVersion import freezegun from homeassistant import loader @@ -108,6 +109,23 @@ def hass_storage(): yield stored_data +@pytest.fixture(autouse=True, scope="session") +def mock_zeroconf_resolver() -> Generator[_patch]: + """Mock out the zeroconf resolver.""" + if AwesomeVersion(HA_VERSION) < "2025.2.0dev0": + yield None + else: + patcher = patch( + "homeassistant.helpers.aiohttp_client._async_make_resolver", + return_value=AsyncResolver(), + ) + patcher.start() + try: + yield patcher + finally: + patcher.stop() + + @pytest.fixture async def hass(time_freezer, event_loop, tmpdir, check_report_issue: None): """Fixture to provide a test instance of Home Assistant.""" From 97ce57821b589018179b964c98c7534582a8e2db Mon Sep 17 00:00:00 2001 From: Alone Date: Sun, 12 Jan 2025 13:30:57 +0800 Subject: [PATCH 117/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Add=20proxy?= =?UTF-8?q?=20server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 34 ++++++++++++++++++- custom_components/hacs/base.py | 5 +++ .../hacs/utils/configuration_schema.py | 1 + 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e36562287f..17ccbff07d7 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,39 @@ curl -fsSL get.hacs.vip | bash 3. 在开发者工具中执行动作 [`action: shell_command.update_hacs_china`](https://my.home-assistant.io/redirect/developer_call_service/?service=shell_command.update_hacs_china) 4. 再次重启HA使更新后的HACS生效 -#### 方法5️⃣: 手动安装 +#### 方法5️⃣: [`Docker安装`](https://hub.docker.com/r/hacn/hacn) + +> 仅针对未安装HACS的**Docker**版本的HA + +1. 使用命令方式安装 + ```bash + docker run -d \ + --name homeassistant \ + --privileged \ + --restart=unless-stopped \ + -e TZ=Asia/Shanghai \ + -v /PATH_TO_YOUR_CONFIG:/config \ + -v /run/dbus:/run/dbus:ro \ + --network=host \ + hacn/hacn:stable + ``` +2. 使用Compose安装 + ```yaml + services: + homeassistant: + container_name: homeassistant + image: hacn/hacn:stable + volumes: + - /PATH_TO_YOUR_CONFIG:/config + - /etc/localtime:/etc/localtime:ro + - /run/dbus:/run/dbus:ro + restart: unless-stopped + privileged: true + network_mode: host + ``` +3. 启动后[添加HACS集成](https://my.home-assistant.io/redirect/config_flow_start/?domain=hacs) + +#### 方法6️⃣: 手动安装 - [点击这里下载](https://github.com/hacs-china/integration/releases/latest/download/hacs.zip)安装包并解压 (如果下载不了请点[这里](https://ghproxy.com/github.com/hacs-china/integration/releases/latest/download/hacs.zip)或[这里](https://hub.fastgit.xyz/hacs-china/integration/releases/latest/download/hacs.zip)) - 通过samba/ftp进入HA配置目录,通常为以下目录: diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 992bf36f869..1356e56a39f 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -691,6 +691,11 @@ async def async_download_file( return None mirrors = { + "hacs-china": { + "raw": "https://ghrp2.hacs.vip/raw", + "archive": "https://ghrp2.hacs.vip", + "release": "https://ghrp2.hacs.vip", + }, "hacs.vip": { "raw": "https://ghrp.hacs.vip/raw", "archive": "https://ghrp.hacs.vip", diff --git a/custom_components/hacs/utils/configuration_schema.py b/custom_components/hacs/utils/configuration_schema.py index 01f8cba3c6f..94264aa25f9 100644 --- a/custom_components/hacs/utils/configuration_schema.py +++ b/custom_components/hacs/utils/configuration_schema.py @@ -11,5 +11,6 @@ GITHUB_APIS = { 'https://api.github.com': 'api.github.com (Github官方服务器)', 'https://ghapi.hacs.vip': 'ghapi.hacs.vip (极速版官方服务器)', + 'https://ghapi2.hacs.vip': 'ghapi2.hacs.vip (极速版备用服务器)', 'https://ghapi-cf.hacs.vip/api': 'ghapi-cf.hacs.vip (Cloudflare)', } From 004571fbfd82c65b79b305bccc79fc0340cf27e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 14 Jan 2025 07:01:16 +0100 Subject: [PATCH 118/140] Remove additional check for .can_download (#4370) --- custom_components/hacs/repositories/base.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/custom_components/hacs/repositories/base.py b/custom_components/hacs/repositories/base.py index 8e1caf90f2d..c5470d7e171 100644 --- a/custom_components/hacs/repositories/base.py +++ b/custom_components/hacs/repositories/base.py @@ -927,9 +927,6 @@ async def async_install_repository(self, *, version: str | None = None, **_) -> raise HacsException("repository.content.path.local is None") self.validate.errors.clear() - if not self.can_download: - raise HacsException("The version of Home Assistant is not compatible with this version") - version_to_install = version or self.version_to_download() if version_to_install == self.data.default_branch: self.ref = version_to_install From 8a341535e311f35231575955d96d51dad60eaf7b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 07:01:39 +0100 Subject: [PATCH 119/140] Bump pytest-asyncio from 0.25.0 to 0.25.2 (#4367) Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.25.0 to 0.25.2. - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.25.0...v0.25.2) --- updated-dependencies: - dependency-name: pytest-asyncio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index f6576191368..c7caeed45ef 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -2,7 +2,7 @@ asynctest==0.13.0 freezegun==1.5.1 pytest==8.3.4 -pytest-asyncio==0.25.0 +pytest-asyncio==0.25.2 pytest-cov==6.0.0 pytest-snapshot==0.9.0 pytest-socket==0.7.0 From e89ad71944c44eef37d878a216d1da8368370133 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 07:02:04 +0100 Subject: [PATCH 120/140] Bump setuptools from 75.6.0 to 75.8.0 (#4364) Bumps [setuptools](https://github.com/pypa/setuptools) from 75.6.0 to 75.8.0. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v75.6.0...v75.8.0) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_base.txt b/requirements_base.txt index bf087aefaf3..5528d5b29c1 100644 --- a/requirements_base.txt +++ b/requirements_base.txt @@ -4,4 +4,4 @@ aiohttp_cors==0.7.0 async-timeout>=4.0.2 asynctest==0.13.0 colorlog==6.9.0 -setuptools==75.6.0 +setuptools==75.8.0 From 493ee334acc3fb76a50bc0dc1eba90eef2b8d436 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 07:02:58 +0100 Subject: [PATCH 121/140] Bump actions/upload-artifact from 4.5.0 to 4.6.0 (#4361) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.5.0 to 4.6.0. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4.5.0...v4.6.0) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/generate-hacs-data.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/validate.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate-hacs-data.yml b/.github/workflows/generate-hacs-data.yml index f8a0850b403..a3d97c780d0 100644 --- a/.github/workflows/generate-hacs-data.yml +++ b/.github/workflows/generate-hacs-data.yml @@ -106,7 +106,7 @@ jobs: core.summary.write() - name: Upload artifacts - uses: actions/upload-artifact@v4.5.0 + uses: actions/upload-artifact@v4.6.0 with: name: ${{ matrix.category }} path: | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index af566f42a9c..d86d558ff4d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,7 +42,7 @@ jobs: run: ${{ github.workspace }}/scripts/install/frontend - name: 📤 Upload zip to action - uses: actions/upload-artifact@v4.5.0 + uses: actions/upload-artifact@v4.6.0 if: ${{ github.event_name == 'push' }} with: name: hacs diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index b7a82ca58b0..d62dfef4ae6 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -157,7 +157,7 @@ jobs: python3 -m scripts.data.validate_category_data ${{ matrix.entry.category }} outputdata/${{ matrix.entry.category }}/data.json - name: Upload artifact - uses: actions/upload-artifact@v4.5.0 + uses: actions/upload-artifact@v4.6.0 with: name: "${{ matrix.entry.category }}_${{ strategy.job-index }}" path: | From e60db6e3259441f343d423b37c157c29a39c3d2b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 07:10:05 +0100 Subject: [PATCH 122/140] Bump awscli from 1.36.33 to 1.36.39 (#4371) Bumps [awscli](https://github.com/aws/aws-cli) from 1.36.33 to 1.36.39. - [Release notes](https://github.com/aws/aws-cli/releases) - [Commits](https://github.com/aws/aws-cli/compare/1.36.33...1.36.39) --- updated-dependencies: - dependency-name: awscli dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_generate_data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_generate_data.txt b/requirements_generate_data.txt index 67562045b0a..d5a0be489a9 100644 --- a/requirements_generate_data.txt +++ b/requirements_generate_data.txt @@ -1,3 +1,3 @@ --requirement requirements_base.txt -awscli==1.36.33 +awscli==1.36.39 homeassistant==2024.3.3 From 2d8f558d04e122fa14a2fb85b406372f824fc4e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 07:13:30 +0100 Subject: [PATCH 123/140] Bump docker/build-push-action from 6.10.0 to 6.11.0 (#4363) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.10.0 to 6.11.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v6.10.0...v6.11.0) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/action-container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action-container.yml b/.github/workflows/action-container.yml index c55b59a49a9..51ff6cdb85e 100644 --- a/.github/workflows/action-container.yml +++ b/.github/workflows/action-container.yml @@ -52,7 +52,7 @@ jobs: type=sha - name: Build and push - uses: docker/build-push-action@v6.10.0 + uses: docker/build-push-action@v6.11.0 with: context: . file: action/Dockerfile From e2a4c4f602519a23f228c4b387e468c4e9efb343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Wed, 15 Jan 2025 08:08:43 +0100 Subject: [PATCH 124/140] Remove python 3.12 from dev tests (#4375) Only do dev test against Python 3.13 --- .github/workflows/pytest.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index f2a4a6afb7e..c2c56896a4a 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -55,7 +55,6 @@ jobs: homeassistant-version: - "dev" python-version: - - "3.12" - "3.13" steps: - name: 📥 Checkout the repository From d95ce250233f3fc24343394b3a7f9f35bcfceb25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Wed, 15 Jan 2025 13:07:28 +0100 Subject: [PATCH 125/140] Bump frontend to 20250115072642 (#4376) --- scripts/install/frontend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install/frontend b/scripts/install/frontend index 46858694009..5fee83ba478 100755 --- a/scripts/install/frontend +++ b/scripts/install/frontend @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/../.." -FRONTEND_VERSION="20240903140523" +FRONTEND_VERSION="20250115072642" function installFrontendFromGitHub() { # Temporarily disable exit on error From 512fa29ce97fb66a9ab12d1b9b6718bb3da0a527 Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 21 Jan 2025 10:37:32 +0800 Subject: [PATCH 126/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Merge=20hacs?= =?UTF-8?q?=20v2.0.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hacs/translations/zh-Hans.json | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/custom_components/hacs/translations/zh-Hans.json b/custom_components/hacs/translations/zh-Hans.json index af7d36c08fb..109d3c9f466 100644 --- a/custom_components/hacs/translations/zh-Hans.json +++ b/custom_components/hacs/translations/zh-Hans.json @@ -7,7 +7,7 @@ "not_setup": "HACS 未安装" }, "error": { - "auth": "个人访问令牌不正确", + "auth": "Github令牌不正确", "acc": "在继续之前,您需要勾选确认上一步的所有声明", "get_shared": "获取共享的Github令牌失败,请重试" }, @@ -25,6 +25,10 @@ }, "device": { "title": "等待设备激活" + }, + "reauth_confirm": { + "title": "需要重新授权", + "description": "Github令牌已失效,需要重新授权" } }, "progress": { @@ -34,6 +38,7 @@ "options": { "abort": { "not_setup": "HACS 未安装", + "pending_tasks": "任务正在进行中,请稍后再试", "release_limit_value": "版本数量限制在1到100" }, "step": { @@ -53,5 +58,33 @@ } } } + }, + "issues": { + "restart_required": { + "title": "需要重启", + "fix_flow": { + "step": { + "confirm_restart": { + "title": "需要重启", + "description": "重启 Home Assistant 以完成安装或更新 {name},点击提交立即重启" + } + } + } + }, + "removed": { + "title": "仓库已从 HACS 移除", + "description": "因为 {reason}, `{name}` 已从 HACS 移除, 请访问 [HACS 面板](/hacs/repository/{repositry_id}) 去移除它。" + } + }, + "entity": { + "switch": { + "pre-release": { + "name": "预发布", + "state": { + "off": "无预发布", + "on": "预发布优先" + } + } + } } } \ No newline at end of file From ad7fbe6353b3a7752bc85237fe03c2831d794151 Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 21 Jan 2025 17:01:31 +0800 Subject: [PATCH 127/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20hacs=20for?= =?UTF-8?q?=20china?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/install/frontend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install/frontend b/scripts/install/frontend index 46858694009..c035e8561f3 100755 --- a/scripts/install/frontend +++ b/scripts/install/frontend @@ -12,7 +12,7 @@ function installFrontendFromGitHub() { # Attempt to install the specified frontend version from GitHub scripts/install/pip_packages \ --target=./custom_components/hacs \ - "https://github.com/hacs/frontend/releases/download/${FRONTEND_VERSION}/hacs_frontend-${FRONTEND_VERSION}-py3-none-any.whl" + "https://github.com/hacs-china/frontend/releases/download/${FRONTEND_VERSION}/hacs_frontend-${FRONTEND_VERSION}-py3-none-any.whl" # Re-enable exit on error set -e } From 24d3bebd686d75cb1b884211929c1110fa3aa3ea Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 22 Jan 2025 12:38:21 +0800 Subject: [PATCH 128/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20hacs=20for?= =?UTF-8?q?=20china?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/install/frontend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install/frontend b/scripts/install/frontend index c035e8561f3..3daec5c2670 100755 --- a/scripts/install/frontend +++ b/scripts/install/frontend @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/../.." -FRONTEND_VERSION="20240903140523" +FRONTEND_VERSION="20240903140524" function installFrontendFromGitHub() { # Temporarily disable exit on error From 58f3f1cc12b8d7462682ef530879da0ebdf874de Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 22 Jan 2025 13:19:35 +0800 Subject: [PATCH 129/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20hacs=20for?= =?UTF-8?q?=20china?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/install/frontend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install/frontend b/scripts/install/frontend index 3daec5c2670..c035e8561f3 100755 --- a/scripts/install/frontend +++ b/scripts/install/frontend @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/../.." -FRONTEND_VERSION="20240903140524" +FRONTEND_VERSION="20240903140523" function installFrontendFromGitHub() { # Temporarily disable exit on error From 1fd9cd6941a53b9b71b9f4a94ca72780c9a30db3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 08:41:22 +0100 Subject: [PATCH 130/140] Bump docker/build-push-action from 6.11.0 to 6.12.0 (#4388) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.11.0 to 6.12.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v6.11.0...v6.12.0) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/action-container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action-container.yml b/.github/workflows/action-container.yml index 51ff6cdb85e..1d28d9ebcaf 100644 --- a/.github/workflows/action-container.yml +++ b/.github/workflows/action-container.yml @@ -52,7 +52,7 @@ jobs: type=sha - name: Build and push - uses: docker/build-push-action@v6.11.0 + uses: docker/build-push-action@v6.12.0 with: context: . file: action/Dockerfile From b05895b2018362d09d181ba51f7d397ad48dd455 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 08:41:47 +0100 Subject: [PATCH 131/140] Bump awscli from 1.36.39 to 1.37.2 (#4386) Bumps [awscli](https://github.com/aws/aws-cli) from 1.36.39 to 1.37.2. - [Release notes](https://github.com/aws/aws-cli/releases) - [Commits](https://github.com/aws/aws-cli/compare/1.36.39...1.37.2) --- updated-dependencies: - dependency-name: awscli dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements_generate_data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_generate_data.txt b/requirements_generate_data.txt index d5a0be489a9..358d46e1212 100644 --- a/requirements_generate_data.txt +++ b/requirements_generate_data.txt @@ -1,3 +1,3 @@ --requirement requirements_base.txt -awscli==1.36.39 +awscli==1.37.2 homeassistant==2024.3.3 From 4a820e8b1b066bc54a1c9c61102038af6c030603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Thu, 23 Jan 2025 09:44:44 +0100 Subject: [PATCH 132/140] Revert "Bump awscli from 1.36.39 to 1.37.2" (#4390) Revert "Bump awscli from 1.36.39 to 1.37.2 (#4386)" This reverts commit b05895b2018362d09d181ba51f7d397ad48dd455. --- requirements_generate_data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_generate_data.txt b/requirements_generate_data.txt index 358d46e1212..d5a0be489a9 100644 --- a/requirements_generate_data.txt +++ b/requirements_generate_data.txt @@ -1,3 +1,3 @@ --requirement requirements_base.txt -awscli==1.37.2 +awscli==1.36.39 homeassistant==2024.3.3 From 96379dadc09a45d69081be34f142b70531579a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Mon, 27 Jan 2025 11:56:29 +0100 Subject: [PATCH 133/140] Handle deprecation in lovelace data (#4402) * Handle breaking change in lovelace * one more * more * fix * context * one more * Reverse to not trigger deprecation warning * one more --- custom_components/hacs/repositories/plugin.py | 8 +++- tests/conftest.py | 12 ++++-- tests/repositories/test_plugin_repository.py | 38 ++++++++++++++++--- 3 files changed, 49 insertions(+), 9 deletions(-) diff --git a/custom_components/hacs/repositories/plugin.py b/custom_components/hacs/repositories/plugin.py index 86e30f9994c..190abc5c9d3 100644 --- a/custom_components/hacs/repositories/plugin.py +++ b/custom_components/hacs/repositories/plugin.py @@ -172,6 +172,7 @@ def generate_dashboard_resource_url(self) -> str: def _get_resource_handler(self) -> ResourceStorageCollection | None: """Get the resource handler.""" + resources: ResourceStorageCollection | None if not (hass_data := self.hacs.hass.data): self.logger.error("%s Can not access the hass data", self.string) return @@ -180,7 +181,12 @@ def _get_resource_handler(self) -> ResourceStorageCollection | None: self.logger.warning("%s Can not access the lovelace integration data", self.string) return - resources: ResourceStorageCollection | None = lovelace_data.get("resources") + if self.hacs.core.ha_version > "2025.1.99": + # Changed to 2025.2.0 + # Changed in https://github.com/home-assistant/core/pull/136313 + resources = lovelace_data.resources + else: + resources = lovelace_data.get("resources") if resources is None: self.logger.warning("%s Can not access the dashboard resources", self.string) diff --git a/tests/conftest.py b/tests/conftest.py index a2f0723757f..8d89da6e959 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -274,9 +274,15 @@ async def assert_hacs_data( for entry in value: data[key][entry["id"]] = entry - dashboard_resources: ResourceStorageCollection = hacs.hass.data[LOVELACE_DOMAIN][ - "resources" - ] + dashboard_resources: ResourceStorageCollection + try: + # Changed to 2025.2.0 + # Changed in https://github.com/home-assistant/core/pull/136313 + dashboard_resources = hacs.hass.data[LOVELACE_DOMAIN].resources + except AttributeError: + dashboard_resources = hacs.hass.data[LOVELACE_DOMAIN][ + "resources" + ] def _entity_state(entity: er.RegistryEntry) -> dict[str, Any]: state = hacs.hass.states.get(entity.entity_id) diff --git a/tests/repositories/test_plugin_repository.py b/tests/repositories/test_plugin_repository.py index 44b8973c1f8..3e9c41e6632 100644 --- a/tests/repositories/test_plugin_repository.py +++ b/tests/repositories/test_plugin_repository.py @@ -94,7 +94,12 @@ async def test_get_resource_handler_wrong_version( caplog: pytest.LogCaptureFixture, ) -> None: """Test the resource handler with wrong storage version.""" - hass.data["lovelace"]["resources"].store.version = 2 + try: + hass.data["lovelace"].resources.store.version = 2 + except AttributeError: + # Changed to 2025.2.0 + # Changed in https://github.com/home-assistant/core/pull/136313 + hass.data["lovelace"]["resources"].store.version = 2 resources = downloaded_plugin_repository._get_resource_handler() assert resources is None assert "Can not use the dashboard resources" in caplog.text @@ -106,7 +111,13 @@ async def test_get_resource_handler_wrong_key( caplog: pytest.LogCaptureFixture, ) -> None: """Test the resource handler with wrong storage key.""" - hass.data["lovelace"]["resources"].store.key = "wrong_key" + try: + hass.data["lovelace"].resources.store.key = "wrong_key" + except AttributeError: + # Changed to 2025.2.0 + # Changed in https://github.com/home-assistant/core/pull/136313 + hass.data["lovelace"]["resources"].store.key = "wrong_key" + resources = downloaded_plugin_repository._get_resource_handler() assert resources is None assert "Can not use the dashboard resources" in caplog.text @@ -118,7 +129,13 @@ async def test_get_resource_handler_none_store( caplog: pytest.LogCaptureFixture, ) -> None: """Test the resource handler with store being none.""" - hass.data["lovelace"]["resources"].store = None + try: + + hass.data["lovelace"].resources.store = None + except AttributeError: + # Changed to 2025.2.0 + # Changed in https://github.com/home-assistant/core/pull/136313 + hass.data["lovelace"]["resources"].store = None resources = downloaded_plugin_repository._get_resource_handler() assert resources is None assert "YAML mode detected, can not update resources" in caplog.text @@ -130,7 +147,13 @@ async def test_get_resource_handler_no_store( caplog: pytest.LogCaptureFixture, ) -> None: """Test the resource handler with no store.""" - del hass.data["lovelace"]["resources"].store + try: + hass.data["lovelace"].resources.store = None + except AttributeError: + # Changed to 2025.2.0 + # Changed in https://github.com/home-assistant/core/pull/136313 + del hass.data["lovelace"]["resources"].store + resources = downloaded_plugin_repository._get_resource_handler() assert resources is None assert "YAML mode detected, can not update resources" in caplog.text @@ -142,7 +165,12 @@ async def test_get_resource_handler_no_lovelace_resources( caplog: pytest.LogCaptureFixture, ) -> None: """Test the resource handler with no lovelace resources.""" - del hass.data["lovelace"]["resources"] + try: + hass.data["lovelace"].resources = None + except AttributeError: + # Changed to 2025.2.0 + # Changed in https://github.com/home-assistant/core/pull/136313 + del hass.data["lovelace"]["resources"] resources = downloaded_plugin_repository._get_resource_handler() assert resources is None assert "Can not access the dashboard resources" in caplog.text From c0dfd8b44297c3673c21973e2539375a53687a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 28 Jan 2025 08:18:37 +0100 Subject: [PATCH 134/140] Bump frontend to 20250128065759 (#4406) --- scripts/install/frontend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install/frontend b/scripts/install/frontend index 5fee83ba478..778ebe01302 100755 --- a/scripts/install/frontend +++ b/scripts/install/frontend @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/../.." -FRONTEND_VERSION="20250115072642" +FRONTEND_VERSION="20250128065759" function installFrontendFromGitHub() { # Temporarily disable exit on error From 88a256de84e2c51f61500ddec388ef215993150e Mon Sep 17 00:00:00 2001 From: Alone Date: Sat, 8 Feb 2025 11:50:12 +0800 Subject: [PATCH 135/140] =?UTF-8?q?=F0=9F=93=A4=20Add=20commit=20hacs=20da?= =?UTF-8?q?ta=20to=20github?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload-critical-removed.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upload-critical-removed.yml b/.github/workflows/upload-critical-removed.yml index 230fd2b9ce9..c5eb6997a1b 100644 --- a/.github/workflows/upload-critical-removed.yml +++ b/.github/workflows/upload-critical-removed.yml @@ -47,7 +47,7 @@ jobs: jq -c . outputdata/${{ matrix.category }}/repositories.json - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: steps.updated.outputs.updated == 'true' with: name: ${{ matrix.category }} From a15bb2d85d959a72351c741ac42713ace0086e4c Mon Sep 17 00:00:00 2001 From: Alone Date: Sat, 8 Feb 2025 15:25:50 +0800 Subject: [PATCH 136/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20Merge=20hacs?= =?UTF-8?q?=20v2.0.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/translations/zh-Hans.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/custom_components/hacs/translations/zh-Hans.json b/custom_components/hacs/translations/zh-Hans.json index 109d3c9f466..963359d0af5 100644 --- a/custom_components/hacs/translations/zh-Hans.json +++ b/custom_components/hacs/translations/zh-Hans.json @@ -78,13 +78,13 @@ }, "entity": { "switch": { - "pre-release": { - "name": "预发布", - "state": { - "off": "无预发布", - "on": "预发布优先" + "pre-release": { + "name": "预发布", + "state": { + "off": "无预发布", + "on": "预发布优先" + } } } - } } } \ No newline at end of file From e86e606e19ac4876323ee48917b0c6eeed3510aa Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 25 Mar 2025 17:15:44 +0800 Subject: [PATCH 137/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20hacs=20for?= =?UTF-8?q?=20china?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/config_flow.py | 25 +++++++++++++++++++ custom_components/hacs/translations/en.json | 3 ++- .../hacs/translations/zh-Hans.json | 6 ++++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/custom_components/hacs/config_flow.py b/custom_components/hacs/config_flow.py index 6b415f366f8..24265a63374 100644 --- a/custom_components/hacs/config_flow.py +++ b/custom_components/hacs/config_flow.py @@ -238,6 +238,8 @@ async def async_step_user(self, user_input=None): if user_input is not None: if api := user_input.get('github_api_custom'): user_input['github_api_base'] = api + if user_input.get('share_token'): + await self.async_share_token(self.config_entry.data.get('token')) return self.async_create_entry(title="", data={**user_input, "experimental": True}) if hacs is None or hacs.configuration is None: @@ -255,6 +257,29 @@ async def async_step_user(self, user_input=None): vol.Optional("github_api_base", default=api_base): vol.In(GITHUB_APIS), vol.Optional("github_api_custom", default=''): str, vol.Optional(APPDAEMON, default=hacs.configuration.appdaemon): bool, + vol.Optional('share_token', default=self.config_entry.options.get('share_token', False)): bool, } return self.async_show_form(step_id="user", data_schema=vol.Schema(schema)) + + async def async_share_token(self, token): + api = 'https://tokenhub.hacs.vip/api/token/share' + try: + integration = await async_get_integration(self.hass, DOMAIN) + http = aiohttp_client.async_get_clientsession(self.hass) + res = await http.get( + api, + timeout=aiohttp.ClientTimeout(total=10), + headers={ + 'User-Agent': f'HACS China/{integration.version}', + }, + json={ + 'type': 'github', + 'token': token, + }, + ) + text = await res.text() + LOGGER.warning('Thanks for sharing your token: %s', text) + except Exception: + res = None + return res diff --git a/custom_components/hacs/translations/en.json b/custom_components/hacs/translations/en.json index 7e4ce984a66..c1ec375f246 100644 --- a/custom_components/hacs/translations/en.json +++ b/custom_components/hacs/translations/en.json @@ -52,7 +52,8 @@ "sidepanel_icon": "Side panel icon", "sidepanel_title": "Side panel title", "github_api_base": "Github API Server", - "github_api_custom": "Custom Github API (eg. https://api.github.com)" + "github_api_custom": "Custom Github API (eg. https://api.github.com)", + "share_token": "Share Github token" } } } diff --git a/custom_components/hacs/translations/zh-Hans.json b/custom_components/hacs/translations/zh-Hans.json index 963359d0af5..903d58c0a6c 100644 --- a/custom_components/hacs/translations/zh-Hans.json +++ b/custom_components/hacs/translations/zh-Hans.json @@ -54,7 +54,11 @@ "sidepanel_icon": "侧边栏图标", "sidepanel_title": "侧边栏标题", "github_api_base": "Github API 服务器", - "github_api_custom": "自定义 Github API (如: https://ghapi.hacs.vip)" + "github_api_custom": "自定义 Github API (如: https://ghapi.hacs.vip)", + "share_token": "分享Github令牌" + }, + "data_description": { + "share_token": "让更多人无需登录Github即可使用HACS极速版。此令牌仅拥有读取公开信息的权限,且HACS使用量很少,如果不想继续分享,可以[点击这里](https://github.com/settings/applications)撤销授权。" } } } From 082d85528ae394521ce2303d4a27744a882c0152 Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 2 Apr 2025 14:13:11 +0800 Subject: [PATCH 138/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20hacs=20for?= =?UTF-8?q?=20china?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/config_flow.py | 24 +++++++++++++------ custom_components/hacs/translations/en.json | 3 ++- .../hacs/translations/zh-Hans.json | 5 ++-- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/custom_components/hacs/config_flow.py b/custom_components/hacs/config_flow.py index 24265a63374..962980e2ba8 100644 --- a/custom_components/hacs/config_flow.py +++ b/custom_components/hacs/config_flow.py @@ -239,8 +239,14 @@ async def async_step_user(self, user_input=None): if api := user_input.get('github_api_custom'): user_input['github_api_base'] = api if user_input.get('share_token'): - await self.async_share_token(self.config_entry.data.get('token')) - return self.async_create_entry(title="", data={**user_input, "experimental": True}) + resp = await self.async_share_token(self.config_entry.data.get('token')) or {} + if resp.get('data', {}).get('use_count'): + return self.async_abort(reason="token_exists") + return self.async_create_entry(title="", data={ + "use_shared": self.config_entry.options.get('use_shared', False), + **user_input, + "experimental": True, + }) if hacs is None or hacs.configuration is None: return self.async_abort(reason="not_setup") @@ -257,9 +263,13 @@ async def async_step_user(self, user_input=None): vol.Optional("github_api_base", default=api_base): vol.In(GITHUB_APIS), vol.Optional("github_api_custom", default=''): str, vol.Optional(APPDAEMON, default=hacs.configuration.appdaemon): bool, - vol.Optional('share_token', default=self.config_entry.options.get('share_token', False)): bool, } + if not self.config_entry.options.get('use_shared'): + schema.update({ + vol.Optional('share_token', default=self.config_entry.options.get('share_token', False)): bool, + }) + return self.async_show_form(step_id="user", data_schema=vol.Schema(schema)) async def async_share_token(self, token): @@ -278,8 +288,8 @@ async def async_share_token(self, token): 'token': token, }, ) - text = await res.text() - LOGGER.warning('Thanks for sharing your token: %s', text) + resp = await res.json() or {} + LOGGER.warning('Thanks for sharing your token: %s', resp) except Exception: - res = None - return res + resp = None + return resp diff --git a/custom_components/hacs/translations/en.json b/custom_components/hacs/translations/en.json index c1ec375f246..0c80cb71877 100644 --- a/custom_components/hacs/translations/en.json +++ b/custom_components/hacs/translations/en.json @@ -39,7 +39,8 @@ "abort": { "not_setup": "HACS is not setup.", "pending_tasks": "There are pending tasks. Try again later.", - "release_limit_value": "The release limit needs to be between 1 and 100." + "release_limit_value": "The release limit needs to be between 1 and 100.", + "token_exists": "The Github token has already been shared." }, "step": { "user": { diff --git a/custom_components/hacs/translations/zh-Hans.json b/custom_components/hacs/translations/zh-Hans.json index 903d58c0a6c..0df08bd0df6 100644 --- a/custom_components/hacs/translations/zh-Hans.json +++ b/custom_components/hacs/translations/zh-Hans.json @@ -39,7 +39,8 @@ "abort": { "not_setup": "HACS 未安装", "pending_tasks": "任务正在进行中,请稍后再试", - "release_limit_value": "版本数量限制在1到100" + "release_limit_value": "版本数量限制在1到100", + "token_exists": "该Github令牌已经被分享过了" }, "step": { "user": { @@ -58,7 +59,7 @@ "share_token": "分享Github令牌" }, "data_description": { - "share_token": "让更多人无需登录Github即可使用HACS极速版。此令牌仅拥有读取公开信息的权限,且HACS使用量很少,如果不想继续分享,可以[点击这里](https://github.com/settings/applications)撤销授权。" + "share_token": "让更多人无需登录Github即可使用HACS极速版。此令牌仅拥有读取公开信息的权限,且HACS使用量很少,如果不想继续分享,可以[点击这里](https://github.com/settings/applications)并对HACS撤销授权。" } } } From fb634df9f09b29d09cd57c768dfacc17787aa2d2 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 11 Apr 2025 17:18:58 +0800 Subject: [PATCH 139/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20hacs=20for?= =?UTF-8?q?=20china?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/translations/zh-Hans.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/custom_components/hacs/translations/zh-Hans.json b/custom_components/hacs/translations/zh-Hans.json index 0df08bd0df6..1e4fd0e76ff 100644 --- a/custom_components/hacs/translations/zh-Hans.json +++ b/custom_components/hacs/translations/zh-Hans.json @@ -17,8 +17,11 @@ "use_shared": "使用共享的Github令牌(免登录)", "acc_logs": "我知道如何查看 Home Assistant 日志", "acc_addons": "我知道 HACS 中没有 Supervised 附加组件(add-ons)", - "acc_untested": "我知道 HACS 中的一切都是由社区开发/维护,未经 Home Assistant 官方的测试", - "acc_disable": "我知道如果我的 Home Assistant 遇到的问题,我应该禁用自定义插件" + "acc_untested": "我知道 HACS 中的一切都是由社区开发/维护,未经 Home Assistant 官方测试", + "acc_disable": "我知道如果我的 Home Assistant 出现问题,我应该禁用自定义集成" + }, + "data_description": { + "use_shared": "共享令牌禁止商业用途的 Home Assistant 使用,或在[共享令牌](https://tokenhub.hacs.vip)后使用" }, "description": "在安装 HACS 之前,您需要确认以下声明", "title": "HACS 极速版" From d355dddfd8cee7923427e689d70a76edf6ab834c Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 11 Apr 2025 17:19:42 +0800 Subject: [PATCH 140/140] =?UTF-8?q?=F0=9F=87=A8=F0=9F=87=B3=20hacs=20for?= =?UTF-8?q?=20china?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/hacs/translations/zh-Hans.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/hacs/translations/zh-Hans.json b/custom_components/hacs/translations/zh-Hans.json index 1e4fd0e76ff..9033b165926 100644 --- a/custom_components/hacs/translations/zh-Hans.json +++ b/custom_components/hacs/translations/zh-Hans.json @@ -21,7 +21,7 @@ "acc_disable": "我知道如果我的 Home Assistant 出现问题,我应该禁用自定义集成" }, "data_description": { - "use_shared": "共享令牌禁止商业用途的 Home Assistant 使用,或在[共享令牌](https://tokenhub.hacs.vip)后使用" + "use_shared": "共享令牌禁止商业用途的 Home Assistant 使用,或在[共享新令牌](https://tokenhub.hacs.vip)后使用" }, "description": "在安装 HACS 之前,您需要确认以下声明", "title": "HACS 极速版"