Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug(E3): 燃气热水器启用半度后无法设置 x.5 度 #517

Open
internelp opened this issue Mar 4, 2025 · 5 comments
Open

Bug(E3): 燃气热水器启用半度后无法设置 x.5 度 #517

internelp opened this issue Mar 4, 2025 · 5 comments
Labels
bug Something isn't working
Milestone

Comments

@internelp
Copy link

HA版本

2025.2.5

集成版本

0.6.6

之前可正常使用的集成版本

0.6.6

设备类型及型号

Gas Water Heater 51100HX2 (74)

使用的App

美的美居

问题/Bug详细描述

问题描述:
使用自定义设置解决温度显示为2倍后,无法设置为 x.5 度,例如只能设置为39度,无法设置为39.5度(用户即使设置39.5,hass 也会将其改为39度)。

使用的自定义设置:

{ "precision_halves": true }

日志分析:
当时产生的action关键日志如下:

'key': 'target_temperature', 'value': 78, 

实际的日志应当为:

'key': 'target_temperature', 'value': 79, 

78 / 2 = 39
79 / 2 = 39.5

The logs

debug.log

@internelp internelp added the bug Something isn't working label Mar 4, 2025
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Title: The gas water heater cannot set x.5 degrees after half a degree is enabled

@wuwentao
Copy link
Owner

wuwentao commented Mar 5, 2025

看了一下,应该是数据类型转换的问题,代码里面使用了int类型,也就是你输入了39.5,应该是float类型,不过直接给你转换成int了,再次变成39了。
这里应该是有问题的,具体的代码应该是:

temperature = int(kwargs[ATTR_TEMPERATURE])

你可以直接参考debug文档,自行修改这一行:
temperature = int(kwargs[ATTR_TEMPERATURE])
改为:
temperature = float(kwargs[ATTR_TEMPERATURE])

修改以后重启HA,再次测试,反馈一下测试结果是否ok,midealocal原则上也涉及一些数据类型的修改,不过python应该可以跑起来按理不会报错,如果有错误,你再次提供一下debug log即可。
如果工作正常,那基本就ok了

@wuwentao wuwentao changed the title 燃气热水器启用半度后无法设置 x.5 度 Bug(E3): 燃气热水器启用半度后无法设置 x.5 度 Mar 5, 2025
@internelp
Copy link
Author

看了一下,应该是数据类型转换的问题,代码里面使用了int类型,也就是你输入了39.5,应该是float类型,不过直接给你转换成int了,再次变成39了。 这里应该是有问题的,具体的代码应该是:

midea_ac_lan/custom_components/midea_ac_lan/water_heater.py

Line 158 in 5362ea3

temperature = int(kwargs[ATTR_TEMPERATURE])

你可以直接参考debug文档,自行修改这一行:
temperature = int(kwargs[ATTR_TEMPERATURE])
改为:
temperature = float(kwargs[ATTR_TEMPERATURE])
修改以后重启HA,再次测试,反馈一下测试结果是否ok,midealocal原则上也涉及一些数据类型的修改,不过python应该可以跑起来按理不会报错,如果有错误,你再次提供一下debug log即可。 如果工作正常,那基本就ok了

已经按您说的方法解决。

@wuwentao
Copy link
Owner

wuwentao commented Mar 5, 2025

OK,感谢反馈测试结果。
先别close,随后我提交PR修复,作为状态跟踪,下个release就自动包含fix的代码了,无需本地手工修改了,因为存在这个问题的,可能不止你一个人。

@wuwentao wuwentao reopened this Mar 5, 2025
@wuwentao wuwentao added this to the 0.6.7 milestone Mar 5, 2025
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


OK, thanks for the feedback test results.
Don't close first, then I submit a PR repair. As status tracking, the next release will automatically include the fix code, and there is no need to modify it locally, because there may be more than you who have this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants