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(C3): When THB or Desinfect is set to enabled, it's not possible to disable it again. #399

Open
bdecl opened this issue Nov 26, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@bdecl
Copy link

bdecl commented Nov 26, 2024

HA core version

2024.11.3

Current integration version

0.6.5

Last known working integration version

0.0.0

Device type and model

Heat Pump Wi-Fi Controller 171H120F (0) by Midea

Working mobile app

Smarthome

The detail description of bug/problem

  1. description the device type and name(you may have multiple devices)
    Airwell RCW30 - Heat Pump Wi-Fi Controller 171H120F (0) by Midea - C3

  2. description the error action or error info (device have multiple data/features)

When the TBH or Desinfect switch is enabled then it's not possible anymore to get it disabled. I observed when the TBH switch is enabled then the desinfect automatically is also enabled and the way around.

I think that this brings us in a situation that it's impossible to disable TBH and the Desinfect disabled at the same time. TBH and Desinfect switch remains always enabled because they are activated by each other.

The only way to get it disabled is to use the smarthome app.

The logs

logsC3_TBH_cannot_be_disabled.txt

@bdecl bdecl added the bug Something isn't working label Nov 26, 2024
@bdecl
Copy link
Author

bdecl commented Nov 26, 2024

In

https://github.com/georgezhao2010/midea_ac_lan/tree/master/custom_components/midea_ac_lan/midea/devices/c3/message.py

I found this on lign 63

disinfect = 0x04 if self.disinfect or self.tbh else 0x00

This can maybe explain the behavior. I don't know how to change this in the wuwentao/midea_ac_lan ?

@wuwentao
Copy link
Owner

@bdecl thanks for your bug report.
it's a pip lib now and current location is :
https://github.com/midea-lan/midea-local/blob/22462e68d8cc776f5c09d9b3bfea97e595701587/midealocal/devices/c3/message.py#L103

so we still need to find out the root cause.
maybe by mypy typing issue, I'm not sure now, will check it later.

@wuwentao wuwentao changed the title C3 When THB or Desinfect is set to enabled, it's not possible to disable it again. Bug(C3): When THB or Desinfect is set to enabled, it's not possible to disable it again. Nov 27, 2024
@bdecl
Copy link
Author

bdecl commented Nov 27, 2024

The issue is that tbh and disinfect switch tries to controls the same control bit. The return value sets both switches. Once you set one of the two switches to enable (1), together with the OR function, not possible to disable the switches on the same time --> disinfect = 0x04 if self.disinfect or self.tbh else 0x00 remains always enabled.

I adapted the code midealocal/devices/c3/device.py as folow to solve my issue

lign 103 - I removed self.disinfect or

    `disinfect = 0x04 if self.tbh else 0x00`

lign 182 - commented lign

#        self.disinfect = body[data_offset + 0] & 0x20 > 0
        self.tbh = body[data_offset + 0] & 0x20 > 0

This makes the disinfect switch obsolete but this is not an issue since it has the same function as tbh for this C3 device. The OR function must be written in a other way.
I tested it on my local system.

@wuwentao
Copy link
Owner

wuwentao commented Dec 2, 2024

@bdecl sorry for the delay response. thank you very much for your code changes and test result share.
in fact, I'm not sure with disinfect and tbh feature changes.

need to confirm below : with this changes, it works well for all your device disinfect and tbh feature?

in addition, @micturkey @fagallo @AndreasTUHU @erikgieseler, seems we also have C3 device, is this bug/feature works or exist in your C3 device with current code?
or you can manual edit the source code as @bdecl and confirm whether it can works?
I'm not sure with the changes impact to our exist device, if it works well with our device, then we can directly commit it.

from current code:

self.disinfect = body[data_offset + 0] & 0x20 > 0
self.tbh = body[data_offset + 0] & 0x20 > 0

I don't think disinfect is a different value with tbh, maybe they are same one.
as disinfect should be a different feature,so i don't think it should works for C3 device, and maybe we can remove disinfect and make tbh is works well, then try to support disinfect in another feature request issue/PR.

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

2 participants