Add Midea C3 heat pump (0xC3) support with SmartHomeCloud relay#262
Open
xelhark wants to merge 7 commits into
Open
Add Midea C3 heat pump (0xC3) support with SmartHomeCloud relay#262xelhark wants to merge 7 commits into
xelhark wants to merge 7 commits into
Conversation
- Add DeviceType.HEAT_PUMP = 0xC3 to const.py - Add msmart/device/C3/ with HeatPump device class, commands and responses - Add proxy-compatible flat properties (zone1_power_state, zone1_target_temperature, etc.) - Add cloud relay to SmartHomeCloud: appliance_transparent_send, relay encryption - Add set_cloud() to base Device; _send_command routes through cloud relay when set - Add cloud relay fallback in Discover._authenticate_device (after LAN auth failure) - Add Device.construct support for HEAT_PUMP type - Add CLI 'heatpump' subcommand for heat pump control with --id bypass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rer token Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lay response Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ate, unit params - Fix decode_from_csv to handle Java signed bytes (& 0xFF mask) - Fix Frame.validate call to pass DeviceType.HEAT_PUMP - Fix tank_temperature: treat values >= 0xF0 as None (error/not-connected codes) - Add QueryUnitParametersCommand to refresh() for outdoor temp (fails gracefully via relay) - Fix CLI heatpump --id path to use SmartHomeCloud directly - Fix Discover._get_async_client not set in CLI --id path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ations on re-login Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When transparent/send fails with auth error codes (3105, 3106, 3301, 3001), silently call login(force=True) and retry. The pushToken is stable (derived from account hash) so re-login does not register a new device on the server and avoids triggering push notifications. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 tasks
Owner
|
Thanks for the PR. I'll appreciate the contribution. I am interested in supporting additional climate device types, but I do not want to integrate additional cloud connectivity. The project is supposed to be for local control to which adding a cloud relay is antithetical. So it is unlikely I will merge this PR as is. A possible alternative, the cloud relay could be removed and stood up as a dedicated service that bridges between msmart-ng and your device. As far as msmart-ng would know, its just another device. The relay could even respond to discovery packets making the integration into HA pretty seamless. By using the "V2" packet format any need for key & token between msmart-ng and the relay is eliminated too. flowchart LR
A[msmart-ng] <-- UDP --> B
B[cloud-relay] <-->
C[Cloud]@{ shape: cloud }
C <--> D[Device]
Happy to discuss. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DeviceType.HEAT_PUMP = 0xC3toconst.pyHeatPumpdevice class (device/C3/) with zone1/zone2, run modes (HEAT/COOL/AUTO/DHW), and full query/control command parsingSmartHomeCloudclass with cloud relay support (appliance_transparent_send) — C3 devices use cloud relay because LAN V3 auth returns error 3004base_device._send_commandwhen a cloud instance is set (set_cloud())Device.construct()support forDeviceType.HEAT_PUMPDiscover.probe_device_info(host)for ID-less discovery (sends UDP probe, returns device info without authenticating — needed since C3 uses SmartHomeCloud not NetHomePlusCloud)pushToken(derived from account hash) to avoid "new device" push notifications on re-loginappliance_transparent_sendon token expiry (codes 3105/3106/3301/3001)Notes
SmartHomeCloudcredentials (MSmartHome account), notNetHomePlusCloudQueryUnitParametersCommandreturns error 3176 ("async reply") via cloud relay — outdoor temperature and power sensors are currently unavailable via this path& 0xFFTest plan
device.refresh()returns correct zone power state, target temperature, and run modedevice.apply()sends control commands successfully via relayprobe_device_info()correctly extracts device ID without authentication🤖 Generated with Claude Code