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

Feature(CD):Add Water Tank Level Display for Swan 2 Heat Pump #425

Open
hexCut opened this issue Dec 23, 2024 · 12 comments · Fixed by midea-lan/midea-local#345 · May be fixed by #471
Open

Feature(CD):Add Water Tank Level Display for Swan 2 Heat Pump #425

hexCut opened this issue Dec 23, 2024 · 12 comments · Fixed by midea-lan/midea-local#345 · May be fixed by #471
Labels
add_new_feature enhancement New feature or request
Milestone

Comments

@hexCut
Copy link

hexCut commented Dec 23, 2024

Device type and model (or SN)

SWAN2 153931628204291

The detail description of new feature

When using the Swan 2 heat pump (Midea/Clivet), in addition to displaying the water temperature, it would be helpful to display the water tank level. Currently, the water tank level is measured in 4 levels, as shown in the attached screenshot.

This feature would enhance the user experience by providing a more complete view of the system’s status directly from the integration.

Proposed Enhancement:
• Add functionality to retrieve and display the water tank level.
• Use the 4-level measurement standard available in the device’s API or system.

Foto 23-12-24, 23 19 58

@hexCut hexCut added the enhancement New feature or request label Dec 23, 2024
@wuwentao
Copy link
Owner

@hexCut please edit current issue OR pos new info.

  1. description your device type, refer to README document.
  2. provided your device SN, you can use discover to print it or any method.

in addition, I will provide a command line tool to display these info in next release. it still not available now.

@hexCut
Copy link
Author

hexCut commented Dec 24, 2024

CD Heat Pump Water Heater CC.md

2024-12-18 09:23:46.828 DEBUG (MainThread) [midealocal.discover] Found a supported device: {'device_id': 153931628204291, 'type': 205, 'ip_address': '192.168.20.167', 'port': 6444, 'model': 'RSJ000CB', 'sn': '0000CD311RSJ000CB2618B100053MY44', 'protocol': 3}

@wuwentao wuwentao changed the title Add Water Tank Level Display for Swan 2 Heat Pump Feature(CD):Add Water Tank Level Display for Swan 2 Heat Pump Dec 25, 2024
@wuwentao wuwentao added this to the 0.6.6 milestone Dec 25, 2024
@wuwentao
Copy link
Owner

wuwentao commented Dec 25, 2024

add some debug code in this PR: midea-lan/midea-local#345
you can manual change the midealocal python pip lib source code to test with it.

brief step:

  1. login to HAOS
  2. start homeassitant docker
  3. replace file for midealocal python pip package in homeassitant core(use wget to download github PR raw file and replace it)
  4. enable debug log for both midea_ac_lan and midealocal in configuration.yaml
  5. reboot HA.

after your device works well(start about 3-5 minutes), try to upload full debug log file to current github issue and I will check the detail.
as this value only can be got from debug log now, we can confirm it later.

how to change it, below is the detail steps:

  1. if you are using HAOS, you should install Add-on [Advanced SSH & Web Terminal] and disable [Protected Mode], once it done, you can ssh to your HAOS, and enter docker in HAOS docker exec -it homeassistant /bin/bash, contiune the step to check midea-local install path
  2. if you not using HAOS, just check midea-local install path as the next step
    3.get midea-local install path with command pip show midea-local, it will show info for you, for example, my location is Location: /usr/local/lib/python3.12/site-packages
  3. then we can replace the file under /usr/local/lib/python3.12/site-packages/midealocal/devices/cd/ with the code changes, using vi command line tool or wget to download github raw file.
  4. make sure you have enabled debug log in configuration.yaml
  5. reboot HA and test with it, confirm with the result or debug log.

after device reboot 3-5 minutes, download full debug log to your PC and upload this log file to current github issue
I will continue improve it with the debug log output

you can also search this value in debug log with water_level keyword, to confirm the output value.
current is raw digit value, I'm not sure with 4 levels output, maybe 1-4? we need to test and confirm the output from your device.

