Skip to content

When controlling some devices, complete parameters need to be passed in - #40

Closed
yang605256182 wants to merge 1 commit into
Cyborg2017:stagingfrom
yang605256182:v26.7.1
Closed

When controlling some devices, complete parameters need to be passed in#40
yang605256182 wants to merge 1 commit into
Cyborg2017:stagingfrom
yang605256182:v26.7.1

Conversation

@yang605256182

Copy link
Copy Markdown
Contributor
  • add support for new device 5706671E、57066708;
  • Corrected the fan mode for special equipment 5706671E

@Cyborg2017 Cyborg2017 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

规范问题:
1、不要修改default默认配置内容;
2、已经存在翻译的属性,不需要translation_key;
3、注释应尽量使用英文,便于阅读;
4、sn8设备配置应放在最后面。

代码问题:

问题1: async_set_fan_mode else分支逻辑错误: 特殊浴霸需要三参数,但else分支只发送单参数(风速),会导致设备控制失败

问题2: None值处理不完整:位置: climate.py:558-559

问题3: 硬编码默认值(30, 90)建议从配置读取

问题4: 重复代码建议抽取为辅助方法

另外,由于climate是温控器实体,而"5706671E"的两个模式都是与吹风有关,建议使用fan实体,这样也不用把climate改的这么复杂了。

@Cyborg2017

Cyborg2017 commented Jul 11, 2026

Copy link
Copy Markdown
Owner

climate核心修改合进去了:aa1b178

至于两个特定sn8的配置,需要自己修改重新提交,此外新属性需要同步增加翻译和图标。

@yang605256182

Copy link
Copy Markdown
Contributor Author

已经重新提交,有需要修改的麻烦通知我一下

@Cyborg2017

Copy link
Copy Markdown
Owner

已经重新提交,有需要修改的麻烦通知我一下

请上传凉霸设备的所有属性数据,在「设备状态」-「详情」里面,将所有属性复制粘贴出来

@yang605256182

Copy link
Copy Markdown
Contributor Author

所有属性数据:
Model
LY1906-S40
Device type
T0x26
Current temperature
0
Light mode
close_all
Mode
close_all
Smelly enable
off
Smelly level
0
Smelly threshold
3
Smelly trigger
off
Subpacket type
function_report
Version
9
Device class
connectivity
Icon
mdi:devices
Friendly name
凉霸 设备状态

"entities": {
Platform.CLIMATE: {
"bath_heater": {
"translation_key": "cooling_fan",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接使用cooling_fan,取消translation_key

},
"fan_mode": {
"state": {
"20": "Silent",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接使用字符串

"smelly_level": {
"state": "smelly_level",
"state_class": SensorStateClass.MEASUREMENT,
"translation_key": "smelly_level"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删除state、translation_key

"state_class": SensorStateClass.MEASUREMENT,
"translation_key": "smelly_level"
},
"smelly_threshold": {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删除state、translation_key

"translation_key": "smelly_threshold"
}
},
Platform.SWITCH: {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

power是什么意思?

Platform.SWITCH: {
"smelly_enable": {
"device_class": SwitchDeviceClass.SWITCH,
"power": "smelly_enable"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

power?

"state_class": SensorStateClass.MEASUREMENT,
"translation_key": "cur_temperature"
},
"smelly_level": {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删除state、translation_key

"smelly_trigger": {
"device_class": BinarySensorDeviceClass.PROBLEM,
"translation_key": "smelly_trigger",
"state": "smelly_trigger"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删除translation_key

"fan_mode": {
"state": {
"30": "Soft wind",
"100": "Strong"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接用字符串

}
}
}
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注意行尾符

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要按照上述修改,另外新属性缺失图标,需要补充。

@yang605256182

yang605256182 commented Jul 12, 2026 via email

Copy link
Copy Markdown
Contributor Author

@Cyborg2017

Copy link
Copy Markdown
Owner

十分感谢指正问题。新属性的图标如果获取?

---Original--- From: "Yang @.> Date: Sun, Jul 12, 2026 09:03 AM To: @.>; Cc: @.@.>; Subject: Re: [Cyborg2017/midea_smart_home] When controlling some devices, complete parameters need to be passed in (PR #40) @Cyborg2017 commented on this pull request. In custom_components/midea_smart_home/translations/zh-Hans.json: > @@ -2659,4 +2699,4 @@ } } } -} +} 需要按照上述修改,另外新属性缺失图标,需要补充。 — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today! You are receiving this because you authored the thread.Message ID: @.***>

在custom_components/midea_smart_home/icons.json定义一个合适得图标,可以让ai协助填充,然后在ha里面验证。

@yang605256182

Copy link
Copy Markdown
Contributor Author

已经按照建议进行了修改,推了新的分支

@Cyborg2017

Copy link
Copy Markdown
Owner

还是有一些没修改好,我调整了一下,看看更新后有无问题:711b78c

@Cyborg2017 Cyborg2017 reopened this Jul 12, 2026
Cyborg2017 pushed a commit that referenced this pull request Jul 12, 2026
…40

Co-authored-by: Cyborg2017 <wangyang0987654@gmail.com>

Change-Id: I51ac8f44b64fbebd975269e04ba820ab378087bf
@Cyborg2017 Cyborg2017 reopened this Jul 12, 2026
@yang605256182

Copy link
Copy Markdown
Contributor Author

好的。十分感谢~

@Cyborg2017

Copy link
Copy Markdown
Owner

好的。十分感谢~

测试没问题的话,可以关闭这个PR

@yang605256182

yang605256182 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

经过测试,存在两个问题,一个原有问题,一个新问题。
原有问题:浴霸设备在吹风模式下,摆动从固定角度的模式可以切换到自动摆动模式,但是不能从自动摆动模式切换到固定角度。
新问题:浴霸设备打开吹风模式,风速状态和摆动模式会延迟3S以上同步状态,延迟比较明显。改动前没有这个问题,所以在提交的代码中保留了原来的处理逻辑。

@Cyborg2017

Copy link
Copy Markdown
Owner

经过测试,存在两个问题,一个原有问题,一个新问题。 原有问题:浴霸设备在吹风模式下,摆动从固定角度的模式可以切换到自动摆动模式,但是不能从自动摆动模式切换到固定角度。 新问题:浴霸设备打开吹风模式,风速状态和摆动模式会延迟3S以上同步状态,延迟比较明显。改动前没有这个问题,所以在提交的代码中保留了原来的处理逻辑。

可以尝试在现有的基础上改进一下:711b78c

@Cyborg2017

Copy link
Copy Markdown
Owner

经过测试,存在两个问题,一个原有问题,一个新问题。 原有问题:浴霸设备在吹风模式下,摆动从固定角度的模式可以切换到自动摆动模式,但是不能从自动摆动模式切换到固定角度。 新问题:浴霸设备打开吹风模式,风速状态和摆动模式会延迟3S以上同步状态,延迟比较明显。改动前没有这个问题,所以在提交的代码中保留了原来的处理逻辑。

突然想起一个问题,你这个测试,是操作浴霸线控器看ha吗?

@Cyborg2017

Copy link
Copy Markdown
Owner

长时间未回复,PR关闭

@Cyborg2017 Cyborg2017 closed this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants