mill1000 / midea-ac-py

Home Assistant custom integration to control Midea (and associated brands) air conditioners via LAN.
MIT License
110 stars 9 forks source link

Is it possible to activate "Continuous Fan" mode? #143

Open quentinwolf opened 1 month ago

quentinwolf commented 1 month ago

Hello there!

I'm still loving your integration, it's been working well for me, although I do have an inquiry that I wasn't sure about. I have both a Whynter ARC-1230WNH (With Heatpump capability to provide heat), as well as a Danby DPA120B9IBDB-6 (an almost identical model as the Whynter, minus the heat mode), both appear to be based off of, or rebranded Midea Duo Smart Inverter models, so they both have been working great with your integration.

My question though, is both of them allow you to press and hold the Fan Speed button on the unit for 3 seconds to toggle "Continuous Fan" mode in any of the available modes (Fan/Cool/Heat). If you have the fan speed on "Auto" and activate the Continuous fan mode, it will continue to ramp up and down depending on cooling capacity required in the room, but once it reaches the desired temperature and goes idle, the fan stays going near silently but still moving the air around which is nice (along with the louvre fanning up and down), vs not having Continuous activated (once the machine cools the room it turns the fan off completely and sits idle for a period of time before turning on the fan briefly to check the temperature of the room and then either enable the compressor to further cool the room down, or turn the fan back off again if the rooms temperature is stable, which I find kind of annoying.)

I'm just curious if it's possible to toggle the continuous fan mode via your integration? It doesn't seem to be possible to do it from the IR remote control, as pressing and holding the fan speed button just moves it to the next fan speed up and otherwise doesn't do anything else.

Thanks for your time and for the improvements and continued support of the integration!

mill1000 commented 1 month ago

Hi. Glad it's working well for you.

Does the OEM app have the ability to control this feature?

If you enable debug logging, and then toggle this function on and off while waiting about 30 secs between we might be able to determine which bit controls it.

SomeJ0192 commented 1 week ago

Hi @mill1000

I have 2 Toshiba AC units with the same continuous fan mode option by holding the fan button on the AC unit. The OEM app does not appear to expose this option.

I turned on debugging, toggled the setting on the unit, waited 30 sec, then toggled again waiting another 30 sec before turning off debugging per your info request above.

Is there anything specific to look at in the log to tell if the option change/toggle was sent to HA? The properties response payload does not change, but the state response payload changes (not sure if those are even related to what you are looking for). I can attach the log if you would like to give it a look.

Thanks! Jason

mill1000 commented 1 week ago

Hi Jason. Please attach the logs.

The state response will hopefully contain the information we want.

SomeJ0192 commented 1 week ago

Here ya go. The IP of the AC unit I was testing with is: 10.8.5.127

Edit: I forgot to say that the AC unit already had the option turned on, so hopefully the data in the logs would show turning the option off, then back on ~30sec later.

home-assistant_midea_ac_2024-06-26T18-46-56.719Z.log

If you need anything else just holler!

mill1000 commented 1 week ago

Cool. The only bit (beside temperature) I see changing in the state responses is the ECO mode bit. Have you noticed if ECO mode turns on/off when in continuous fan mode?

SomeJ0192 commented 1 week ago

There is no ECO indication light or label on the AC unit its self, and I can not find any mention or indication for an ECO mode in the Toshiba/OEM app.

What I have observed with the option turned off is the inside fan, outside fan, and compressor will all cycle up and down regardless of the specified fan speed (almost as if the specified fan speed is the max speed the inside fan could run at).

When the option is turned on the inside fan stays at whatever speed is specified, then the outside fan and compressor will cycle up and down as needed.

And just to specify, the inside fan is the fan that circulates the conditioned air.

quentinwolf commented 1 week ago

Hi. Glad it's working well for you.

Does the OEM app have the ability to control this feature?

If you enable debug logging, and then toggle this function on and off while waiting about 30 secs between we might be able to determine which bit controls it.

Hello!

My apologies, I missed your reply in my inbox. The same with SomeJ0192, there's no ability to enable the option through the app, although I've just captured the logs, I enabled logging, waited 2-4 seconds and pressed and held the fan button to toggle continuous fan mode, waited 30 seconds, pressed and held it to toggle continuous fan off, waited another 30 seconds and then stopped logging.

Furthermore I cleaned up the log file a bit to remove anything that wasn't msmart or midea related as there was a lot of unrelated entries from my tplink devices, mqtt and other items. I hope this helps to give a bit of information from one of my Mideas too.

home-assistant_midea_ac_2024-06-26T21-14-49.492Z.log

mill1000 commented 1 week ago

There is no ECO indication light or label on the AC unit its self, and I can not find any mention or indication for an ECO mode in the Toshiba/OEM app.

What I have observed with the option turned off is the inside fan, outside fan, and compressor will all cycle up and down regardless of the specified fan speed (almost as if the specified fan speed is the max speed the inside fan could run at).

When the option is turned on the inside fan stays at whatever speed is specified, then the outside fan and compressor will cycle up and down as needed.

And just to specify, the inside fan is the fan that circulates the conditioned air.

@SomeJ0192 Does Home Assistant show the ECO preset being turned on?

Hello!

My apologies, I missed your reply in my inbox. The same with SomeJ0192, there's no ability to enable the option through the app, although I've just captured the logs, I enabled logging, waited 2-4 seconds and pressed and held the fan button to toggle continuous fan mode, waited 30 seconds, pressed and held it to toggle continuous fan off, waited another 30 seconds and then stopped logging.

Furthermore I cleaned up the log file a bit to remove anything that wasn't msmart or midea related as there was a lot of unrelated entries from my tplink devices, mqtt and other items. I hope this helps to give a bit of information from one of my Mideas too.

home-assistant_midea_ac_2024-06-26T21-14-49.492Z.log

@quentinwolf No worries. Thanks for the logs. There are multiple devices in this log, do you know which device you tested on?

quentinwolf commented 1 week ago

No worries. Thanks for the logs. There are multiple devices in this log, do you know which device you tested on?

192.168.100.115 looks to be the one I did the tests on. Comparing the MAC address on the unit to the one assigned to that IP address in UniFi shows IP 192.168.100.115. I had a bit of confusion as I had swapped the 2 AC's around (one being an AC only, the other a Heat Pump model with the ability to heat. Moved the heat one upstairs and AC only downstairs) but forgot to rename them in UniFi.

SomeJ0192 commented 1 week ago

I only have 3 preset options, "None", "Sleep", and "Boost". image image

Regardless of which preset I set active, the "continuous fan" option/light (on the AC unit) does not change.

Some Interesting observations I have seen with the data that HA provides for this unit: When I set the fan to Auto using the button on the AC, HA reports the fan speed as 102% When I set the fan to Low using the button on the AC, HA reports the fan speed as 40% When I set the fan to Medium using the button on the AC, HA reports the fan speed as 60% When I set the fan to High using the button on the AC, HA reports the fan speed as 100% with a fan mode of "Custom"

When I set the fan mode to Auto using HA, HA reports the fan speed as 102% When I set the fan mode to Low using HA, HA reports the fan speed as 40% When I set the fan mode to Medium using HA, HA reports the fan speed as 60% When I set the fan mode to High using HA, HA reports the fan speed as 80%, the OEM app reports the fan speed as 80%, and the indicator light on the AC unit shows the fan speed as high. Based on the sound and the amount of air flow, the fan speed defiantly is not at 100% when using HA to set the fan mode to high.

If i set the preset to boost through the OEM app or HA, HA reports the fan speed as 100%.

Regardless of what fan speed or mode is selected in HA, the OEM app, or on the unit its self; the "continuous fan" option/light indicator does not change on the AC unit.

I know all this other info is probably out of the scope of the original ticket/feature request, but I figured I would provide it to help show that the "ECO" mode/preset on this Toshiba unit seems to only be tied to the "continuous fan" option (by holding the fan button on the AC unit for a few seconds to toggle on/off) and is not presented or modified anywhere else on the AC unit, in the OEM app, or in HA.

quentinwolf commented 1 week ago

Judging by the features, I'm confident the Toshiba model that SomeJ0192 has is likely a rebranded/identical model to my Whynter and Danby models. Would be awesome if it could be toggled based off of some little flag, but if not the manufacturer likely just never exposed that to the module in the unit (which would be silly because the ability to turn continuous fan on or off is definitely a nice feature to have to use it to keep circulating the air in the room around.)

image

SomeJ0192 commented 1 week ago

Did some digging with msmart-ng and it appears the different speed settings are coming from the AC unit. Also it is reporting ECO mode as not supported, yet based on the debug output the units are changing the ECO mode bits when enabling/disabling the continuous fan mode (more data further below showing this via general querys).

msmart-ng query 10.8.5.127 --auto --capabilities
INFO:msmart.cli:Discovering 10.8.5.127 on local network.
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com (China: False).
INFO:msmart.lan:Creating new connection to 10.8.5.127:6444.
INFO:msmart.lan:Authenticating with 10.8.5.127:6444.
INFO:msmart.lan:Authenticating with 10.8.5.127:6444.
INFO:msmart.lan:Authentication successful. Expiration: 2024-06-27T12:37:26, Local key: 9fb976be02b6c3b600f7064d3a966e4f064574ef5facc3b98435d8a85dab461c
INFO:msmart.cli:Querying device capabilities.
INFO:msmart.cli:{'supported_modes': [<OperationalMode.FAN_ONLY: 5>, <OperationalMode.DRY: 3>, <OperationalMode.COOL: 2>, <OperationalMode.HEAT: 4>, <OperationalMode.AUTO: 1>], 'supported_swing_modes': [<SwingMode.OFF: 0>, <SwingMode.VERTICAL: 12>], 'supported_fan_speeds': [<FanSpeed.SILENT: 20>, <FanSpeed.LOW: 40>, <FanSpeed.MEDIUM: 60>, <FanSpeed.HIGH: 80>, <FanSpeed.AUTO: 102>], 'supports_custom_fan_speed': True, 'supports_eco_mode': False, 'supports_turbo_mode': True, 'supports_freeze_protection_mode': False, 'supports_display_control': True, 'supports_filter_reminder': True, 'max_target_temperature': 30.0, 'min_target_temperature': 16.0}

Query while continuous fan mode is turned ON. note how eco is set to false

msmart-ng query 10.8.5.127 --auto
INFO:msmart.cli:Discovering 10.8.5.127 on local network.
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com (China: False).
INFO:msmart.lan:Creating new connection to 10.8.5.127:6444.
INFO:msmart.lan:Authenticating with 10.8.5.127:6444.
INFO:msmart.lan:Authenticating with 10.8.5.127:6444.
INFO:msmart.lan:Authentication successful. Expiration: 2024-06-27T12:35:45, Local key: 55a37bce5f7a121d1f3095779baa4d7c91e205ec35051343a6d378015f6b27a7
INFO:msmart.cli:Querying device state.
INFO:msmart.cli:{'ip': '10.8.5.127', 'port': 6444, 'id': 150633093729129, 'online': True, 'supported': True, 'type': <DeviceType.AIR_CONDITIONER: 172>, 'name': 'net_ac_F66E', 'sn': '000000P0000000Q1242730F4F66E0000', 'key': '9aa8ac5cbfab45aca576c1c6b6c199cc1142d05cfef346f3bb802db1e7537217', 'token': 'a8cf84c28367468bfd61f272f2f87b13d8631ee2f2f2b9e74f4515b39c4b09e0c0f31530f68cf928f1c44f1ca49d46056eb520cb00d304f6009b80d591894674', 'power': True, 'mode': <OperationalMode.COOL: 2>, 'fan_speed': 100, 'swing_mode': <SwingMode.OFF: 0>, 'target_temperature': 24.0, 'indoor_temperature': 23.5, 'outdoor_temperature': 25.5, 'eco': False, 'turbo': False, 'freeze_protection': False, 'sleep': False, 'follow_me': False, 'display_on': True, 'beep': False, 'fahrenheit': True}

Query while continuous fan mode is turned OFF. Note how eco is now set to true.

msmart-ng query 10.8.5.127 --auto
INFO:msmart.cli:Discovering 10.8.5.127 on local network.
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com (China: False).
INFO:msmart.lan:Creating new connection to 10.8.5.127:6444.
INFO:msmart.lan:Authenticating with 10.8.5.127:6444.
INFO:msmart.lan:Authenticating with 10.8.5.127:6444.
INFO:msmart.lan:Authentication successful. Expiration: 2024-06-27T12:43:17, Local key: 86f9824e4746d3d918d4c045d520c7bc577b6a2b1ab252ae523eed69e8de7f63
INFO:msmart.cli:Querying device state.
INFO:msmart.cli:{'ip': '10.8.5.127', 'port': 6444, 'id': 150633093729129, 'online': True, 'supported': True, 'type': <DeviceType.AIR_CONDITIONER: 172>, 'name': 'net_ac_F66E', 'sn': '000000P0000000Q1242730F4F66E0000', 'key': 'fa6b920f0b2147a6a12b5a3874a55fc68cf2f550cd064cd6b80c70110472621a', 'token': '994f27e038bc105478880260eb21bdcc9d4eb6f8a42509b8faa6f30f0674fe4d83efc6cb4472830c385d73b9759a3a69b4425c90c134fc51db8c043c6e267f16', 'power': True, 'mode': <OperationalMode.COOL: 2>, 'fan_speed': 100, 'swing_mode': <SwingMode.OFF: 0>, 'target_temperature': 24.0, 'indoor_temperature': 23.5, 'outdoor_temperature': 25.5, 'eco': True, 'turbo': False, 'freeze_protection': False, 'sleep': False, 'follow_me': False, 'display_on': True, 'beep': False, 'fahrenheit': True}

It appears the unit is reporting as not supporting an eco mode, so my guess is the HA module does not present the option. However it does have an eco flag/variable that is being used by the "continuous fan" mode. Maybe the module could check to see if the eco variable exists even if eco mode reports as false, and if the variable exists then give us an eco (or in our case a "continuous fan") toggle button.

SomeJ0192 commented 1 week ago

Further playing around, I tried setting the show all presets option for the device in HA. image

Eco is now a preset option, but it appears the HA module can not actually modify the preset flag. If eco == true then continuous fan mode is off and HA reports the preset as "Eco". While eco == true I can not enable any other preset through HA. However if eco == false continuous fan mode is on and HA is able to enable any preset except for eco.

mill1000 commented 1 week ago

Some Interesting observations I have seen with the data that HA provides for this unit: When I set the fan to Auto using the button on the AC, HA reports the fan speed as 102% When I set the fan to Low using the button on the AC, HA reports the fan speed as 40% When I set the fan to Medium using the button on the AC, HA reports the fan speed as 60% When I set the fan to High using the button on the AC, HA reports the fan speed as 100% with a fan mode of "Custom"

When I set the fan mode to Auto using HA, HA reports the fan speed as 102% When I set the fan mode to Low using HA, HA reports the fan speed as 40% When I set the fan mode to Medium using HA, HA reports the fan speed as 60% When I set the fan mode to High using HA, HA reports the fan speed as 80%, the OEM app reports the fan speed as 80%, and the indicator light on the AC unit shows the fan speed as high. Based on the sound and the amount of air flow, the fan speed defiantly is not at 100% when using HA to set the fan mode to high.

Yes this is expected. There seems to be some inconsistency between models on what "high" speed should be. Here's some history on that https://github.com/mill1000/midea-msmart/issues/95 and https://github.com/mill1000/midea-ac-py/issues/67

What I should really do is probably expose an option to allow users to customize their fan speed values (when custom speeds are supported)

The value of 102% for Auto is also an artifact of how it's encoded. I provided some details here: https://github.com/mill1000/midea-ac-py/issues/96#issuecomment-1960020796

It's occurred to me that the fan entity may be a better approach than the number entity for custom fan speeds. I could use the preset feature to better show Auto functionality but I'm still limited by the fact I can't query the actual fan speed to display it properly.

I know all this other info is probably out of the scope of the original ticket/feature request, but I figured I would provide it to help show that the "ECO" mode/preset on this Toshiba unit seems to only be tied to the "continuous fan" option (by holding the fan button on the AC unit for a few seconds to toggle on/off) and is not presented or modified anywhere else on the AC unit, in the OEM app, or in HA.

Yes is appears that "continuous fan" is the opposite of ECO. Your units default to ECO, while other units default to "continuous fan".

... While eco == true I can not enable any other preset through HA. However if eco == false continuous fan mode is on and HA is able to enable any preset except for eco.

@SomeJ0192 Can you clarify that part about HA can't enable any other preset? Do you mean it fails to switch out of ECO, or just that you can't select multiple presets (which is expected)?

mill1000 commented 1 week ago

Another user had a similar model of Whynter ARC-1230WN, which also had some odd ECO behavior. I don't think we every really got to the bottom of it: https://github.com/mill1000/midea-ac-py/issues/130

SomeJ0192 commented 1 week ago

HA fails to switch out of ECO (set eco to false) so there for it is not enabling any other preset.

HA is also unable to set ECO to true, but it will set any other enabled preset to false in the process. For instance, if the boost/turbo preset is true, trying to set the preset to ECO with HA will set boost/turbo to false, then fails to set ECO to true, so the preset mode then displays as "none". (I failed to specify that in my last reply)

Is it possible to put in some kind of override option to not treat the eco preset variable as a preset if the unit does not report an eco preset option (IE: 'supports_eco_mode': False)?

mill1000 commented 1 week ago

HA fails to switch out of ECO (set eco to false) so there for it is not enabling any other preset.

HA is also unable to set ECO to true, but it will set any other enabled preset to false in the process. For instance, if the boost/turbo preset is true, trying to set the preset to ECO with HA will set boost/turbo to false, then fails to set ECO to true, so the preset mode then displays as "none". (I failed to specify that in my last reply)

Could capture logs of this occurring?

SomeJ0192 commented 4 days ago

Sorry it took so long to get back to you with these logs. The wife got me busy on other things and I finally found time to sit down and work on this again.

All of this testing is with the all presets flag enabled. I am using msmart-ng to verify settings changes.

This log is with ECO set to false (cont. fan on) and boost/turbo to true at the start. I used HA to turn on ECO, in the process it set turbo to false, and then failed to set ECO to true. HA will show the preset as "none". home-assistant_midea_ac_2024-07-04T20-57-04.617Z - eco-false boost-true set eco-true.log

It appears that I might have been mistaken about HA not being able to make changes while ECO==true. I've been testing this for a bit and its acting very strange. I need to step away and let my head clear so that I stop over thinking it and to work up a test procedure that I can reproduce. In a nut shell, what I am observing while ECO==true, some times when enabling turbo it will not set the flag to true, some times when enabling sleep it will not set the flag to true. But some times it will set the corresponding flag to true properly. There appears to be a some what specific order of preset selecting that determines if the flag gets set properly or not. Also HA may not always show the preset properly, IE i might have selected the sleep preset, msmart-ng says sleep==false but HA still shows sleep as being active and the unit sounds like it is in sleep mode. ---Keep in mind this really odd behavior only happens while the show all presets flag is enabled--- While the preset is showing boost or sleep, but the corresponding flag shows false, setting the preset to ECO does nothing, but then setting the preset back to the desired setting then properly sets the preset flag via msmart-ng. Im not sure we should focus too much on this oddness as it only presents when the show all presets option is enabled and ECO is set to true. (at no time was HA ever able to actually change the ECO flag from true).

mill1000 commented 1 hour ago

Somethings to keep in mind.

  1. Your last log and the behavior you described make sense. Your device ignores the ECO command which leaves no preset selected and you get "None" in HA. When setting a preset mode, the code automatically clears all the preset flags before setting the requested flag. i.e. https://github.com/mill1000/midea-ac-py/blob/a7a9538be4a1af4fe512ad81ec16d200e79b0997/custom_components/midea_ac/climate.py#L411-L428

  2. The library is optimistic. It sets the local device state, sends the command and then parses an updated state from the deice response.

  3. The integration uses a DataUpdateCoordinator. The coordinator debounces device refreshes.

The combination of 2 & 3 may cause an apparently lag in the device state if/when settings are changed rapidly.