wuwentao added a commit to midea-lan/midea-local that referenced this issue Jan 15, 2025
…rotocol (#345)

1. add set customize option: `lua_protocol`, default is auto, user can
manual set it to `old` or `new`, I'm not sure whether we will have more
than two options, just use a str option for future.
> for `auto` mode, use subtype and model to process current github issue
known device.

3. add `water_level` attribute, current only can display the raw value
in debug log, I'm not sure the 4 level range now.
4. add more attributes in debug log output, we can add it in future.


fix: 
wuwentao/midea_ac_lan#347
wuwentao/midea_ac_lan#420
wuwentao/midea_ac_lan#425
@wuwentao
Copy link
Owner

please check with latest v0.6.6 release, it should include the water_level in debug log(NOT available in midea_ac_lan, only available in midealocal debug log) .

please upload your debug log file output and your app value, confirm the diff, once it works well, we can add these debug attrs to midea_ac_lan, and you can add it to HA, thanks

@hexCut
Copy link
Author

hexCut commented Jan 16, 2025

hank you for the update. I’m not entirely sure how to perform the test with the midealocal library. However, if you are willing to integrate it into a beta version of midea_ac_lan, I can test it right away. Let me know how to proceed. Thanks!

@wuwentao
Copy link
Owner

latest v0.6.6 should include these debug info, you can install it and enable debug log, check and confirm it with debug log an d your app value, then we can add it to midea_ac_lan in next release with expected value and display mode.

@hexCut
Copy link
Author

hexCut commented Jan 16, 2025

Thank you for the update. Below is the debug log from midealocal:

2025-01-16 10:23:39.806 DEBUG (Clivet Swan 2) [midealocal.device] [153931628204291] refresh_status with cmds: [<midealocal.devices.cd.message.MessageQuery object at 0x7fef7e6ec210>], check_protocol False,             device Clivet Swan 2, type 205, model RSJ000CB, subtype 186, device_protocol: 3,             message_protocol 0, unsupported_protocol: []
2025-01-16 10:23:39.806 DEBUG (Clivet Swan 2) [midealocal.device] [153931628204291] Sending: {'_device_type': <DeviceType.CD: 205>, '_message_type': <MessageType.query: 3>, '_body_type': <ListTypes.X01: 1>, '_message_protocol_version': 0, 'header': 'aa0ccd00000000000003', 'body': '0101', 'message_type': 'query', 'body_type': '01', 'self': <midealocal.devices.cd.message.MessageQuery object at 0x7fef7e6ec210>}, query is True
2025-01-16 10:23:40.202 DEBUG (Clivet Swan 2) [midealocal.device] [153931628204291] process message aa3ecd00000000000003010105312263631d3f2d4626090511001105083200310000000000000703000000000000000000000000000000060b00180c1d00e1 for device Clivet Swan 2,                                 model RSJ000CB, subtype 186,                                 device protocol 3, message procol 0
2025-01-16 10:23:40.203 DEBUG (Clivet Swan 2) [midealocal.devices.cd] [153931628204291] Received: {'_device_type': <DeviceType.CD: 205>, '_message_type': <MessageType.query: 3>, '_body_type': <ListTypes.X01: 1>, '_message_protocol_version': 0, '_header': 'aa3ecd00000000000003', '_body': <midealocal.devices.cd.message.CDGeneralMessageBody object at 0x7fef7e85fed0>, '_data': '010105312263631d3f2d4626090511001105083200310000000000000703000000000000000000000000000000060b00180c1d00', 'parser_list': [], 'power': True, 'mode': 2, 'heat': 0, 'eco': 0, 'target_temperature': 49, 'current_temperature': 34, 'top_temperature': 99, 'bottom_temperature': 99, 'condenser_temperature': 29, 'outdoor_temperature': 63, 'compressor_temperature': 45, 'max_temperature': 70, 'min_temperature': 38, 'error_code': 0, 'bottom_elec_heat': False, 'top_elec_heat': False, 'water_pump': False, 'compressor_status': False, 'four_way': False, 'elec_heat': True, 'back_water': False, 'sterilize': False, 'typeinfo': 3, 'water_level': 0, 'smart_grid': False, 'multi_terminal': False, 'fahrenheit': False, 'mute_effect': False, 'mute_status': False, 'header': 'aa3ecd00000000000003', 'body': '010105312263631d3f2d4626090511001105083200310000000000000703000000000000000000000000000000060b00180c1d00', 'message_type': 'query', 'body_type': '01', 'self': <midealocal.devices.cd.message.MessageCDResponse object at 0x7fef7e85f610>}
2025-01-16 10:23:40.203 DEBUG (Clivet Swan 2) [midealocal.device] [153931628204291] Status update: {'power': True, 'mode': 'Standard', 'max_temperature': 70, 'min_temperature': 38, 'target_temperature': 49, 'current_temperature': 34, 'outdoor_temperature': 63, 'condenser_temperature': 29, 'compressor_temperature': 45, 'compressor_status': False, 'water_level': 0, 'fahrenheit': False}

The water_level is currently 0, which seems accurate and consistent with the Smart Home app at this time. Once the tank is full (approximately in 6 hours), I’ll confirm the maximum value. According to the documentation, the maximum value should be 4.

Let me know if this helps or if you would like further details. Thanks so much for your work.

@hexCut
Copy link
Author

hexCut commented Jan 16, 2025

I can confirm that the water level is working correctly. Now is full: 4

2025-01-16 12:39:02.932 DEBUG (Clivet Swan 2) [midealocal.device] [153931628204291] refresh_status with cmds: [<midealocal.devices.cd.message.MessageQuery object at 0x7fef7bc82a50>], check_protocol False,             device Clivet Swan 2, type 205, model RSJ000CB, subtype 186, device_protocol: 3,             message_protocol 0, unsupported_protocol: []
2025-01-16 12:39:02.932 DEBUG (Clivet Swan 2) [midealocal.device] [153931628204291] Sending: {'_device_type': <DeviceType.CD: 205>, '_message_type': <MessageType.query: 3>, '_body_type': <ListTypes.X01: 1>, '_message_protocol_version': 0, 'header': 'aa0ccd00000000000003', 'body': '0101', 'message_type': 'query', 'body_type': '01', 'self': <midealocal.devices.cd.message.MessageQuery object at 0x7fef7bc82a50>}, query is True
2025-01-16 12:39:03.541 DEBUG (Clivet Swan 2) [midealocal.device] [153931628204291] process message aa3ecd00000000000003010105312c77771e43404626090511001105083200310000000000000703000000000400000000000000000000060b00180c1d0093 for device Clivet Swan 2,                                 model RSJ000CB, subtype 186,                                 device protocol 3, message procol 0
2025-01-16 12:39:03.541 DEBUG (Clivet Swan 2) [midealocal.devices.cd] [153931628204291] Received: {'_device_type': <DeviceType.CD: 205>, '_message_type': <MessageType.query: 3>, '_body_type': <ListTypes.X01: 1>, '_message_protocol_version': 0, '_header': 'aa3ecd00000000000003', '_body': <midealocal.devices.cd.message.CDGeneralMessageBody object at 0x7fef7c16c550>, '_data': '010105312c77771e43404626090511001105083200310000000000000703000000000400000000000000000000060b00180c1d00', 'parser_list': [], 'power': True, 'mode': 2, 'heat': 0, 'eco': 0, 'target_temperature': 49, 'current_temperature': 44, 'top_temperature': 119, 'bottom_temperature': 119, 'condenser_temperature': 30, 'outdoor_temperature': 67, 'compressor_temperature': 64, 'max_temperature': 70, 'min_temperature': 38, 'error_code': 0, 'bottom_elec_heat': False, 'top_elec_heat': False, 'water_pump': False, 'compressor_status': False, 'four_way': False, 'elec_heat': True, 'back_water': False, 'sterilize': False, 'typeinfo': 3, 'water_level': 4, 'smart_grid': False, 'multi_terminal': False, 'fahrenheit': False, 'mute_effect': False, 'mute_status': False, 'header': 'aa3ecd00000000000003', 'body': '010105312c77771e43404626090511001105083200310000000000000703000000000400000000000000000000060b00180c1d00', 'message_type': 'query', 'body_type': '01', 'self': <midealocal.devices.cd.message.MessageCDResponse object at 0x7fef85d7b250>}
2025-01-16 12:39:03.541 DEBUG (Clivet Swan 2) [midealocal.device] [153931628204291] Status update: {'power': True, 'mode': 'Standard', 'max_temperature': 70, 'min_temperature': 38, 'target_temperature': 49, 'current_temperature': 44, 'outdoor_temperature': 67, 'condenser_temperature': 30, 'compressor_temperature': 64, 'compressor_status': False, 'water_level': 4, 'fahrenheit': False}

@wuwentao
Copy link
Owner

@hexCut thanks.
so we don't need to change the value display, just keep this origin value to HA? I just mean water_level value is 0-4, return the result to HA ? or need to do some value changes, like empty/full/or any level display in string.
I'm not sure with it.

@wuwentao wuwentao reopened this Jan 17, 2025
@hexCut
Copy link
Author

hexCut commented Jan 17, 2025

Yes, that’s correct. 0/4 indicates the tank’s fill level, as you can see from the screenshot I attached to this issue—the tank image on the right side.
• 0 means there is no hot water,
• 1 corresponds to the level shown in the screenshot,
• 2 is halfway,
• 3 represents 3/4 full,
• 4 indicates the tank is full.

In my opinion, the return values you have should be sufficient. I’m not sure how you want to integrate them into Home Assistant, but the data looks ready to use.

@wuwentao wuwentao modified the milestones: 0.6.6, 0.6.7 Jan 17, 2025
@wuwentao wuwentao linked a pull request Jan 23, 2025 that will close this issue
@wuwentao
Copy link
Owner

@hexCut PR is ready, you can manual replace midea_devices.py under midea_ac_lan (refer to README document about Debug and test part link)
then you can config your device to add this attr.

@hexCut
Copy link
Author

hexCut commented Jan 23, 2025

All is working perfectly! Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add_new_feature enhancement New feature or request
Projects
None yet
2 participants