Compare commits

...

5 commits

Author SHA1 Message Date
dependabot[bot]
8d0a58e391
Merge bacbfe9fad into 4b1a54a41c 2026-11-10 09:56:43 +08:00
wengzh
4b1a54a41c
Merge pull request #3545 from xinnan-tech/py-ha-state
Some checks failed
Tests / Java (manager-api) (push) Failing after 2m31s
Tests / Vue (manager-web) (push) Successful in 3m34s
Tests / Python (xiaozhi-server) (push) Successful in 30m21s
Py ha state
2026-11-09 14:43:00 +08:00
Sakura-RanChen
dd367c9e43 补充调整 2026-11-05 16:35:18 +08:00
Bao1573
b4e144afef
fix(hass): hass_get_state 的亮度按百分比报 (#3542)
HA 的 brightness 量程是 0~255,原样交给模型会被念成"一百五十三";灯关着时是 null,还会报"亮度是:None"。换算成百分比,和设置亮度用的 brightness_pct 同一个单位,开着的灯最低报 1%(同 HA 前端);不是数字时不报这一项。附测试。
2026-11-05 16:07:40 +08:00
dependabot[bot]
bacbfe9fad
Bump funasr in /main/xiaozhi-server in the ai-models group
Bumps the ai-models group in /main/xiaozhi-server with 1 update: [funasr](https://github.com/modelscope/FunASR).


Updates `funasr` from 1.4.16 to 1.4.17
- [Release notes](https://github.com/modelscope/FunASR/releases)
- [Commits](https://github.com/modelscope/FunASR/compare/v1.4.16...v1.4.17)

---
updated-dependencies:
- dependency-name: funasr
  dependency-version: 1.4.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ai-models
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-01 08:45:19 +00:00
2 changed files with 10 additions and 15 deletions

View file

@ -121,13 +121,10 @@ async def handle_hass_get_state(conn: "ConnectionHandler", entity_id):
+ str(response.json()["attributes"]["media_title"])
+ " "
)
if "volume_level" in response.json()["attributes"]:
responsetext = (
responsetext
+ "音量是:"
+ str(response.json()["attributes"]["volume_level"])
+ " "
)
volume_level = response.json()["attributes"].get("volume_level")
if isinstance(volume_level, (int, float)):
# volume_level 量程 0~1,换算成百分比(同 volume_set 的 1~100)
responsetext = responsetext + "音量是:" + f"{round(volume_level * 100)}%" + " "
if "color_temp_kelvin" in response.json()["attributes"]:
responsetext = (
responsetext
@ -142,13 +139,11 @@ async def handle_hass_get_state(conn: "ConnectionHandler", entity_id):
+ str(response.json()["attributes"]["rgb_color"])
+ " "
)
if "brightness" in response.json()["attributes"]:
responsetext = (
responsetext
+ "亮度是:"
+ str(response.json()["attributes"]["brightness"])
+ " "
)
brightness = response.json()["attributes"].get("brightness")
if isinstance(brightness, (int, float)):
# brightness 量程 0~255,换算成百分比(同 brightness_pct 的 1~100),开灯最低报 1%
percent = max(1, round(brightness * 100 / 255)) if brightness > 0 else 0
responsetext = responsetext + "亮度是:" + f"{percent}%" + " "
logger.bind(tag=TAG).info(f"查询返回内容: {responsetext}")
return responsetext
else:

View file

@ -10,7 +10,7 @@ pyyml==0.0.2
silero_vad==6.2.3
opuslib_next==1.3.1
pydub==0.25.1
funasr==1.4.16
funasr==1.4.17
# transformers>=5 要求 torch>=2.6,与本项目 torch 2.2.2 冲突(会禁用 PyTorch,fun_local 加载不了模型)
transformers<5
openai==2.8.1