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

Add Support for Heat Pumps (Type = 0xC3) #107

Open
nixmeer opened this issue Jan 6, 2024 · 61 comments · May be fixed by #108
Open

Add Support for Heat Pumps (Type = 0xC3) #107

nixmeer opened this issue Jan 6, 2024 · 61 comments · May be fixed by #108
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@nixmeer
Copy link

nixmeer commented Jan 6, 2024

Hi :)

I am desperately looking for a way to connect to my heat pump and read out data via python but all python modules I found so far only support type 0xAC devices. However, my heat pump is of type 0xC3.

Could you add support for that? As of reading though #100, I already downloaded the protocol files.

Thanks ahead!

Jan
T_0000_C3_171H120F_2023062601.txt
T0xC3_2023120100_sm.zip

@mill1000
Copy link
Owner

mill1000 commented Jan 6, 2024

Cool. Thanks for the protocol files! I'll see what I can do, obviously I'll need some help from you to test it since I don't own one. :)

Can you describe what functionality you'd like to see? In my mind it would work similar to a air conditioner/heater e.g current temp, target temp, mode

@mill1000 mill1000 added the enhancement New feature or request label Jan 6, 2024
@nixmeer
Copy link
Author

nixmeer commented Jan 7, 2024

I’d be more than happy to test, but I’d also help to code in a new branch and later merge.

I guess it’s more or less the same, just a few more values. Mainly, I’d like to be able to read the temperature sensors, flow meter, the relay positions, power consumption, and set points.

In our case, the HP provides hot water for the heating circuits (floor heating and radiators) and if the temperature in the hot water storage (for tapped water) drops below a certain value, it switches a valve and heats up the storage.

However, the controller can also be programmed to control other things such as solar thermal collectors. So it has additional analog imputs ans switched outputs and the operator can program rules.

@mill1000
Copy link
Owner

mill1000 commented Jan 9, 2024

I’d be more than happy to test, but I’d also help to code in a new branch and later merge.

Awesome, I've thrown together a branch (https://github.com/mill1000/midea-msmart/tree/feature/device_c3) to start some development. At this point it's mostly just a skeleton with some type definitions.

I guess it’s more or less the same, just a few more values. Mainly, I’d like to be able to read the temperature sensors, flow meter, the relay positions, power consumption, and set points.

In our case, the HP provides hot water for the heating circuits (floor heating and radiators) and if the temperature in the hot water storage (for tapped water) drops below a certain value, it switches a valve and heats up the storage.

Good to know. Do you also use it for "domestic" hot water use (e.g. showers, sinks)?

However, the controller can also be programmed to control other things such as solar thermal collectors. So it has additional analog imputs ans switched outputs and the operator can program rules.

I'm guessing these functions might fall under the "install" type messages which in my mind are a lower priority from the day to day query/command messages.

I see that the protocol has a number of timers/timing functions. (Day, weekly, holiday, maybe more.) Are you using those? Generally in my mind the built-in timers aren't useful when combined with another automation system

@mill1000 mill1000 linked a pull request Jan 11, 2024 that will close this issue
@nixmeer
Copy link
Author

nixmeer commented Jan 12, 2024

Awesome, I've thrown together a branch (https://github.com/mill1000/midea-msmart/tree/feature/device_c3) to start some development. At this point it's mostly just a skeleton with some type definitions.

Great, I'll update my repo.

Good to know. Do you also use it for "domestic" hot water use (e.g. showers, sinks)?

Yes. That is what the storage that I mentioned is for.

I see that the protocol has a number of timers/timing functions. (Day, weekly, holiday, maybe more.) Are you using those? Generally in my mind the built-in timers aren't useful when combined with another automation system

Yes. In a first step, I would like to be able to read out temperature values. Maybe later I'd be nice to be able to manipulate the set point of the heating circuits or the domestic hot water tank (i.e. when there is lots of photovoltaik energy).

I'm guessing these functions might fall under the "install" type messages which in my mind are a lower priority from the day to day query/command messages.

Yes.

@mill1000
Copy link
Owner

Cool. Just pushed some updates to the branch. It should be just enough to enable some basic testing of communication.

Can you checkout the branch and try running this example against your device?

import asyncio
import logging

from msmart.device import HeatPump as HP
from msmart.device.C3.command import QueryBasicCommand

logging.basicConfig(level=logging.DEBUG)

DEVICE_IP = "YOUR_DEVICE_IP"
DEVICE_PORT = 6444
DEVICE_ID = "YOUR_AC_ID"

# For V3 devices
DEVICE_TOKEN = None  # "YOUR_DEVICE_TOKEN"
DEVICE_KEY = None  # "YOUR_DEVICE_KEY"


async def main():
    device = HP(ip=DEVICE_IP, port=6444, device_id=int(DEVICE_ID))
    if DEVICE_TOKEN and DEVICE_KEY:
        await device.authenticate(DEVICE_TOKEN, DEVICE_KEY)

    command = QueryBasicCommand()
    resp = await device._send_command_get_responses(command)
    for r in resp:
        print(r)

if __name__ == "__main__":
    asyncio.run(main())

@nixmeer
Copy link
Author

nixmeer commented Jan 13, 2024

Well, thank you for starting!

However, you seem to use a newer version of python than 3.8.2. The issue is that I use a Pi Zero W and it has kernel issues when running make in the Python3.10 directory.

Any idea what to do?

@mill1000
Copy link
Owner

It's my intent to support Python 3.8 so I'll make the necessary fixes

@mill1000
Copy link
Owner

Ok, I just pushed a fix for the typing issues on Python 3.8

@nixmeer
Copy link
Author

nixmeer commented Jan 13, 2024

You are so quick :-o

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.178.x:6444.
DEBUG:msmart.lan:Connected to 192.168.178.x:6444.
INFO:msmart.lan:Authenticating with 192.168.178.xx:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.xx:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.xx:6444: 83700040200143456edc246774f447e2358db9e57b7fa4688a932dcded9f83db2be254155de83a1b958c2c7994d208ca0dbd43924ff361e3f08049c62872f7a4b1bceb7ed33d90cb
INFO:msmart.lan:Authentication successful. Expiration: 2024-01-14T06:31:11, Local key: 9d623668afe7459f7bd5f761e2f715c28ec73a3ba75cc3baf0b209d3afc420b9
DEBUG:msmart.base_device:Sending command to 192.168.178.xx:6444: aa0c3c0000000000000301b4
DEBUG:msmart.lan:Sending packet to 192.168.178.xx:6444: 5a5a01114800200000000000080c1f120d011814794301000085000000000000000000000000000081e5d6f96b975ba6a18ac59cf7157245ca23bd3ea6985317f81bb950a3386755
DEBUG:msmart.lan:Sending data to 192.168.178.xx:6444: 8370006e20665a3daf205ece03ca270cefe5b86bf36e11fc85727d984c2255a478dadaf3cdb874a1b7d92adcfd4f1ef69b803881c47c978452c53623f57340d67d82a2d7e52b84bd217a37e20331a0a147683a79bb3b7cad27f443d0885e07f7e84e4493afeb49c246f87e1779525dbd55ab157ab5c9
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.xx:6444: 5a5a01114800200000000000080c1f120d011814794301000085000000000000000000000000000081e5d6f96b975ba6a18ac59cf7157245ca23bd3ea6985317f81bb950a3386755
DEBUG:msmart.lan:Sending data to 192.168.178.xx:6444: 8370006e2066c50140481d3f9221dbe5ef88294c50275f1e877017c32b8efd1958a5d2dc4a02010aa292e093d5cbcc9c722c98520fa6d004a74b67bdc13a4873d82cb40d01b69f08fad476625793fb9c3c410c9b1a9a5e00b836d2e2108babbdb188cdc5d08c18a5b4ba349d14055bb80a08aadd16a5
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.xx:6444: 5a5a01114800200000000000080c1f120d011814794301000085000000000000000000000000000081e5d6f96b975ba6a18ac59cf7157245ca23bd3ea6985317f81bb950a3386755
DEBUG:msmart.lan:Sending data to 192.168.178.xx:6444: 8370006e2066a0a934a436fd968a72f6f6b03f7269814d844903b3d18f9a5e08cb7a9fb911d5c61e5e66ae91e9905922b26f9e6e82ec519361fbffce40f05010b0f4fc292dc6e07c893a02bb69f8efb5798276da92545f60b6156e8392fc8a9ddfa2f4eae65af6ab38c306241953d3660bc850a3032c
DEBUG:msmart.lan:Disconnecting from 192.168.178.xx:6444.
WARNING:msmart.base_device:Network timeout 192.168.178.xx:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.178.xx:6444 in 6.070000 seconds. 

Btw I am running python 3.9.2 on a Pi Zero W with Bullseye.

@mill1000
Copy link
Owner

Hm...thanks for testing. Looks like it didn't like that command.

I'll have to reexamine the code and see if I missed something.

@mill1000
Copy link
Owner

Oops. I had the device type as 0x3C not 0xC3...

Can you pull the latest commit and try again?

@mill1000
Copy link
Owner

@nixmeer Any chance you've been able to test the latest changes?

@nixmeer
Copy link
Author

nixmeer commented Jan 27, 2024

Heij :)
I am sorry for not testing this long. There's been a lot going on after 3 weeks of vacation...

However, the results did not change a lot. Authentication is still working but no answer to the commands after authenticating.

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.178.24:6444.
DEBUG:msmart.lan:Connected to 192.168.178.24:6444.
INFO:msmart.lan:Authenticating with 192.168.178.24:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370004020014345af03d04c5ffe3862a6e0dc7b126c285fadb431facce9adb3a4c2606afe24c05b3d01d1d09d60b3c7d714542af2e4e764c1189a23c878ef7b64110b8dc41c0c07
INFO:msmart.lan:Authentication successful. Expiration: 2024-01-27T19:58:21, Local key: 16299012687362cf63e75a31dc2ab8975f09926ee5e5ebed45c2238453cf0aef
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0cc300000000000003012d
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000000c163a071b0118147943010000850000000000000000000000000000733e549bad451bff40d5a2e20526eb7d111a00c28b63957daf266cbdc3d9f428
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20665f12c00792d86b66d53694169eb61386761df5ba5117cebdf38b8cb4cca1c3a02beb054480c775ecfb3ac9d7a95ebae0910842430d4432ec06d2ac875838252b35a82cefb518a6179e15734d0af876b3d58a47d7181531ed5b49ae1624ad55e2e0450aef9eb2b1934a05909c0e726493
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000000c163a071b0118147943010000850000000000000000000000000000733e549bad451bff40d5a2e20526eb7d111a00c28b63957daf266cbdc3d9f428
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066d9750fc152b222e37863c99c3a8c56a7f9d3a364b7807393ca57be574afe06317a4f2006169fd54761b454413f98b571671b3fdd1ae960e87879b39138410ee2b08223182e8a764c94467d185da90145ba30bf5f6646f7af63413a50c223b91f4fd63c254a88f4e4a47b6b2c16814284
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000000c163a071b0118147943010000850000000000000000000000000000733e549bad451bff40d5a2e20526eb7d111a00c28b63957daf266cbdc3d9f428
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20660469c36cef85716248a5474f03e18c759e458fc1f23e1619ee1354686e237a811f0375d6287e0183b7880a7b4919993917a793059dc691fba088e46d4a1faebbe015031fe454169dbc8bb89fb71358766a0fa2d99b36f21b0a88dbdee61f106ac3bcb4fa519dea6b5ab4f540ac3db558
DEBUG:msmart.lan:Disconnecting from 192.168.178.24:6444.
WARNING:msmart.base_device:Network timeout 192.168.178.24:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.178.24:6444 in 6.080000 seconds.

I got another minor issue: When I pull the code, the init.py tries to get the version of the msmart-ng module. However, I do not have the package installed but the demo.py the git repo directory. It works by replacing the function call with "2024.1.0".

@mill1000
Copy link
Owner

Ok, looks like I might have misunderstood how Lua arrays work.

Can you try this example snippet?

import asyncio
import logging

from msmart.const import DeviceType, FrameType
from msmart.device import HeatPump as HP
# from msmart.device.C3.command import QueryBasicCommand
from msmart.frame import Frame

logging.basicConfig(level=logging.DEBUG)

DEVICE_IP = "YOUR_DEVICE_IP"
DEVICE_PORT = 6444
DEVICE_ID = "YOUR_AC_ID"

# For V3 devices
DEVICE_TOKEN = None  # "YOUR_DEVICE_TOKEN"
DEVICE_KEY = None  # "YOUR_DEVICE_KEY"

class QueryTest(Frame):

    def tobytes(self) -> bytes:
        payload = bytes([1])
        # Build frame header
        header = bytearray(self._HEADER_LENGTH)

        # Start byte
        header[0] = 0xAA

        # Length of header, payload and checksum
        header[1] = len(payload) + self._HEADER_LENGTH

        # Device/appliance type
        header[2] = self._device_type

        # Device protocol version
        header[8] = self._protocol_version

        # Frame type
        header[9] = self._frame_type

        # Build frame from header and payload
        frame = bytearray(header + payload)

        # Calculate total frame checksum
        frame.append(Frame.checksum(frame[1:]))

        return bytes(frame)

async def main():
    device = HP(ip=DEVICE_IP, port=6444, device_id=int(DEVICE_ID))
    if DEVICE_TOKEN and DEVICE_KEY:
        await device.authenticate(DEVICE_TOKEN, DEVICE_KEY)

    command = QueryTest(DeviceType.HEAT_PUMP, frame_type=FrameType.REQUEST)
    resp = await device._send_command_get_responses(command)
    for r in resp:
        print(r)

if __name__ == "__main__":
    asyncio.run(main())

@nixmeer
Copy link
Author

nixmeer commented Feb 3, 2024

Hi :)
Here's the result:

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.178.24:6444.
DEBUG:msmart.lan:Connected to 192.168.178.24:6444.
INFO:msmart.lan:Authenticating with 192.168.178.24:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370004020014345750cd2b8fd8e29d00d048c3506a60fce9804b97d6283cf952d5dbf93e6b3c87a8d6fdb876ba9d13999f9e049a68ba2a93896e2fc30ce940e83ae5322e6b8a8a9
INFO:msmart.lan:Authentication successful. Expiration: 2024-02-04T09:17:32, Local key: 29d92e48e2e9d1ae03276256e61f06f59091290f0707d38e5db699e6dd46b18c
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000003012e
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a0111480020000000000000221115030218147943010000850000000000000000000000000000e0d87d4bf4e5735ba7745fc35ec456a0b24125dfe8a0ae4fb22c6fcc964d1b36
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20667a253d2f1032146105f793f016bfb6afed34e915ad75f5c1bf4fafea59215ba7dc3b2873897ef7d4c259d482faac4d588fe3c3d94cac4344db4ebc4421a78b7f7c894ffdffc4f078b2fc63a54a2e5fa93abda3012f62f2220c45665ef2dddbfea6a4480d6318909bfb6a9a513219f218
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370008e2063412cb45cdc54609436ee0ac201100d308bf10299c6b662d758bb99f4a17cdbe3c9ed74d1ffe4e5fbf752ec4876ace48d8881bbdf098023b13cc9ec939971e7cf681bf893ca5df3993c267ac3f9b0f25f4486805ef8249ee89dc73368b8cdb85e02cacc0c8d26b6965a619a3208f7e21f85cb07ae7c3de18090ac448d7802c80f9c1817fd7d7d6b0b4d8f05088cb714f9
DEBUG:msmart.lan:Received packet from 192.168.178.24:6444: 5a5a011168002080000000004d801115030218147943010000850000000000000000018000000000350b83ca3c4d23ee2c29f50ca21702bdd85e4accd4d1865383fa9d436e464bd90c741269a0e6834ecc25ad476fdb8a2d5df0990eebc0b9c8d2bc94a8013d3167
DEBUG:msmart.lan:Received response from 192.168.178.24:6444: aa23c300000000000003010517a10303191e143037191905371919053c223c142200002c
DEBUG:msmart.base_device:Response from 192.168.178.24:6444 in 0.130000 seconds.
DEBUG:msmart.device.C3.command:Query basic payload: 
Traceback (most recent call last):
  File "/home/janth/midea-msmart/demo2.py", line 60, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/janth/midea-msmart/demo2.py", line 55, in main
    resp = await device._send_command_get_responses(command)
  File "/home/janth/midea-msmart/msmart/device/C3/device.py", line 42, in _send_command_get_responses
    response = Response.construct(data)
  File "/home/janth/midea-msmart/msmart/device/C3/command.py", line 164, in construct
    return QueryBasicResponse(frame_mv)
  File "/home/janth/midea-msmart/msmart/device/C3/command.py", line 178, in __init__
    self._parse(payload)
  File "/home/janth/midea-msmart/msmart/device/C3/command.py", line 184, in _parse
    self.zone1_power_state = bool(payload[1] & 0x01)
IndexError: index out of bounds on dimension 1

Looks better, doesn't it?

@mill1000
Copy link
Owner

mill1000 commented Feb 4, 2024

It got a response! Awesome!

@mill1000
Copy link
Owner

mill1000 commented Feb 4, 2024

Cool I fixed the payload parser and this is what I got out of the message. Does this seem like a reasonable representation of your system? i.e. Temperatures seem correct, power states, etc

{
 '_type': 1,
 '_payload': b'\x01\x05\x17\xa1\x03\x03\x19\x1e\x1407\x19\x19\x057\x19\x19\x05<"<\x14"\x00\x00',
 'zone1_power_state': True,
 'zone2_power_state': False,
 'dhw_power_state': True,
 'zone1_curve_state': False,
 'zone2_curve_state': False,
 'fastdhw_state': False,
 'heat_enable': True,
 'cool_enable': True,
 'dhw_enable': True,
 'double_zone_enable': False,
 'zone1_temp_type': True,
 'zone2_temp_type': False,
 'time_set_state': True,
 'silence_on_state': False,
 'holiday_on_state': False,
 'eco_on_state': False,
 'zone1_terminal_type': 8,
 'run_mode_set': 3,
 'runmode_under_auto': 3,
 'zone1_target_temperature': 25,
 'zone2_target_temperature': 30,
 'dhw_target_temperature': 20,
 'room_target_temperature': 24.0,
 'zone1_heat_max_temperature': 55,
 'zone1_heat_min_temperature': 25,
 'zone1_cool_max_temperature': 25,
 'zone1_cool_min_temperature': 5,
 'zone2_heat_max_temperature': 55,
 'zone2_heat_min_temperature': 25,
 'zone2_cool_max_temperature': 25,
 'zone2_cool_min_temperature': 5,
 'room_max_temperature': 30.0,
 'room_min_temperature': 17.0,
 'dhw_max_temperature': 60,
 'dhw_min_temperature': 20,
 'tank_temperature': 34,
 'error_code': 0,
 'boostertbh_en': False
}

@nixmeer
Copy link
Author

nixmeer commented Feb 4, 2024

Looks great. The heat pump runs one heating circuit and domestic hot water, the other “zone” appears to be turned off. I don’t know what “run_mode” and “runmode_under_auto” might be but I’ll figure that out.

Except for “tank temperature”, there’s no sensor values yet (such as outside temperature or circuit temperatures). This message looks more like the system state.

@mill1000
Copy link
Owner

mill1000 commented Feb 4, 2024

Yes it appears tank_temperature is the only temperature value that's actually a sensor. The rest are settings and/or built in limits.

run_mode takes the following values: 1 - Auto, 2 - Cooling, 3 - Heating. I'm guessing runmode_under_auto might return the current run_mode which could be useful in auto mode to know if the device is heating or cooling.

@nixmeer
Copy link
Author

nixmeer commented Feb 5, 2024

Ok, makes sense.

Do you think the other messages should work now or is more work to be done?

@mill1000
Copy link
Owner

mill1000 commented Feb 6, 2024

Ok, I've got a rough skeleton of a device class now. Can you pull and run the latest example below?

import asyncio
import logging

from msmart.device import HeatPump as HP
from msmart.device.C3.command import QueryBasicCommand

logging.basicConfig(level=logging.DEBUG)

DEVICE_IP = "YOUR_DEVICE_IP"
DEVICE_PORT = 6444
DEVICE_ID = "YOUR_AC_ID"

# For V3 devices
DEVICE_TOKEN = None  # "YOUR_DEVICE_TOKEN"
DEVICE_KEY = None  # "YOUR_DEVICE_KEY"


async def main():
    device = HP(ip=DEVICE_IP, port=6444, device_id=int(DEVICE_ID))
    if DEVICE_TOKEN and DEVICE_KEY:
        await device.authenticate(DEVICE_TOKEN, DEVICE_KEY)

    await device.refresh()
    print(vars(device))

if __name__ == "__main__":
    asyncio.run(main())

@mill1000
Copy link
Owner

mill1000 commented Feb 7, 2024

Ok, makes sense.

Do you think the other messages should work now or is more work to be done?

I expect any of the query messages will work. The responses just have to be parsed. I'm currently working on the "unit parameters" query which should contain some additional temperature sensor readings.

Then we'll have to test the control commands.

@nixmeer
Copy link
Author

nixmeer commented Feb 7, 2024

Sounds like a plan.

Here's the latest response:

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.178.24:6444.
DEBUG:msmart.lan:Connected to 192.168.178.24:6444.
INFO:msmart.lan:Authenticating with 192.168.178.24:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 83700040200143452c74a16fe797771e96c428cc0c319533c8bf42e5704a55cdb0c8912dbedbb73d028592ebceba4e637b2c61cffc7e9b078db1c1707e255efe66ab1ba19b134153
INFO:msmart.lan:Authentication successful. Expiration: 2024-02-08T08:11:51, Local key: 76ee2c08f39751c65bfeea3f99e28f984b7f2462cf3bdee1c78396894e5abee2
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000003012e
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a0111480020000000000032340b14070218147943010000850000000000000000000000000000e0d87d4bf4e5735ba7745fc35ec456a0211312b74adeaa119bf3d16ef764961f
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20666e65e93ad9fecd5f34c6309e5238b3edbafb8379f578fad5df02fdf98380bfb5e759818ac87303b6fbf39107ddbcdac0231b05c9e5dd259703c6bb92dd99b030f729444d5e9995f14c2cce04869abb2390197e442afe880e42db971e0e8d051929bd6f817ba53dda8ba3a05818e987f5
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370008e2063fb12a5445d53dfe6da91e7435a6b9780a6d0c9b9b316bc4a7f8de2ccfd1e7b4b3cc284907d371f7e4a5e35159a473fec1b18028c370b2bf25b259a48a521e00d87b7f7c1a8ff34c206c7ca592d7d762c4c3ccb2c46a0e4e923cef34f0d6e7b88b6d8d5c62593b57026d700c84639d3791a99a47739663e8705c58e35558be76ac730e1c7e126ed7d30fead1efc12cfe1
DEBUG:msmart.lan:Received packet from 192.168.178.24:6444: 5a5a0111680020800000000097d00b14070218147943010000850000000000000000018000000000350b83ca3c4d23ee2c29f50ca21702bdd85e4accd4d1865383fa9d436e464bd964a9ba15fe504adea0aa99b9e271b4cab6db4a4677db6838990df3b84e9550a7
DEBUG:msmart.lan:Received response from 192.168.178.24:6444: aa23c300000000000003010517a10303191e143037191905371919053c223c142400002a
DEBUG:msmart.base_device:Response from 192.168.178.24:6444 in 1.050000 seconds.
DEBUG:msmart.device.C3.command:Query basic payload: 010517a10303191e143037191905371919053c223c14240000
Traceback (most recent call last):
  File "/home/janth/midea-msmart/demo3.py", line 27, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/janth/midea-msmart/demo3.py", line 23, in main
    await device.refresh()
  File "/home/janth/midea-msmart/msmart/device/C3/device.py", line 180, in refresh
    self._process_state_response(response)
  File "/home/janth/midea-msmart/msmart/device/C3/device.py", line 140, in _process_state_response
    self._update_state(cast(QueryBasicResponse, response))
  File "/home/janth/midea-msmart/msmart/device/C3/device.py", line 99, in _update_state
    getattr(res, f"zone{i}_temp_type)"))
AttributeError: 'QueryBasicResponse' object has no attribute 'zone1_temp_type)'

@mill1000
Copy link
Owner

mill1000 commented Feb 7, 2024

Just pushed a change to fix that silly typo, and added an additional request for the "unit parameters".

Can you re-run the example?

Have you used the OEM app? Could you share screenshots of it so I can better understand it's functionality?

@nixmeer
Copy link
Author

nixmeer commented Feb 8, 2024

Here‘s the output:

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.178.24:6444.
DEBUG:msmart.lan:Connected to 192.168.178.24:6444.
INFO:msmart.lan:Authenticating with 192.168.178.24:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370004020014345fce3c247216380c832a121dcf4cd0f1aff54464964b08fb509294573e2c714bf55bf3fb2ce5231d6651cb3b7c01a5b617914ab7f1f4b44ab5d14ea05fa216e0f
INFO:msmart.lan:Authentication successful. Expiration: 2024-02-08T16:52:48, Local key: 312f5e853be6205da3c81da5264c7901ecf251fb4b3a2b794f13621157ccca7a
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000003012e
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a0111480020000000000028313404080218147943010000850000000000000000000000000000e0d87d4bf4e5735ba7745fc35ec456a02aa74760b4e17aaece5be2ff6d0ba429
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20666214f8b15f4e038e5e56ca16618ff276b1337ede5f9d792118c8294dca6385d4c38da3d33f9033069d4629333bd79be9d76feab968d07692804da9d65622d1a0da0ae0d4613e5cac7a5472e5d83c649f43c53dd05a56cca3ac8876610997d292b7c15b81d9834b55ae0f377fd36ba134
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370008e20631cb72cc390405e46da1414dca8df19969f5760482355ab6e5bad3035cfa3f953f492250364e124eb63ae4da09466d5aa51c44c4359342d6fa4fb3bfdfc4b74612ed10faee524fb96069fe9381f96ddb52f8d20f5d287abd9da78ead56eea83fdb4393c963a9fd7f71b3311a51f9ea1b1c450e940969c1f852a3073306a03a35a55734df6e53d6799e55c39b1b89f6ef1
DEBUG:msmart.lan:Received packet from 192.168.178.24:6444: 5a5a01116800208000000000abe83404080218147943010000850000000000000000018000000000350b83ca3c4d23ee2c29f50ca21702bd07f5149d6eef7272823f9254475d245069d988d840ff4c2d5ed186a3fe60878f7fa8600442375dfd7ec1231a9c1c3881
DEBUG:msmart.lan:Received response from 192.168.178.24:6444: aa23c300000000000003010517a10303201e293037191905371919053c223c142b000007
DEBUG:msmart.base_device:Response from 192.168.178.24:6444 in 0.130000 seconds.
DEBUG:msmart.device.C3.command:Query basic payload: 010517a10303201e293037191905371919053c223c142b0000
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000003101f
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a0111480020000000000035313404080218147943010000850000000000000000000000000000732dab8b9c3541bf676b207c58a390fc48b1e8644793a5e85f63af787e427909
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20662cb6b79298ceea2cd206d75ebea393b29dc34aca13b99c53e44332d08cbe7171b7e0b93567703cbcd84cc70201ade4b4da0e11bb6332198932296c408068e334036b371634214fe9dbb85730f834a083a47fe4546d3191fb5c58d728d66aba914673c3ce3b60fec09840554facb5123f
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a0111480020000000000035313404080218147943010000850000000000000000000000000000732dab8b9c3541bf676b207c58a390fc48b1e8644793a5e85f63af787e427909
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e206664777ec5d83e41fc2d6aaaa986397404af45421819799803e6c40638397d19a7d24a50524734301c91d0fccfe0f0565b46781eb2ed81ef5bab3d2d399c9093ccdaaa79f15a59f2e9fb6da989d1c618dc23a903cfd8cf29abc9d9944a67da78d47c3f4535a809e34ec404f71af12dbfba
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a0111480020000000000035313404080218147943010000850000000000000000000000000000732dab8b9c3541bf676b207c58a390fc48b1e8644793a5e85f63af787e427909
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20667b6e94435cf67912cdce6d732350eb286e7adc72b25641ebc2c1ef2dd1d9424fbcb82abd23c69880ab87b90c4c195da707b75fe196e0cd49474588786c5fdee7782b3685f42b99f4401ad98cd2267872d726a6182f42345cf8ffa4542b4e60c990575eff8ee0bd548801002c67aa2fd2
DEBUG:msmart.lan:Disconnecting from 192.168.178.24:6444.
WARNING:msmart.base_device:Network timeout 192.168.178.24:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.178.24:6444 in 6.060000 seconds. 
{'_ip': '192.168.178.24', '_port': 6444, '_id': 146235046577017, '_type': <DeviceType.HEAT_PUMP: 195>, '_sn': None, '_name': None, '_version': None, '_lan': <msmart.lan.LAN object at 0xb5cb0dc0>, '_supported': True, '_online': False, '_run_mode': <RunMode.HEAT: 3>, '_heat_enable': True, '_cool_enable': True, '_zone2_enable': False, '_zone_1': <msmart.device.C3.device.HeatPump.Zone object at 0xb5cb0da8>, '_zone_2': <msmart.device.C3.device.HeatPump.Zone object at 0xb5cb0dd8>, '_dhw_enable': True, '_dhw_power_state': True, '_dhw_target_temperature': 41, '_dhw_min_temperature': 20, '_dhw_max_temperature': 60, '_room_thermostat_enable': False, '_room_termostate_power_state': False, '_room_target_temperature': 25, '_room_min_temperature': 17, '_room_max_temperature': 30, '_tbh_state': False, '_fastdhw_state': False, '_tank_temperature': 43, '_outdoor_temperature': None, '_room_temperature': None, '_water_temperature_2': None, '_room_thermostat_power_state': False, '_room_thermostat_target_temperature': 24.0, '_room_thermostat_min_temperature': 17.0, '_room_thermostat_max_temperature': 30.0}

I’ll put together some screenshots of the app later today.

@mill1000
Copy link
Owner

mill1000 commented Feb 9, 2024

Thanks. Huh..well it didn't like that last query type did it.

Here's another example that will send every known query type.

import asyncio
import logging

from msmart.device import HeatPump as HP
from msmart.device.C3.command import QueryCommand, QueryType

logging.basicConfig(level=logging.DEBUG)

DEVICE_IP = "YOUR_DEVICE_IP"
DEVICE_PORT = 6444
DEVICE_ID = "YOUR_DEVICE_ID"

# For V3 devices
DEVICE_TOKEN = None  # "YOUR_DEVICE_TOKEN"
DEVICE_KEY = None  # "YOUR_DEVICE_KEY"


async def main():
    device = HP(ip=DEVICE_IP, port=6444, device_id=int(DEVICE_ID))
    if DEVICE_TOKEN and DEVICE_KEY:
        await device.authenticate(DEVICE_TOKEN, DEVICE_KEY)

    for type in QueryType:
        print(f"Sending query type {type.name}.")
        command = QueryCommand(type)
        await device._send_command_parse_responses(command)

if __name__ == "__main__":
    asyncio.run(main())

@nixmeer
Copy link
Author

nixmeer commented Feb 10, 2024

Here's the output of that:

Output
DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.178.24:6444.
DEBUG:msmart.lan:Connected to 192.168.178.24:6444.
INFO:msmart.lan:Authenticating with 192.168.178.24:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 83700040200143452542fe22de33fe97dea40fdf4728404ae7b8be51dee0a9ec958fd911c66242d60e4c64cf33488bcc12a97b0f4030e08b744a51195bd4220a4a5080b1a92e9f5b
INFO:msmart.lan:Authentication successful. Expiration: 2024-02-11T07:51:12, Local key: 12c2a490d36b5841aba06cb8cb548918f11825e2a4285f625878140a39dbbc60
Sending query type QUERY_BASIC.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000003012e
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000150d33130a0218147943010000850000000000000000000000000000e0d87d4bf4e5735ba7745fc35ec456a034ece045f5d1633722e5ed1303b4b95c
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066a5c26f3c77d2317834a33e2f282c71f936df88c004a61c4c4e5d605a63bff0e75662f61ff2dd3cb02f90ed7e46d6b3e6537b8b7395bc69dc3b7419c06899424632096c6f57eb8d7fa1fcb7a1f259a3465f9e02b9224f8b388a6e03177c4892eb32dc99e4805e6592ab3472cb8db9bf77
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370008e2063b94680f3da3863fa624a281e73902f7f0906f5258c2456fee4253578bd30200f0c50f14603d5ffdbcda55fddec753dfe7665b49fe408ad41b8a19b15d1dbb4cea58d14231fe03ffb2eac792e0b3f59a4c397f10652fa5c4a157fae4128d7b026934420c21e38f4cc1877b08b6e444870af336eb1c8795b2f8606394b2ba1303c2f3869a642b05c62feac333155c8e149
DEBUG:msmart.lan:Received packet from 192.168.178.24:6444: 5a5a01116800208000000000e4e332070a0218147943010000850000000000000000018000000000350b83ca3c4d23ee2c29f50ca21702bdd85e4accd4d1865383fa9d436e464bd949d207396c26beddee94a762b3c25ed4b1e1cc69b84f5a4c3f4226d167c24df9
DEBUG:msmart.lan:Received response from 192.168.178.24:6444: aa23c300000000000003010517a10303191e143037191905371919053c223c142300002b
DEBUG:msmart.base_device:Response from 192.168.178.24:6444 in 0.130000 seconds.
DEBUG:msmart.device.C3.command:Query basic payload: 010517a10303191e143037191905371919053c223c14230000
Sending query type QUERY_DAY_TIMER.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000003022d
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000230d33130a0218147943010000850000000000000000000000000000bc1596d1a1370767f776847c4f5ce9351a503b659ef7066f34293e7a2e7fefc2
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20667e4cda883a918283d7ec53ca652681fc79611c09e5a318ce6a5aa7ad4c12b8b4f0427f04f3f29336ce0ffdaee341e69faba1b5adf5040a5667c6395f53f427d11da7d6d5508ca68a61e304726863d6c35dcd5c6f93ae7591a7ba42d283124c02c7c7501f42ed21a7b198c9cd770a9c9e
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370009e2063e47d8274782cf6814c0dabed73814077d729ced9fc3b754e04635befe770fe5fc3dfbbbdcaf393ca8ff8c0822f85e2ea5770234623d79a85d61c8fff3373c4e8a2b78d4a9df7defe42201abcdc7f08568b56194dad3fb5f0eff265934fdb79bf491bf1e736227c2bb2a60e2e216846e32a0d2ba335345f21567970341fc82d2f31be5e2e7c81fd1dc414e0446c9374d2e416cb4dbbab722a71a776cc373c1119
DEBUG:msmart.lan:Received packet from 192.168.178.24:6444: 5a5a01117800208000000000e4e332070a0218147943010000850000000000000000018000000000f15244d539ead4dd53576c42bb9f571c6d4bc3f61933867b16c190ee2c6076403e55e2b93077fd470d336de6686323528d4bbd6fb4a291383044d81041a297aebd000ae447b47ada67e2682e387cd3f4
DEBUG:msmart.lan:Received response from 192.168.178.24:6444: aa30c300000000000003020f0320040015000319150a03320514150a05000529050a1500031e00000000031e000000007c
DEBUG:msmart.base_device:Response from 192.168.178.24:6444 in 0.150000 seconds.
DEBUG:msmart.device.C3.device:Ignored unknown response from 192.168.178.24:6444: 020f0320040015000319150a03320514150a05000529050a1500031e00000000031e00000000
Sending query type QUERY_WEEKS_TIMER.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000003032c
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000330d33130a0218147943010000850000000000000000000000000000d8d7b91773d37484dc421382b619ec082ea7d8ebfe7ad68a996e0e773ec83766
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20669cafe8533b3e105a756f60eeca6eb699e280b27042b7b95b59b4cc20d36bb6de2728d25ba0f4e480050377515ab34b9202767c68f494fadc922c4251df1d8e9b51dc51cd30fa6a42c4f4c21063c1f2e7062ff29feafb88ec14b59676ca86cd57dac021b78fb5c104f40e6c182ea4f334
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370009e20634a1d379e9ad3b100be6fee72520a9bd682cbbb5c45b0a817f6aa628ce1692fa7269e959fda0a447ad3486e5c310538bf9721d2bedaea2926f8630874937ae9ec7ac349d1d3e67082e21acd5df21e5683f51fa19630104b7f26b3da80d2cc194ee4a0702bcc05ed5602a2630b423a6936a82923a74abaebb6eeb874bfd100c35a480cd7616a7f7021899443604296186028b8db75129d574ab8593d6a1e6ebb3e
DEBUG:msmart.lan:Received packet from 192.168.178.24:6444: 5a5a01117800208000000000e4e332070a02181479430100008500000000000000000180000000004de267b6cc3b946655206e1bc327e108df7080a249bce78a3e590cd1db7f1a696541eccbb0fce03bb29490c83f98d04de29fcf50743305d4c78e976f0c03fdeb9fbc2837516eecf7a48136c64dcf131e
DEBUG:msmart.lan:Received response from 192.168.178.24:6444: aa31c300000000000003030000031e00000000031e00000000031e00000000031e00000000031e00000000031e0000000040
DEBUG:msmart.base_device:Response from 192.168.178.24:6444 in 0.130000 seconds.
DEBUG:msmart.device.C3.device:Ignored unknown response from 192.168.178.24:6444: 030000031e00000000031e00000000031e00000000031e00000000031e00000000031e00000000
Sending query type QUERY_HOLIDAY_AWAY.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000003042b
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000410d33130a02181479430100008500000000000000000000000000003d6bc0d3f3073ea4da1b9f2481b767d1ce5b5d5eb1894ab539027dc5f2d8478f
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20661f399d59b12c787af68ef5dddac237e422502c53b189bb914dd86198c607c68812daaae73f5b972dd5c4ee21c7d5b51c0b502f70e2923188c04bd8a66101bf977d707731dd3c965d65d3377b4bbcc43b3ca472b8ea4b3579e5ef76009389405640d30290f0ce90085ba82f4acade4e4a
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370007e20637b4445fdd01b602d495e3358df656dc3a5fcb137bb2cb8c428bf38bc14567225ff2c0b04db5ccbe3016f2ea76007b426ba3aa85c9b18ab0b961ddd1893ab075e7be69c3aa34aa8f7e5796ebf7f1ad3b2ec3096cb3c2ba78aae15ac7da48fb02874fedb213ca92a172ca84f0c9c4e5997330c92397a5fccd86ce7e149759659fd
DEBUG:msmart.lan:Received packet from 192.168.178.24:6444: 5a5a01115800208000000000e4e332070a021814794301000085000000000000000001800000000064dd57887b4ca802b745b0f0763d3a39bbb86acdbd3c92eb5394eac847946805370c88b2ba91d646047b4da91d4de21b
DEBUG:msmart.lan:Received response from 192.168.178.24:6444: aa12c300000000000003040000000000000024
DEBUG:msmart.base_device:Response from 192.168.178.24:6444 in 0.130000 seconds.
DEBUG:msmart.device.C3.device:Ignored unknown response from 192.168.178.24:6444: 0400000000000000
Sending query type QUERY_SILENCE.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000003052a
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000004e0d33130a02181479430100008500000000000000000000000000007c9784672eaf03873f2be20438f65f46f064635b16631f0170a1980299b16148
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066fcb8636b7736f31eb9d420b31d51c6d60363f0def0bf1c446b47683538a66ffdce7effa31d291be346b5320af4f254c7adb694a086eabc1985297dd05b24075c7369cb0f075fd334f1c5532956b35b6194342bce63e11f0296a9b9950a32bd60236e5c133a75d62d3b7a8d0166462332
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370007e20637fc23838c7dd36019e3581dff1bb1602d226dfa18b96e234a359bcc6c53df309f6dd2217b7f4a5dfa5fcb7195d7ebf7bdb3b6ce1005fd23748adb71ec2cd5ae5db328a43d4bf2862fdee40410b2689a1d86d217a0e171e5a53eee009c75266ec563f814816a8483dd41e88d2fba2696641de77b2226ca7b8193150a34d680d53
DEBUG:msmart.lan:Received packet from 192.168.178.24:6444: 5a5a01115800208000000000e4e332070a02181479430100008500000000000000000180000000007f3e2140c4905086d9bef5fc97cd267939ba5e53f8fe78192f63849f5a6a3298ba34f6009863dfbf5c0b09cb4b77d21b
DEBUG:msmart.lan:Received response from 192.168.178.24:6444: aa14c30000000000000305000c000f0016000700e9
DEBUG:msmart.base_device:Response from 192.168.178.24:6444 in 0.120000 seconds.
DEBUG:msmart.device.C3.device:Ignored unknown response from 192.168.178.24:6444: 05000c000f0016000700
Sending query type QUERY_HOLIDAY_HOME.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc3000000000000030629
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000005c0d33130a021814794301000085000000000000000000000000000093a811bc787fa2eb53f1fcf63c5af53fbd8bad6fa6e61bfb263e8a59172b19b2
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e206618196f64ce4af60fef06e37aa6e762f8ccd2c2eb0890d10f963303425c0c4c30f78d49bc31422e70eefcb7d8aeaf2083bb3cca9c4e2bb70ca56031351779c590608c579bd12c104cbcd4a8b674960dd7aa5e8837c4a5682c4280bf9389e085db821feb0c5d25fb14c380b2f86e7a2782
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370009e20637800d1855f256b212e587f0d304bd9e6826a6b96e654b5a3c6a34795964b0768739adfe4ed6213e4c73a2bba076bd01c8364d9d4b685f13cdee7dc68031f3db9f34867f1cf50a7711208966cbe0b5a9d8f903ded6e619c65bd1a651c18c0514e44c28255a49b78424f1336a1797adde745bcebd6699a213482958395654ab2985ac76d03a32864965f63f444f49c6e14fb6b22a29a1f719006018d1d72ced292
DEBUG:msmart.lan:Received packet from 192.168.178.24:6444: 5a5a01117800208000000000e4e332070a0218147943010000850000000000000000018000000000df5b8ee5b8447462169d86bc8463ef6edf7080a249bce78a3e590cd1db7f1a696541eccbb0fce03bb29490c83f98d04d3b7534bcd1047831b7f6a99175c3340da88dd35f415d7e87b677377cb886ae6d
DEBUG:msmart.lan:Received response from 192.168.178.24:6444: aa37c300000000000003060000000000000000031e00000000031e00000000031e00000000031e00000000031e00000000031e0000000037
DEBUG:msmart.base_device:Response from 192.168.178.24:6444 in 0.190000 seconds.
DEBUG:msmart.device.C3.device:Ignored unknown response from 192.168.178.24:6444: 060000000000000000031e00000000031e00000000031e00000000031e00000000031e00000000031e00000000
Sending query type QUERY_ECO.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc3000000000000030728
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000000d0e33130a021814794301000085000000000000000000000000000039927f6a7f48e638b94872065691597bc13c71b3cecd2f15460bf7dfe8c39475
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066d5b5c0a5f2fecd8e42fac1eea6531e5c1f83afe6d2c88a4c2e29123913529d3d7e551284ad3d63f7a88d4c82c2b2a805b46d97951a30f8edbead0336ac1694c3ba8f14144eaf580f143ae115279df161814c7fc7461b6c958d5b685e7c9ece476ea92e2bdb9c436f32ec3d8bd332e905
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370007e2063500925c1af882ab67b2273fbd314e606b8531d622cb2735d484c24d7b321c01a6ad064433ca026ae7337ea2fd3a311b59b7160c7f249611e3da0ef66084de3eef97ebbca8ddfd1b4c81a78dce4648002c9237d6ddd8159f085d7d918a71bd4abfa4ed6fa30e23525c929184e667eab9ad95dd5247a8c7b358630eb8a856db14d
DEBUG:msmart.lan:Received packet from 192.168.178.24:6444: 5a5a01115800208000000000e4e332070a02181479430100008500000000000000000180000000007f5f9d70787620c65b29f055551b4b2610ebc7eca60443667e042fad6529511432db1ec6166c5d6005f6c2d2095da1d5
DEBUG:msmart.lan:Received response from 192.168.178.24:6444: aa10c30000000000000307000500170afd
DEBUG:msmart.base_device:Response from 192.168.178.24:6444 in 0.120000 seconds.
DEBUG:msmart.device.C3.device:Ignored unknown response from 192.168.178.24:6444: 07000500170a
Sending query type QUERY_INSTALL.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc3000000000000030827
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000190e33130a0218147943010000850000000000000000000000000000b1ef3839d0c05576221da79daddc959ac20ad06ca9951a2f20f2870a8cfa0348
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066fc134ac12282a427ae7022a3234de1dc3fd24fd6c70d21a481926a505b10472146e5789175132128f86dda821580e4a3ed76fa50732029ec35052eea72c837410ae93cd8659313a106175ec03717e5bb1208a2bc8155c77dc152b1a639ec8b9a0a01de92c6d780280e545b2650be66b5
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000190e33130a0218147943010000850000000000000000000000000000b1ef3839d0c05576221da79daddc959ac20ad06ca9951a2f20f2870a8cfa0348
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20665f16c06716190517e7c664317c0e204866118c23a0889fb82095a09c397b94ac0488041c332fcfc5465210adc4d579bcef14b9fddb7fe3c50e092d2a7492bd84a939f8b7356146f314639b0165ba033afb5cc1d57bedbe59ff05a66acde390ed3997625f51939f0742816a205876f286
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000190e33130a0218147943010000850000000000000000000000000000b1ef3839d0c05576221da79daddc959ac20ad06ca9951a2f20f2870a8cfa0348
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066c7d399f251bc62c833be11f43b4613d1bd7edb31049dd40d3b9962dff740b848eec935d7faac1ada7ef5ca9c87249949a7e7df5174804f745ddfabdeeffe16ee60d881b431c43cfc6d83f8e071b87232eb731d062a0c557a70ac147f8271125cf87a8e81e54771b31797c0c810dcf0f9
DEBUG:msmart.lan:Disconnecting from 192.168.178.24:6444.
WARNING:msmart.base_device:Network timeout 192.168.178.24:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.178.24:6444 in 6.060000 seconds. 
Sending query type QUERY_DISINFECT.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc3000000000000030926
INFO:msmart.lan:Creating new connection to 192.168.178.24:6444.
DEBUG:msmart.lan:Connected to 192.168.178.24:6444.
INFO:msmart.lan:Authenticating with 192.168.178.24:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370004020014345982c9376bda78968112f45aac6c24eefb512ea4178b4fc7562bdb6d3f3f763913ff4d26fd20ae8878b76097a89a38997dd9b6ad712a47b0c6be7de4205bb15b7
INFO:msmart.lan:Authentication successful. Expiration: 2024-02-11T07:51:20, Local key: 6d359787d4f4e544c483d3ba1843311b16511ce21dfbe5627b042e0bb56a8761
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000291533130a0218147943010000850000000000000000000000000000877976211bf2e6b6b7da1899b4dd3f15587d8e78dd030c96f88dc007fcafa0d2
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066703229256c8d8f674f2be1b95c90116972a721fdf2be55b335d2cdaba3ebbe9e5464d89f72a619ea8abbcfe92cf3cd411efec8d637efea7be5bb88703309fa025dc16d0f0eed1777d66fb3ba0b6a362d10eed6fee8b380a22d7b48d2c8810b35c0142d5c3d9f1fa1050e3d8ad9947de7
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000291533130a0218147943010000850000000000000000000000000000877976211bf2e6b6b7da1899b4dd3f15587d8e78dd030c96f88dc007fcafa0d2
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20662488a32a2929ec76383802296b6b46fe358fbf1578995c9a07905ac1bdf7102aca45606cc772dbfa5f309d308d3f373e8f50cd3f8ae3db6da8f177c0874a05dd9bffacf14755b5bdf12713a3b383db1a489503232f9dc49c56804051bc753713716ffc5fa86d00b81a0b0f096a5be322
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000291533130a0218147943010000850000000000000000000000000000877976211bf2e6b6b7da1899b4dd3f15587d8e78dd030c96f88dc007fcafa0d2
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066d0b9255e6a91435450861115f417a987523e7afb6a474c7a9d3eda0d31b3677379af2d8557995d53e5b3e5ba922feaaa6e7e6964109033c4845cbf177a948d9913e2e6a00b3bc5cb289ac6f16c217f841478afd6d2b4513ee1ca48af66b618007b65a2793ca69557717d378f316e6934
DEBUG:msmart.lan:Disconnecting from 192.168.178.24:6444.
WARNING:msmart.base_device:Network timeout 192.168.178.24:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.178.24:6444 in 7.150000 seconds. 
Sending query type QUERY_HMI_PARAMETERS.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc3000000000000030a25
INFO:msmart.lan:Creating new connection to 192.168.178.24:6444.
DEBUG:msmart.lan:Connected to 192.168.178.24:6444.
INFO:msmart.lan:Authenticating with 192.168.178.24:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370004020014345208f82bbc101044feecb6439477463d5d3b50271e703786c42bb2f3a4ff62b37256e0b64fd7cb9471c988ddb25f53111879822b8567afe8e5887d672f5680d91
INFO:msmart.lan:Authentication successful. Expiration: 2024-02-11T07:51:27, Local key: 33521b87bddb664165b7d5b8a293b01bc80c1fe14e14e5601aadaf08925a8762
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000381c33130a0218147943010000850000000000000000000000000000f35522ce2c4848aee843afc5b193d20e24639201ba43682db18a208f81618a53
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066fe150f2dd149fe4c96bd80b17dbbecc36a230bc95d6ad9d8ef0e0deb67607c87abb43966a29867ea9f804adbe6b8302d5b29e95134d974df6ed071b10bd0cda509aa2c1f81480de52d4f5907dbab28f1e37ce055d5b68efda5335dff066e2a51901a22c5cd46bff6edd0050316522c7c
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000381c33130a0218147943010000850000000000000000000000000000f35522ce2c4848aee843afc5b193d20e24639201ba43682db18a208f81618a53
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20661d25cdb9da3ff1456a070a8506e10e65ad8c1d8a163567a38f38af9064ed775a33eccfff9aba2c2358af16e878838c192b7de98691947268e51400511611b37fbc211477b4474bb3860d9d0a734a2fd496b5bb500061d9eea95ad833cbb36e6bc63110791b969fccfbeb3e76622b95e5
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000381c33130a0218147943010000850000000000000000000000000000f35522ce2c4848aee843afc5b193d20e24639201ba43682db18a208f81618a53
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20661a83ee11e474d35d3b39da170c2d722fba145cbe32e7c94aabbe53f1f6c26b1acbc46175e195522ff3d8e95a788c17fce98cae40aefabb6b00bf6912f73e418447c65e149d012b6836bbb5b1ce5d1858cff1cf4e4188ecb816345f84a5f0fe5693efb0936464eee6ebb908d3b35701c6
DEBUG:msmart.lan:Disconnecting from 192.168.178.24:6444.
WARNING:msmart.base_device:Network timeout 192.168.178.24:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.178.24:6444 in 7.150000 seconds. 
Sending query type QUERY_UNIT_PARAMETERS.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000003101f
INFO:msmart.lan:Creating new connection to 192.168.178.24:6444.
DEBUG:msmart.lan:Connected to 192.168.178.24:6444.
INFO:msmart.lan:Authenticating with 192.168.178.24:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370004020014345818dca02668903e1701ef489feb5cac3cbb810001fbc8a01290b9e4cb839d42bc70c4ef13f4106f9f0910ce6c94f522990fc757dc908022f168a87139c1c87ba
INFO:msmart.lan:Authentication successful. Expiration: 2024-02-11T07:51:34, Local key: 395e909aa3be6d401258d2b9df48b71c81d21ee602d0e464cc6bad0c46d10567
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000482333130a0218147943010000850000000000000000000000000000732dab8b9c3541bf676b207c58a390fc66ca96efd88166cef5e63fd5aa6b4887
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066f5785c3f577b224b71698de95009af41003662add1fe4779fdb99259406a50c94d8babc2ff805fbc568a900f099716827fd0baf470a9adab239fb0eb44e5f29bdb0e4511a7ee57b35da342329e5a79dff5b75e82303e0d10e2a5aed54c9cc124a1db448e96f34eed08d6de41bd715439
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000482333130a0218147943010000850000000000000000000000000000732dab8b9c3541bf676b207c58a390fc66ca96efd88166cef5e63fd5aa6b4887
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066c6db06dc982f7e3455b233a186e480d1f2ffdf7d312158ec6da9e958129c8b7092b92764c8375e63393ace4449ddd639ad744a6e104b1c34525938d4d5c85ec5bfed01589448f22434ffaf758f30d32b331807092891532b47bac232e38f93e987e817eb541d4931ea773523400037e1
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a01114800200000000000482333130a0218147943010000850000000000000000000000000000732dab8b9c3541bf676b207c58a390fc66ca96efd88166cef5e63fd5aa6b4887
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066269bd3bdddf34c81a810fb13d49ef430e00f0099c1d40a508f4c6d55501d396d8caf81e800abb7a260e1035957daaff69d82e574cf31e469d6be4bd372b3a036d0648a0d3b6f8b6404d834c39cca9056b6f2e42729a20d889c6f9c749f8808a89ca4f861b70d48cb3c37b33dfb425da0
DEBUG:msmart.lan:Disconnecting from 192.168.178.24:6444.
WARNING:msmart.base_device:Network timeout 192.168.178.24:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.178.24:6444 in 7.150000 seconds. 

@mill1000
Copy link
Owner

Excellent! Thank you again.

Any luck with those screenshots?

@mill1000
Copy link
Owner

Thanks again. I'll review this in a few days. Appreciate your patience

@nixmeer
Copy link
Author

nixmeer commented Feb 17, 2024

Wait 😂 you’re the one doing all the work

@mill1000
Copy link
Owner

Cool looks like there was an unsolicited message from your device

DEBUG:msmart.device.C3.device:Ignored unknown response from 192.168.178.24:6444: 0400000012fc000023aa0b201e2930ffff01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000014

This is an "up" type message with "power4" payload.

I think it roughly breaks down like so

  • "total electricity" = 4860 # Lines up with power from control unit
  • "total thermal" = 9130 # Not sure what this number is
  • "T4" = 11C # Outdoor air temp
  • zone1 temp set = 32 # Matches app
  • zone2 temp set = 30
  • "T5s" = 41 C # Water tank temp
  • "Tas" = 48 # Not sure
  • "voltage0" = 225 V # Seems reasonable
  • "power_tbh" = 20 # Not sure

@mill1000
Copy link
Owner

I wonder if there are any other messages that might be solicited. Can you run the last example even longer?

@nixmeer
Copy link
Author

nixmeer commented Feb 23, 2024

I can help with

"total thermal" = 9130

That is probably the thermal energy that was produced using the 4960 kWh of electrical energy

@nixmeer
Copy link
Author

nixmeer commented Feb 23, 2024

Is it possible to request these messages at a higher interval?

@mill1000
Copy link
Owner

You can try reducing the sleep duration between refresh() calls, but I'd guess the unsolicited messages are sent at fixed time intervals.

@nixmeer
Copy link
Author

nixmeer commented Feb 24, 2024

Here you go:
output.txt

(GitHub does not allow more than 2^16 characters....)

@mill1000
Copy link
Owner

Thanks. I still only see the "power4" messages so that might be the only unsolicited one it sends.

I wonder now if we can request that message so we don't have to wait to get some of the data

@mill1000
Copy link
Owner

Here's a quick test to see if we can solict the power messages. Totally a guess

import asyncio
import logging

from msmart.device import HeatPump as HP
from msmart.const import DeviceType
from msmart.frame import Frame

logging.basicConfig(level=logging.DEBUG)

DEVICE_IP = "YOUR_DEVICE_IP"
DEVICE_PORT = 6444
DEVICE_ID = "YOUR_DEVICE_ID"

# For V3 devices
DEVICE_TOKEN = None  # "YOUR_DEVICE_TOKEN"
DEVICE_KEY = None  # "YOUR_DEVICE_KEY"


class UpCommand(Frame):
    def __init__(self, type) -> None:
        super().__init__(DeviceType.HEAT_PUMP, frame_type=0x4)

        self._type = type

    def tobytes(self) -> bytes:
        return super().tobytes(bytes([
            self._type
        ]))


async def main():
    device = HP(ip=DEVICE_IP, port=6444, device_id=int(DEVICE_ID))
    if DEVICE_TOKEN and DEVICE_KEY:
        await device.authenticate(DEVICE_TOKEN, DEVICE_KEY)

    for i in [1, 3, 4, 5]:
        print(f"Sending up type # {i}.")
        command = UpCommand(i)
        await device._send_command_parse_responses(command)

if __name__ == "__main__":
    asyncio.run(main())

@nixmeer
Copy link
Author

nixmeer commented Mar 1, 2024

Hi,
it does not look like there was any answer:

Output
DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.178.24:6444.
DEBUG:msmart.lan:Connected to 192.168.178.24:6444.
INFO:msmart.lan:Authenticating with 192.168.178.24:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370004020014345ca1f6959357a85616aee41ff8e85aca1ad8c5bbe63c22fea13c6891ffceb20b58e998b515bf250db3cacbd661b1eab3f988e5b291eebf848f22dd6ff3f4b28ed
INFO:msmart.lan:Authentication successful. Expiration: 2024-03-02T00:23:40, Local key: 95d8c35db263338cd8db0773cb26e4d37853482a942731aaac2bfac3916a53a9
Sending up type # 1.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000004012d
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000002729170c01031814794301000085000000000000000000000000000037a9279381fa04e1c2d7693ef77024d97df31aa6ac5c2dde68e836fa6ff10e55
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e206687af84c38e50a43ee06f8b5ea406eeb757170318b7b2cd7bd4cfbcd494f50feb3a8852a8d449f0d9b200b33dedaf405a3a3aad62e53fff21ffbe4cee29efc75d273e632521dcbb40ff4863648304cec376058292da21f3482f372c193a738de1fc3b19e01693e9b77d44ffbe67219bc1
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000002729170c01031814794301000085000000000000000000000000000037a9279381fa04e1c2d7693ef77024d97df31aa6ac5c2dde68e836fa6ff10e55
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20661939884a8a564a10b878507f650e811620662764a54b943d0c3c3603d35a267cb062e820ff265002a0b9bcf950b5d29041e554ad79212f4f70fa8b40c818283a02c93c153467fd22eaa1cf69168473dc08f48aa0b3e20134bf9c0e7e2a323d5baa52e7c894c0edd15ce3772cc9f626e9
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000002729170c01031814794301000085000000000000000000000000000037a9279381fa04e1c2d7693ef77024d97df31aa6ac5c2dde68e836fa6ff10e55
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066ef8212e180ece6f3b89e7fbdb3e31e28cf8fb236c6c394771ff9973e35e5cd3294b1acda5db3810886f5302f15599185ec131a4ae876ca0efb6e12bd1726d6d2e9c75f2f457a9d3b3ba0c871991e03e4f955bbccf46eca2becaceeb8fffba445b94b6d4904c72bf44d72e53b3d3d2483
DEBUG:msmart.lan:Disconnecting from 192.168.178.24:6444.
WARNING:msmart.base_device:Network timeout 192.168.178.24:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.178.24:6444 in 6.070000 seconds. 
Sending up type # 3.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000004032b
INFO:msmart.lan:Creating new connection to 192.168.178.24:6444.
DEBUG:msmart.lan:Connected to 192.168.178.24:6444.
INFO:msmart.lan:Authenticating with 192.168.178.24:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 8370004020014345edcfd80f97f9acd9b38fc54d9ee9187b25cac89e0feb6ec9a74d9640fd4fe6130fc82b55a6968f0467a3d4640b34122348bbe0cb86cc06707703233ef3f0b8ad
INFO:msmart.lan:Authentication successful. Expiration: 2024-03-02T00:23:47, Local key: fa434d73bbd4b28ffd5f0b77dd346fd178d8452b0d273fa83e6777c0cfa35fab
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000003530170c010318147943010000850000000000000000000000000000f59e3d32dd255481a99465c140814a2c39b972f7155f2feedbbaf3cbdcdf36ea
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066e9263875a63fe333df9ad4a182a88f6e18542253e4f6ba3edc3a5f3a257c6db57f746c8a20310d047fec659137583acb0c9c57fc157b20ea0d91e3ffff3c8c28d9d0c66dfacc49ebe79aca56d8de9cbf1a6dd39be7e870be114f874426f4b62000333fb4950b7c1216a086c809749888
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000003530170c010318147943010000850000000000000000000000000000f59e3d32dd255481a99465c140814a2c39b972f7155f2feedbbaf3cbdcdf36ea
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20660eb2e3dbe94be7fce8a189a3a3294f02e30db8aa3157e3c31f177943a3f89205962b3149149533e3ca47e89b38202ddf1d749bbdd1c271d984baafe9a9aefe768aef53c918002b00521f598c0d8571d75774b300b8602633c31a4ca87c2cf06ae3238f20df630574d043622a831895ba
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000003530170c010318147943010000850000000000000000000000000000f59e3d32dd255481a99465c140814a2c39b972f7155f2feedbbaf3cbdcdf36ea
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066642e455e24c7d95a34f1b6bf89534dae55bfdb912360a31ae8d0343456a5f90b54e97aca0a472a64383439d18b94ff97a6c71c1106a540ec0666b20b0a4878f34b860ea68a79add4d1a273d768daabb3e66cba6bf60d03c47228554d0a9dbc3d5fbef1c9dc346a0c89cf1942b851c697
DEBUG:msmart.lan:Disconnecting from 192.168.178.24:6444.
WARNING:msmart.base_device:Network timeout 192.168.178.24:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.178.24:6444 in 7.130000 seconds. 
Sending up type # 4.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc300000000000004042a
INFO:msmart.lan:Creating new connection to 192.168.178.24:6444.
DEBUG:msmart.lan:Connected to 192.168.178.24:6444.
INFO:msmart.lan:Authenticating with 192.168.178.24:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 83700040200143451101967d04135d8b0184f84ac4f763740cce791ecb2768ed1a845b8c3a98e894e01b455053bc29f122f067253ff4db5b0e96b8ffa0993590fefbbfbbfa39f673
INFO:msmart.lan:Authentication successful. Expiration: 2024-03-02T00:23:54, Local key: 7615c942d3923282856b8778d708e1d87addcd233626b6a3817a7dcb6c7cd5a1
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000004537170c0103181479430100008500000000000000000000000000003fb79eb356499bea61754eafa9cd6891394194e2b8214a3c5e929f864b37c090
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20661e60828387baca782d05f648af8fbc517d74f4cc38598067e27f771a6508fc653197bb2fae662b8bbcb2b581ae132d632a31c6050b6c5998e161fd0b5960b2b4fdf6607d16096604b9ad2d29d20006fc05ed40a5d9f13831b5bcc115909348272adbd30d1b442762f7730f05631380cb
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000004537170c0103181479430100008500000000000000000000000000003fb79eb356499bea61754eafa9cd6891394194e2b8214a3c5e929f864b37c090
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066e52e2a53ac1c671db1a68baa934f50db9b8a64d2633a701481a8307ab272f08d941db94cfbbb6f4ed9cee62026349964982f374bcf386b82f76e1d7757c4763d5ae257540a13b109b316b79de48034199b134bb8ded8adc1961ea31bc8b13c9c2c33a001a0993710fd5fcb2211ea514f
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000004537170c0103181479430100008500000000000000000000000000003fb79eb356499bea61754eafa9cd6891394194e2b8214a3c5e929f864b37c090
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e20660780bfb3871d13e3481dc3dba31a81a9991bb07c3c08d8f25bc62f314461e529eca5ad97126ccfb0563026a7c8cd6ebbfb22a3ba420c56953dc5b0e993d4edd8de314522c8a2677de40c524ab1015a77c49eb850c90cc652552503462e2cf039deeb077e727a143abe8f9828758838e1
DEBUG:msmart.lan:Disconnecting from 192.168.178.24:6444.
WARNING:msmart.base_device:Network timeout 192.168.178.24:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.178.24:6444 in 7.140000 seconds. 
Sending up type # 5.
DEBUG:msmart.base_device:Sending command to 192.168.178.24:6444: aa0bc3000000000000040529
INFO:msmart.lan:Creating new connection to 192.168.178.24:6444.
DEBUG:msmart.lan:Connected to 192.168.178.24:6444.
INFO:msmart.lan:Authenticating with 192.168.178.24:6444.
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370004020000000c657cbc7b661813474bfebe2748067069795be2e672f0f4ee46ff7d5a6548999ffbac09fbfac92a2f844b218286a5602101d0c9c65c2d5bc84793dbcf9fc9eb2
DEBUG:msmart.lan:Received data from 192.168.178.24:6444: 837000402001434589c8e9381b372ac1c5d3e7d71b6f0994b3012f8ce8cf5c352952af74a9d294eb8c03552c427950ef6defa7c7e9e15447f0f1317e3168bba44856b0cdc1a9f759
INFO:msmart.lan:Authentication successful. Expiration: 2024-03-02T00:24:01, Local key: 5c74ca47a0a735872272807f5c7be4df9bb8c825c176b2a54321f9cd25bd51a7
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000005402180c010318147943010000850000000000000000000000000000f4d8f05dd0cb7cc952ef7b4ac7301fe26cded7fc9285dbbb0a32173c1f45cbdd
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066a484032298e18dd5482ca401740f6f18c4d89e0b1a8da6b1505551f004c787dcc5afe180d40591d89c6577776308d5793a26577975ed4929210dc13a324b8295ed6c7339055cafd6f819eb21bfa676bf3df0a260b820a02b53a8b7ebe5209b8c2c59d806c6eef191d5623ecde2563803
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000005402180c010318147943010000850000000000000000000000000000f4d8f05dd0cb7cc952ef7b4ac7301fe26cded7fc9285dbbb0a32173c1f45cbdd
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066523556593e65ec4e97bd1478cb97e26e7e31061ed2e6bdcf5e94e795d38b086989cacf41da16d8c6a28d4a08499dd28b307c4c2f9605a061789b6ac1d3fef2fd3f197808c7648d5f2673613c7c4e75de74ca063306794f7ca297d8366a7f4528647d96803299ba78bb20bc0e906bdeb6
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.178.24:6444: 5a5a011148002000000000005402180c010318147943010000850000000000000000000000000000f4d8f05dd0cb7cc952ef7b4ac7301fe26cded7fc9285dbbb0a32173c1f45cbdd
DEBUG:msmart.lan:Sending data to 192.168.178.24:6444: 8370006e2066d156b4c5d5d8a1029ab3a46fcb4d7525ec9fad287c59b4d086884a8b45a9e874002c5d8efcf6ba8bc9b10d3911f172e8b817dfc012391d2c1348186d899d077fe5e5e1009d04cb813c20d452b31294efd31fd591eff137bfcc03e1996e0542ec5f7b0c7da0fdbee3bd4cf1f902d73d59
DEBUG:msmart.lan:Disconnecting from 192.168.178.24:6444.
WARNING:msmart.base_device:Network timeout 192.168.178.24:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.178.24:6444 in 7.150000 seconds. 

@mill1000
Copy link
Owner

mill1000 commented Mar 1, 2024

Thanks. Ok, looks like we just have to wait for the power messages.

At this point, I think the path forward is to start implementing and testing the control messages.

Here's a short TODO

  • Implement Response class for "power4" and parse responses
  • Cleanup/finalize ControlBasicCommand class and test it
  • Implement ECO & SILENCE control and query classes
  • Implement properties and methods to tie together device state with relevant commands

@mill1000
Copy link
Owner

mill1000 commented Mar 6, 2024

Ok, just pushed an update that should allow you to do some basic control of the device.

Supported controls

  • Run mode (Heat, Cool, Auto)
  • DHW temperature
  • DHW on/off
  • Zone1 temperature
  • Zone1 on/off

Here's an example

import asyncio
import logging

from msmart.device import HeatPump as HP

logging.basicConfig(level=logging.DEBUG)

DEVICE_IP = "YOUR_DEVICE_IP"
DEVICE_PORT = 6444
DEVICE_ID = "YOUR_AC_ID"

# For V3 devices
DEVICE_TOKEN = None  # "YOUR_DEVICE_TOKEN"
DEVICE_KEY = None  # "YOUR_DEVICE_KEY"


async def main():
    device = HP(ip=DEVICE_IP, port=6444, device_id=int(DEVICE_ID))
    if DEVICE_TOKEN and DEVICE_KEY:
        await device.authenticate(DEVICE_TOKEN, DEVICE_KEY)

    await device.refresh()
    print(device)

    # Change DHW temperature
    device.dhw_target_temperature = 35

    # Turn off zone1 and set temperature
    device.zone1.target_temperature = 30
    device.zone1.power_state = False

    await device.apply()
    print(device)


if __name__ == "__main__":
    asyncio.run(main())

If you can, try adjusting a few settings and report back with the results.

@nixmeer
Copy link
Author

nixmeer commented Mar 9, 2024

Hi
Well, to me it is the top priority to get all the data points from that display to my database. Seems like this is not the way to go :-/ maybe through ESPhome then.

However, if you want to continue your work, I am happy to test for you.

@mill1000
Copy link
Owner

Hi Well, to me it is the top priority to get all the data points from that display to my database.

Well, I think that would be possible. The tool would have to maintain a connection (like calling refresh() every 60 seconds or so) and then pass on the data in the power4 messages.

Let me know if you do end up going with ESPHome. I'd be curious to know what you come up with.

@mill1000
Copy link
Owner

Would you be able to test the basic control example above? I'd like to know if that's working if I end up shelving this development.

@radumpopescu
Copy link

radumpopescu commented Mar 18, 2024

Hi!
I have been lurking here for a couple of weeks. I also have a MDV Heat Pump (MDV IMPACT SPLIT Air-Thermal-8A1HB)
I did try your latest code and it doesn't seem to control any setting. I tried with various enable/disable dhw/zone1 or temperatures and there were no changes... But at least the current information (temperatures or running state) are ok. Attaching the logs below...

I think I have similar requirements from this as @nixmeer. The most important thing for me would be to get all the information possible. On the display I can see a lot of interesting temperatures... And also I could see in the .lua file that they might be present in the responses. Also secondary (but still important) would be to be able to control the DHW and heating temperatures. Plan is to have an always running Python script on my RPI that always queries and relays info to MQTT to be used by other automations...

Thank you for your work! I'm here if you need me to test anything. I'm a web developer and my Python skills are limited but I can also do some debugging.

Logs from this:

INFO:msmart.lan:Creating new connection to 192.168.3.101:6444.
DEBUG:msmart.lan:Connected to 192.168.3.101:6444.
INFO:msmart.lan:Authenticating with 192.168.3.101:6444.
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370004020000000501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370004020011e422e20404919bad1d4944d0175df6bd05dc5d16f68ace5e085a669f665ac1fc349290218c0dbe3dfe3a5bf411dacd5417c82802fa60382daca1c389cee102c7ff3
INFO:msmart.lan:Authentication successful. Expiration: 2024-03-19T03:54:47, Local key: 1f1ce776a90991ad3f3ab47bbd696a403df331cfb25c10571abf15b739fa727c
DEBUG:msmart.base_device:Sending command to 192.168.3.101:6444: aa0bc300000000000003012e
DEBUG:msmart.lan:Sending packet to 192.168.3.101:6444: 5a5a011148002000000000001030360f12031814de630300008c0000000000000000000000000000e0d87d4bf4e5735ba7745fc35ec456a080d6e9185bdb72503df3b7506e5d9eca
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370006e2066da84833b3c7e311b05867245cce56b67085914c31696874b48e28b1ab8bd91ed0ef364fefa0ec1abb52d545fc2f6a96a5f4b1d1824daaa40303b4c4d3aa23d2f0232d292fa78e7541419f71312826758f7e901565f581623773533a4b5144ec05a599f28171ea7b49219c3cabef28a41
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370008e20632eada2223dc976680ae27d4aa85e4ec6b996e69e41679974897145339f7a60a391e994cf9060578c476379b2925cf167ac319b5fe0d4c9b552c1b4fecf0f4046d32b321de5d97003d49548a80c0a49a56b56a641f7baff191703e1bfecf68a062246598009826b9d38207e04052823d2f3551e31b3bf5481895d28878820293eb0234bfa2f1d7bea02dbcd2e3ab3560a
DEBUG:msmart.lan:Received packet from 192.168.3.101:6444: 5a5a011168002080000000008059360f12031814de630300008c00000000000000000180000000002569fb7cb263b76b88d6e8e9b2f829314f8f85bbb9f45184b46dca95edc6b5648b0cb8eb63e6ebfb6e06737302869ae9e0a1b5d8353a45568e6ff62b3ce7f7bc
DEBUG:msmart.lan:Received response from 192.168.3.101:6444: aa23c300000000000003010417a00303241e323037191905371919053c223c143800806f
DEBUG:msmart.base_device:Response from 192.168.3.101:6444 in 0.080000 seconds.
DEBUG:msmart.device.C3.command:Query basic response payload: 010417a00303241e323037191905371919053c223c14380080
{'ip': '192.168.3.101', 'port': 6444, 'id': 153931628110814, 'online': True, 'supported': True, 'type': <DeviceType.HEAT_PUMP: 195>, 'name': None, 'sn': None, 'key': '2d4cbef18462421ea9de63cd24d0b8f4794d6179710c42e0b7ac4601d7dea0ca', 'token': '501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c', 'mode': <RunMode.HEAT: 3>, 'zone1_power': False, 'zone1_target_temperature': 36, 'zone2_power': None, 'zone2_target_temperature': None, 'dhw_power': True, 'dhw_target_temperature': 50, 'water_temperature': 56, 'outdoor_temperature': None, 'electric_power': None, 'thermal_power': None, 'voltage': None}
DEBUG:msmart.base_device:Sending command to 192.168.3.101:6444: aa14c3000000000000030104031e19233000000094
DEBUG:msmart.lan:Sending packet to 192.168.3.101:6444: 5a5a011158002000000000001930360f12031814de630300008c0000000000000000000000000000b803fbe128c7251c2754fa92e3cfdda39bae9ce28b2f10bdbe480247b2f903f02a0fd611ec3d29e943feacc0344d0b64
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370007e2066940858475d9853aaffe1eba22167f329a0f0ff2199194a7fe7612b6ee2fdf4d17a4b37ece88bdb99782ff5b17305bf6a39f38ed80e49814648aa52f179237d69c8e12749c224231e85b40180d73211ce4d69b5250fdf68fe99caf0917583437023a6641d3853be07dc9f3f4cf6e2f082ec0dc88f20744cc5cdbfe7efe8a3184a
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370008e20633fe49d91f187c08a112dc109ecf46d531921cc4527a99529ee78f0b6cc1c027cf3b060d8b6e34e6d6fb7b646d76ed80fa910ba58f75cd60b5500b0c470cb60385b9c94684ad0c56904d76fbe8d18645a564e9946f7a9e6dc8cbd7ee4070da78d3915d3feb9eab34bc99173b58c2e15830e698c8b9ec5f4c87d6554581aaf774a0b81e16a90a413dfd2eac1d22c4f5b8f
DEBUG:msmart.lan:Received packet from 192.168.3.101:6444: 5a5a011168002080000000008059360f12031814de630300008c00000000000000000180000000002569fb7cb263b76b88d6e8e9b2f829314f8f85bbb9f45184b46dca95edc6b5648b0cb8eb63e6ebfb6e06737302869ae9e0a1b5d8353a45568e6ff62b3ce7f7bc
DEBUG:msmart.lan:Received response from 192.168.3.101:6444: aa23c300000000000003010417a00303241e323037191905371919053c223c143800806f
DEBUG:msmart.base_device:Response from 192.168.3.101:6444 in 0.100000 seconds.
DEBUG:msmart.device.C3.command:Query basic response payload: 010417a00303241e323037191905371919053c223c14380080
{'ip': '192.168.3.101', 'port': 6444, 'id': 153931628110814, 'online': True, 'supported': True, 'type': <DeviceType.HEAT_PUMP: 195>, 'name': None, 'sn': None, 'key': '2d4cbef18462421ea9de63cd24d0b8f4794d6179710c42e0b7ac4601d7dea0ca', 'token': '501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c', 'mode': <RunMode.HEAT: 3>, 'zone1_power': False, 'zone1_target_temperature': 36, 'zone2_power': None, 'zone2_target_temperature': None, 'dhw_power': True, 'dhw_target_temperature': 50, 'water_temperature': 56, 'outdoor_temperature': None, 'electric_power': None, 'thermal_power': None, 'voltage': None}

@mill1000
Copy link
Owner

Thanks for testing. There was a silly bug in the control commands. I just pushed a fix so if you could test again that'd be great.

@radumpopescu
Copy link

Nice! It Worked!

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.3.101:6444.
DEBUG:msmart.lan:Connected to 192.168.3.101:6444.
INFO:msmart.lan:Authenticating with 192.168.3.101:6444.
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370004020000000501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370004020011e42d57f2dcc98fae181d4e280da05d2be2f484ff31a7a3fe6c537a60450e414fbd4497dcea6e5363f66cf44ee0d2e306aa3bd4c1c4d95a289816d6e271bc7dee9ea
INFO:msmart.lan:Authentication successful. Expiration: 2024-03-19T05:16:15, Local key: 467ba628fb805de00336fb3004d2a30ab38af9867e3e5b1ecd7cdeffcfb4b834
DEBUG:msmart.base_device:Sending command to 192.168.3.101:6444: aa0bc300000000000003012e
DEBUG:msmart.lan:Sending packet to 192.168.3.101:6444: 5a5a011148002000000000001c10101112031814de630300008c0000000000000000000000000000e0d87d4bf4e5735ba7745fc35ec456a0e7fed1f78658e16d751dc86c9bccd357
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370006e20660448a611596c2775cbd00b51b3a44ca8c604fea13d07ec25e042540c02cf0bf01cca8eec7a64ef067a16e60f6cd2780025bde65f37a10d72bb94beb805aa940f77e923f9b26954426844d93581cb097b7bf0b21054b6526630b75f9f6394b301662736501cdef0b4638757940d260829
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370008e2063efe4eaa76fc30587c05ef66ca34263e4529f557f093467f1e311b0fc9a4ab97437f093780485b58b18e946a9a32800e8939d9643d040a69e96e5b1545ca2bf9a295145da90f662badc6a088d98881d87cd0434e7c94a658aaa13c7ae6c041d8e69b622f72c67e7c0ccaf0e1793f30b92c31e9bbbfb49b101ca8ea7a12074961e971bb3685b3d8d5dd3224290b7b0e3a4
DEBUG:msmart.lan:Received packet from 192.168.3.101:6444: 5a5a011168002080000000004e2d0f1112031814de630300008c0000000000000000018000000000ed6e1c5a837f15dfcdf5871f66bb6df94f8f85bbb9f45184b46dca95edc6b5647d3e86246a00324fb983c8b4dce96eff9cce6fc72c5341fe5dde6a343cf99144
DEBUG:msmart.lan:Received response from 192.168.3.101:6444: aa23c300000000000003010517a00303241e323037191905371919053c223c143800806e
DEBUG:msmart.base_device:Response from 192.168.3.101:6444 in 0.080000 seconds.
DEBUG:msmart.device.C3.command:Query basic response payload: 010517a00303241e323037191905371919053c223c14380080
{'ip': '192.168.3.101', 'port': 6444, 'id': 153931628110814, 'online': True, 'supported': True, 'type': <DeviceType.HEAT_PUMP: 195>, 'name': None, 'sn': None, 'key': '2d4cbef18462421ea9de63cd24d0b8f4794d6179710c42e0b7ac4601d7dea0ca', 'token': '501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c', 'mode': <RunMode.HEAT: 3>, 'zone1_power': True, 'zone1_target_temperature': 36, 'zone2_power': None, 'zone2_target_temperature': None, 'dhw_power': True, 'dhw_target_temperature': 50, 'water_temperature': 56, 'outdoor_temperature': None, 'electric_power': None, 'thermal_power': None, 'voltage': None}
DEBUG:msmart.base_device:Sending command to 192.168.3.101:6444: aa14c3000000000000020105031e19233000000094
DEBUG:msmart.lan:Sending packet to 192.168.3.101:6444: 5a5a011158002000000000002410101112031814de630300008c0000000000000000000000000000f856a33a818e638859744cb2e7f023529bae9ce28b2f10bdbe480247b2f903f0178c27138575d906a6a0cbd2446946ea
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370007e206671cabdd198124fe838564fb036c634e7e0fdd83d7e3d78925032e5ed6f0c9599d324a8f6fcfe62b1d410a302e93dcc30d95210bcf35c4a2393d8bcda4e6c3c402f12191a750b66153241a2f0c051a4b9087fbaa64807ac6733b7f37ff2d6991a2ae7b7561548be774b3a16293f494025ba7ec34e201348d50b630beeb730e14a
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370008e206300fff893c37ce349a936b5e278d4e7170e48e80ca10d68002f7b86b0a3970d7f09ff312386084fd7fa4b24eae715013be3830f4bc2ccd3966495a3855240f1e072d8ec4535d38db2ee7c1111aa198db06256533a07e2eb05a673581a38382ee35612087483a4d521a32eb026449ddcda5b290eff292ec7d866146610d30c838e0b58e1fed81a12fe9c94f70cf6722731
DEBUG:msmart.lan:Received packet from 192.168.3.101:6444: 5a5a011168002080000000004e2d0f1112031814de630300008c0000000000000000018000000000c0c043a865668dd870998fb2ad2e2ee8ad731285daa3fcbf1f2ebbccf5da5d4a45d74e99fddb7c7b7be0b595219cd049f8d9f4531fe468ff323b330f8007fd00
DEBUG:msmart.lan:Received response from 192.168.3.101:6444: aa23c300000000000002010517a003031e19233037191905371919053c223c1438008089
DEBUG:msmart.base_device:Response from 192.168.3.101:6444 in 0.130000 seconds.
DEBUG:msmart.device.C3.device:Ignored unknown response from 192.168.3.101:6444: 010517a003031e19233037191905371919053c223c14380080
{'ip': '192.168.3.101', 'port': 6444, 'id': 153931628110814, 'online': True, 'supported': True, 'type': <DeviceType.HEAT_PUMP: 195>, 'name': None, 'sn': None, 'key': '2d4cbef18462421ea9de63cd24d0b8f4794d6179710c42e0b7ac4601d7dea0ca', 'token': '501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c', 'mode': <RunMode.HEAT: 3>, 'zone1_power': True, 'zone1_target_temperature': 30, 'zone2_power': None, 'zone2_target_temperature': None, 'dhw_power': True, 'dhw_target_temperature': 35, 'water_temperature': 56, 'outdoor_temperature': None, 'electric_power': None, 'thermal_power': None, 'voltage': None}

@mill1000
Copy link
Owner

Well mostly :) It looks like the Zone1 power didn't turn off like I expected.

Was this line present in your example?

  device.zone1.power_state = False

@radumpopescu
Copy link

radumpopescu commented Mar 18, 2024

Yes.. Sorry, I must have changed it in my test
Here's the output exactly with your example:

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.3.101:6444.
DEBUG:msmart.lan:Connected to 192.168.3.101:6444.
INFO:msmart.lan:Authenticating with 192.168.3.101:6444.
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370004020000000501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370004020011e42c33c62e3869211011d4cedc0c035e03d87d16a259c47bd74831f4cf02759a17ecab4dc033fe1aa5fb8dc57e847f70b25323f8efa8054de3a2b403069276f6c20
INFO:msmart.lan:Authentication successful. Expiration: 2024-03-19T08:11:59, Local key: 742338e55146c91337bc61c67c173cfb8469e175ef7ac1eefbeb470eaa70a0c4
DEBUG:msmart.base_device:Sending command to 192.168.3.101:6444: aa0bc300000000000003012e
DEBUG:msmart.lan:Sending packet to 192.168.3.101:6444: 5a5a011148002000000000002a000c1412031814de630300008c0000000000000000000000000000e0d87d4bf4e5735ba7745fc35ec456a060a7ae9fa5231d6d97482a409aa49d65
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370006e206675d9ce4de19fd47891d9a02be552b468255ccee5f33bd52f98f06846c842ff73caaa167b4906b70f365d83fb9ef11fcdc2b81a05bf8a0c8266f573a4ddf093ed6267845c206c051611e1e312b58d7ec6467096b3c059143bddccc0cce4525ed2d76dbc4e09ad3b431f8d20539f9a7f06
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370008e2063f9acb1a060320e42adc9356f3e71dcf26007994b356e05e92cbb8f9712fbad93d32b183e63ba9ab678c8566b93f88d27e13546ab04a77dc17304cc07e9315cf87767517076653409d91bc47aac26a2fb236132665025e16112572ba24746eacfa9e1ecb1fe58ff5661c6226dfe84712af80dd29924fa5b61e9e6f8c099136fc5dab250cc5bd8678315a6e361ed23e29f
DEBUG:msmart.lan:Received packet from 192.168.3.101:6444: 5a5a0111680020800000000060220b1412031814de630300008c0000000000000000018000000000ed6e1c5a837f15dfcdf5871f66bb6df955bca5616db68c6c103d7acc554526d42fd31c81fdc84118d70ee42e094b26afd8b8f3a738af0c6005a00bf7f98d20f6
DEBUG:msmart.lan:Received response from 192.168.3.101:6444: aa23c300000000000003010517a003032419323037191905371919053c223c1437008074
DEBUG:msmart.base_device:Response from 192.168.3.101:6444 in 0.090000 seconds.
DEBUG:msmart.device.C3.command:Query basic response payload: 010517a003032419323037191905371919053c223c14370080
{'ip': '192.168.3.101', 'port': 6444, 'id': 153931628110814, 'online': True, 'supported': True, 'type': <DeviceType.HEAT_PUMP: 195>, 'name': None, 'sn': None, 'key': '2d4cbef18462421ea9de63cd24d0b8f4794d6179710c42e0b7ac4601d7dea0ca', 'token': '501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c', 'mode': <RunMode.HEAT: 3>, 'zone1_power': True, 'zone1_target_temperature': 36, 'zone2_power': None, 'zone2_target_temperature': None, 'dhw_power': True, 'dhw_target_temperature': 50, 'water_temperature': 55, 'outdoor_temperature': None, 'electric_power': None, 'thermal_power': None, 'voltage': None}
DEBUG:msmart.base_device:Sending command to 192.168.3.101:6444: aa14c3000000000000020104032319233000000090
DEBUG:msmart.lan:Sending packet to 192.168.3.101:6444: 5a5a0111580020000000000033000c1412031814de630300008c000000000000000000000000000005baaa619da74e7759da66fe138774e150aa7c2062d1d2a3a3ba9417d36231bdf87b2c4d593c1f892102ae3fbdcace62
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370007e20664122135343d215cbc0fdb49997df7599a13f537dbe901495e9db01ed2df2cee1c0fc7bff0618d7d8319137c0861fb78ad152fae6e7aa2f625a21831bbf546b8a39d6b926630e9343d4ab1eee1c2001a6c02dad2525a8c307bfd68d372aed770aa605f57542541463ebbe7ee21762fd4ecfa116670b9c2c07fed624b8ecf23141
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370008e206347324a3f4dc9441591164bb6289c0618a83910c6e57fe02194fc296d5d0701f4fdcbad15707f3a2a7d0b88112c94feaf00a8eecd8a30634fb83a98f9d1f2a7e389d91712a2217fec66847681d1023417992ae6abbf15fb421e900970d09b773c4c25ad69e34e2af23795784f47ab8f36ea8c634d399775515bfb977225c8270343d00d499d1a294dcaa6561b4eb7ddac
DEBUG:msmart.lan:Received packet from 192.168.3.101:6444: 5a5a0111680020800000000060220b1412031814de630300008c00000000000000000180000000000929594369b6b683aa0ad95e7274d9810826db6ca6e2e6a198558d96b69e8a6b4d7b7850dcbe71aa3694c89325b524e279d31b5005c11a32f8d7d0068bdf131e
DEBUG:msmart.lan:Received response from 192.168.3.101:6444: aa23c300000000000002010417a003032319233037191905371919053c223c1437008086
DEBUG:msmart.base_device:Response from 192.168.3.101:6444 in 0.130000 seconds.
DEBUG:msmart.device.C3.device:Ignored unknown response from 192.168.3.101:6444: 010417a003032319233037191905371919053c223c14370080
{'ip': '192.168.3.101', 'port': 6444, 'id': 153931628110814, 'online': True, 'supported': True, 'type': <DeviceType.HEAT_PUMP: 195>, 'name': None, 'sn': None, 'key': '2d4cbef18462421ea9de63cd24d0b8f4794d6179710c42e0b7ac4601d7dea0ca', 'token': '501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c', 'mode': <RunMode.HEAT: 3>, 'zone1_power': False, 'zone1_target_temperature': 35, 'zone2_power': None, 'zone2_target_temperature': None, 'dhw_power': True, 'dhw_target_temperature': 35, 'water_temperature': 55, 'outdoor_temperature': None, 'electric_power': None, 'thermal_power': None, 'voltage': None}

And it worked to take it back to the original:

{'ip': '192.168.3.101', 'port': 6444, 'id': 153931628110814, 'online': True, 'supported': True, 'type': <DeviceType.HEAT_PUMP: 195>, 'name': None, 'sn': None, 'key': '2d4cbef18462421ea9de63cd24d0b8f4794d6179710c42e0b7ac4601d7dea0ca', 'token': '501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c', 'mode': <RunMode.HEAT: 3>, 'zone1_power': True, 'zone1_target_temperature': 36, 'zone2_power': None, 'zone2_target_temperature': None, 'dhw_power': True, 'dhw_target_temperature': 50, 'water_temperature': 55, 'outdoor_temperature': None, 'electric_power': None, 'thermal_power': None, 'voltage': None}

@mill1000
Copy link
Owner

No worries. Thanks for running the test again.

@mill1000
Copy link
Owner

Pushed a few minor tweaks to expose some additional device properties. I think it should cover the majority of basic device controls.

You should be able to setup a basic script to poll the device occasionally and get some of the temperature and power numbers you're looking for.

@radumpopescu
Copy link

I think there are some errors.

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.3.101:6444.
DEBUG:msmart.lan:Connected to 192.168.3.101:6444.
INFO:msmart.lan:Authenticating with 192.168.3.101:6444.
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370004020000000501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370004020011e42c0e54432f2199439322965cfd06ff02eba9e8f40490bdc9ce8c2afd75f97bace4f43d0d6449ab65dc487a00e55034bb20909ed1d2032bf95ef15c7eceb08c4ec
INFO:msmart.lan:Authentication successful. Expiration: 2024-03-19T10:58:47, Local key: 8244d8d099412c089fa40adfcbbf55e503ce8f6a67c52ef2ebd32b123d844cd9
DEBUG:msmart.base_device:Sending command to 192.168.3.101:6444: aa0bc300000000000003012e
DEBUG:msmart.lan:Sending packet to 192.168.3.101:6444: 5a5a0111480020000000000050303a1612031814de630300008c0000000000000000000000000000e0d87d4bf4e5735ba7745fc35ec456a0f877c349ed74b644b051e976e140dab6
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370006e20666875c9a930184eebfbf52f488ca59e7465780b659b5032a026ef1c58a7d8c33f02d294006f0ac960a1cc0b4453c01bf83a496c082e150c27643cf91fa2dbfcbbd9dbe6f3953ab16452f56f11643b0b0776670c5ea8894d95ee0a609fa40f955eb5a9024d98ccf444e5aab6cf8849f353
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370008e20631aec7fa609ff67fb4de3b116bde8650a555f558207ff26a4c680a219803e7b78a57aa778a4e86d23e2852bd17348c6192c812b7ad3452e225bc21ac49386c5920cf19a5c9d78b79db90b4882e6c3fbbeec23d41a4c6863c2cac13f6aa2bd01f4d0540d558d8329509a67ead569d5fc7d0b0c28e622913b10f2b9c4585ce9f0dc25928efa3255a1d48fa2678f4b6ddd4c
DEBUG:msmart.lan:Received packet from 192.168.3.101:6444: 5a5a011168002080000000004e9c3a1612031814de630300008c0000000000000000018000000000ed6e1c5a837f15dfcdf5871f66bb6df94adba306339e3bd24fce4bfa24efb2daa712f0d0adde3816dfda1e25945022a2471080c13b866849aa7a147860505220
DEBUG:msmart.lan:Received response from 192.168.3.101:6444: aa23c300000000000003010517a003032319313037191905371919053c223c143200807b
DEBUG:msmart.base_device:Response from 192.168.3.101:6444 in 0.080000 seconds.
DEBUG:msmart.device.C3.command:Query basic response payload: 010517a003032319313037191905371919053c223c14320080
Traceback (most recent call last):
  File "/srv/midea/m.py", line 40, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/srv/midea/m.py", line 26, in main
    print(device)
  File "/srv/midea/./midea-msmart/msmart/base_device.py", line 139, in __str__
    return str(self.to_dict())
               ^^^^^^^^^^^^^^
  File "/srv/midea/./midea-msmart/msmart/device/C3/device.py", line 371, in to_dict
    "dhw_fast_mode": self.dhw_fast_mode,
                     ^^^^^^^^^^^^^^^^^^
AttributeError: 'HeatPump' object has no attribute 'dhw_fast_mode'

I fixed it by commenting device.py:371

            # "dhw_fast_mode": self.dhw_fast_mode,

And then I got the following error:

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.3.101:6444.
DEBUG:msmart.lan:Connected to 192.168.3.101:6444.
INFO:msmart.lan:Authenticating with 192.168.3.101:6444.
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370004020000000501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370004020011e42a622977fc0ea5aa52f08a778aacbd3f6d70c7425ded509f95e46f99eada157577d2dea215282ddab7bc598abed6f1e78ca6270c0b3d50f217f94665d8bd37837
INFO:msmart.lan:Authentication successful. Expiration: 2024-03-19T11:00:02, Local key: 685d6c9232f5977e193035aeedbd6d96b39c351a875c9783c0621362bed0f5a9
DEBUG:msmart.base_device:Sending command to 192.168.3.101:6444: aa0bc300000000000003012e
DEBUG:msmart.lan:Sending packet to 192.168.3.101:6444: 5a5a011148002000000000002303001712031814de630300008c0000000000000000000000000000e0d87d4bf4e5735ba7745fc35ec456a022a9bed63550b3f4e42b5e4c23d08df8
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370006e20663eb73c4eb5f71310f003a228818a145b2e315a189929a8de7a587eb74af9e3ca6eff4c5e86adee8a43ba52bbef5cff369f176136b1678400650d62a05a740a8c63d885b11e45a8ac0921c43a54903272ef5814289c3b5525a8ac1eb9927283eb0eec2cf0dbf0c81fb5c5a994cc6102d5
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370008e20632d3ab6d076fdbcd0e7ffff5a665467e2d4565f8d5bea1fe050cbf84587db38894ed0672df8ec6166fec78ae9a682d4953eb432b247d1ded8a216a1b2d6e735ab4fe5bd676c139cdb85fc3db29642b9e2efaa5463fadabd69eb35ddded4fc1ad332942bb1c8cd3d764421ad3591e59212d8f861c573650582724161d77096f8aabd30f62470b40403c397bcc8fe23a7ca
DEBUG:msmart.lan:Received packet from 192.168.3.101:6444: 5a5a011168002080000000003041001712031814de630300008c0000000000000000018000000000ed6e1c5a837f15dfcdf5871f66bb6df94adba306339e3bd24fce4bfa24efb2daa712f0d0adde3816dfda1e25945022a25119d1cbb6302f70eb5b5511f64858e5
DEBUG:msmart.lan:Received response from 192.168.3.101:6444: aa23c300000000000003010517a003032319313037191905371919053c223c143200807b
DEBUG:msmart.base_device:Response from 192.168.3.101:6444 in 0.080000 seconds.
DEBUG:msmart.device.C3.command:Query basic response payload: 010517a003032319313037191905371919053c223c14320080
Traceback (most recent call last):
  File "/srv/midea/m.py", line 40, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/srv/midea/m.py", line 26, in main
    print(device)
  File "/srv/midea/./midea-msmart/msmart/base_device.py", line 139, in __str__
    return str(self.to_dict())
               ^^^^^^^^^^^^^^
  File "/srv/midea/./midea-msmart/msmart/device/C3/device.py", line 372, in to_dict
    "tbh_power": self.tbh_power_state,
                 ^^^^^^^^^^^^^^^^^^^^
  File "/srv/midea/./midea-msmart/msmart/device/C3/device.py", line 284, in tbh_power_state
    return self._tbh_power_state
           ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'HeatPump' object has no attribute '_tbh_power_state'. Did you mean: 'tbh_power_state'?

Which I fixed by adding.a return 0 to the tbh_power_state

    def tbh_power_state(self) -> int:
        """Power state of internal backup heater."""
        return 0
        # return self._tbh_power_state

@mill1000
Copy link
Owner

Whoops! That's what I get for not testing properly...

@radumpopescu
Copy link

radumpopescu commented Mar 18, 2024

And the response was exactly the same as before when running the refresh command, only that extra tbh_powerwhich was 0...

await device.refresh()
    print(device)

However, what I meant by more information is I think the info part of QUERY_INSTALL

elseif ((_msgType==cmdTable["MSG_TYPE_QUERY"])   and (_msgBodyType==cmdTable["MSG_TYPE_QUERY_INSTALL"])) then
        -- 安装设定参数0x08查询
        binToModel(streams, "dhwEnable", _bodyBytes[1],BIT7)
        binToModel(streams, "boostertbhEn", _bodyBytes[1],BIT6)
        binToModel(streams, "disinfectEnable", _bodyBytes[1],BIT5)
        binToModel(streams, "dhwPumpEnable", _bodyBytes[1],BIT4)
        binToModel(streams, "dhwPriorityTime", _bodyBytes[1],BIT3)
        binToModel(streams, "dhwPumpDIEnable", _bodyBytes[1],BIT2)
        binToModel(streams, "coolEnable", _bodyBytes[1],BIT1)
        binToModel(streams, "fgZone1CoolTempHigh", _bodyBytes[1],BIT0)
        binToModel(streams, "heatEnable", _bodyBytes[2],BIT7)
        binToModel(streams, "fgZone1HeatTempHigh", _bodyBytes[2],BIT6)
        binToModel(streams, "pumpiSliModeEn", _bodyBytes[2],BIT5)
        binToModel(streams, "roomSensorEn", _bodyBytes[2],BIT4)
        binToModel(streams, "roomTherEn", _bodyBytes[2],BIT3)
        binToModel(streams, "roomTherSetModeEn", _bodyBytes[2],BIT2)
        binToModel(streams, "dualroomThermostatEn", _bodyBytes[2],BIT1)
        binToModel(streams, "fgdhwPriorEn", _bodyBytes[2],BIT0)
        binToModel(streams, "acsEnable", _bodyBytes[3],BIT7)
        binToModel(streams, "dhwHeaterAhsEn", _bodyBytes[3],BIT6)
        binToModel(streams, "tempPcbEn", _bodyBytes[3],BIT5)
        binToModel(streams, "tbt2ProbeEn", _bodyBytes[3],BIT4)
        binToModel(streams, "pipeExceed10m", _bodyBytes[3],BIT3)
        binToModel(streams, "solarCn18En", _bodyBytes[3],BIT2)
        binToModel(streams, "fgOwnSolarEn", _bodyBytes[3],BIT1)
        binToModel(streams, "fgInputDhwHeater", _bodyBytes[3],BIT0)
        binToModel(streams, "smartgridEn", _bodyBytes[4],BIT7)
        binToModel(streams, "t1bProbeEn", _bodyBytes[4],BIT6)
        binToModel(streams, "fgZone2CoolTempHigh", _bodyBytes[4],BIT5)
        binToModel(streams, "fgZone2HeatTempHigh", _bodyBytes[4],BIT4)
        binToModel(streams, "doubleZoneEn", _bodyBytes[4],BIT3)
        binToModel(streams, "fgTaProbeIdu", _bodyBytes[4],BIT2)
        binToModel(streams, "tbt1ProbeEn", _bodyBytes[4],BIT1)
        binToModel(streams, "fgIbhInTank", _bodyBytes[4],BIT0)
		binToModel(streams, "dT5On", _bodyBytes[6], nil)
        binToModel(streams, "dT5On", _bodyBytes[6], nil)
        binToModel(streams, "dT1S5", _bodyBytes[8], nil)
        binToModel(streams, "tIntervaDhw", _bodyBytes[10], nil)
        binToModel(streams, "t4Dhwmax", _bodyBytes[12], nil)
        binToModel(streams, "t4Dhwmin", _bodyBytes[13]* 256+_bodyBytes[14], nil)
        binToModel(streams, "tTBHdelay", _bodyBytes[15]* 256+_bodyBytes[16], nil)
        binToModel(streams, "dT5STBHoff", _bodyBytes[17]* 256+_bodyBytes[18], nil)
        binToModel(streams, "t4TBHon", _bodyBytes[19]* 256+_bodyBytes[20], nil)
        binToModel(streams, "t5sDI", _bodyBytes[21]* 256+_bodyBytes[22], nil)
        binToModel(streams, "tDImax", _bodyBytes[23]* 256+_bodyBytes[24], nil)
        binToModel(streams, "tDIhightemp", _bodyBytes[25]* 256+_bodyBytes[26], nil)
        binToModel(streams, "tIntervalC", _bodyBytes[27]* 256+_bodyBytes[28], nil)
        binToModel(streams, "dT1SC", _bodyBytes[29]* 256+_bodyBytes[30], nil)
        binToModel(streams, "dTSC", _bodyBytes[31]* 256+_bodyBytes[32], nil)
        binToModel(streams, "t4Cmax", _bodyBytes[33]* 256+_bodyBytes[34], nil)
        binToModel(streams, "t4Cmin", _bodyBytes[35]* 256+_bodyBytes[36], nil)
        binToModel(streams, "tIntervalH", _bodyBytes[37]* 256+_bodyBytes[38], nil)
        binToModel(streams, "dT1SH", _bodyBytes[39]* 256+_bodyBytes[40], nil)
        binToModel(streams, "dTSH", _bodyBytes[41]* 256+_bodyBytes[42], nil)
        binToModel(streams, "t4Hmax", _bodyBytes[43]* 256+_bodyBytes[44], nil)
        binToModel(streams, "t4Hmin", _bodyBytes[45]* 256+_bodyBytes[46], nil)
        binToModel(streams, "t4IBHon", _bodyBytes[47]* 256+_bodyBytes[48], nil)
        binToModel(streams, "dT1IBHon", _bodyBytes[49]* 256+_bodyBytes[50], nil)
        binToModel(streams, "tIBHdelay", _bodyBytes[51]* 256+_bodyBytes[52], nil)
        binToModel(streams, "tIBH12delay", _bodyBytes[53]* 256+_bodyBytes[54], nil)
        binToModel(streams, "t4AHSon", _bodyBytes[55]* 256+_bodyBytes[56], nil)
        binToModel(streams, "dT1AHSon", _bodyBytes[57]* 256+_bodyBytes[58], nil)
        binToModel(streams, "dT1AHSoff", _bodyBytes[59]* 256+_bodyBytes[60], nil)
        binToModel(streams, "tAHSdelay", _bodyBytes[61]* 256+_bodyBytes[62], nil)
        binToModel(streams, "tDHWHPmax", _bodyBytes[63]* 256+_bodyBytes[64], nil)
        binToModel(streams, "tDHWHPrestrict", _bodyBytes[65]* 256+_bodyBytes[66], nil)
        binToModel(streams, "t4autocmin", _bodyBytes[67]* 256+_bodyBytes[68], nil)
        binToModel(streams, "t4autohmax", _bodyBytes[69]* 256+_bodyBytes[70], nil)
        binToModel(streams, "t1sHolHeat", _bodyBytes[71]* 256+_bodyBytes[72], nil)
        binToModel(streams, "t5SHolDhw", _bodyBytes[73]* 256+_bodyBytes[74], nil)
        binToModel(streams, "perStart", _bodyBytes[75]* 256+_bodyBytes[76], nil)
        binToModel(streams, "timeAdjust", _bodyBytes[77]* 256+_bodyBytes[78], nil)
        binToModel(streams, "dTbt2", _bodyBytes[79]* 256+_bodyBytes[80], nil)
        binToModel(streams, "powerIbh1", (_bodyBytes[81]* 256+_bodyBytes[82])/10, nil)
        binToModel(streams, "powerIbh2", (_bodyBytes[83]* 256+_bodyBytes[84])/10, nil)
        binToModel(streams, "powerTbh", (_bodyBytes[85]* 256+_bodyBytes[86])/10, nil)
        binToModel(streams, "ecoHeatT1s", _bodyBytes[87]* 256+_bodyBytes[88], nil)
        binToModel(streams, "ecoHeatTs", _bodyBytes[89]* 256+_bodyBytes[90], nil)
        binToModel(streams, "tDryup", _bodyBytes[91]* 256+_bodyBytes[92], nil)
        binToModel(streams, "tDrypeak", _bodyBytes[93]* 256+_bodyBytes[94], nil)
        binToModel(streams, "tdrydown", _bodyBytes[95]* 256+_bodyBytes[96], nil)
        binToModel(streams, "tempDrypeak", _bodyBytes[97]* 256+_bodyBytes[98], nil)
        binToModel(streams, "timePreheatFloor", _bodyBytes[99]* 256+_bodyBytes[100], nil)
        binToModel(streams, "t1SPreheatFloor", _bodyBytes[101]* 256+_bodyBytes[102], nil)
        --103~112为空
        binToModel(streams, "t1SetC1", _bodyBytes[113]* 256+_bodyBytes[114], nil)
        binToModel(streams, "t1SetC2", _bodyBytes[115]* 256+_bodyBytes[116], nil)
        binToModel(streams, "t4C1", _bodyBytes[117]* 256+_bodyBytes[118], nil)
        binToModel(streams, "t4C2", _bodyBytes[119]* 256+_bodyBytes[120], nil)
        binToModel(streams, "t1SetH1", _bodyBytes[121]* 256+_bodyBytes[122], nil)
        binToModel(streams, "t1SetH2", _bodyBytes[123]* 256+_bodyBytes[124], nil)
        binToModel(streams, "t4H1", _bodyBytes[125]* 256+_bodyBytes[126], nil)
        binToModel(streams, "t4H2", _bodyBytes[127]* 256+_bodyBytes[128], nil)
        binToModel(streams, "typeVolLmt", _bodyBytes[129]* 256+_bodyBytes[130], nil)
        binToModel(streams, "timeT4FreshC", _bodyBytes[131]/2, nil)
        binToModel(streams, "timeT4FreshH", _bodyBytes[132]/2, nil)
        binToModel(streams, "tPumpiDelay", (_bodyBytes[133]* 256+_bodyBytes[134])/2, nil)
        binToModel(streams, "deltaTsloar", _bodyBytes[135], nil)
        binToModel(streams, "solarFunction", _bodyBytes[136], nil)
        binToModel(streams, "enSwitchPDC", _bodyBytes[138],BIT0)
        binToModel(streams, "gasCost", (_bodyBytes[139]* 256+_bodyBytes[140])/100, nil)
        binToModel(streams, "eleCost", (_bodyBytes[141]* 256+_bodyBytes[142])/100, nil)
        binToModel(streams, "ahsSetTempMax", _bodyBytes[143], nil)
        binToModel(streams, "ahsSetTempMin", _bodyBytes[144], nil)
        binToModel(streams, "ahsSetTempMaxVolt", _bodyBytes[145], nil)
        binToModel(streams, "ahsSetTempMinVolt", _bodyBytes[146], nil)
        binToModel(streams, "t2AntiSVRun", _bodyBytes[147]* 256+_bodyBytes[148], nil)
        binToModel(streams, "dftPortFuncEn", _bodyBytes[150],BIT0)
		--_bodyBytes[150]~_bodyBytes[180]预留
		binToModel(streams, "t1AntiPump", _bodyBytes[181]* 256+_bodyBytes[182], nil)
		binToModel(streams, "t2AntiPumpRun", _bodyBytes[183]* 256+_bodyBytes[184], nil)
		binToModel(streams, "t1AntiLockSV", _bodyBytes[185]* 256+_bodyBytes[186], nil)
		binToModel(streams, "tbhEnFunc", _bodyBytes[187]* 256+_bodyBytes[188], nil)
		binToModel(streams, "ibhEnFunc", _bodyBytes[189]* 256+_bodyBytes[190], nil)
		--binToModel(streams, "", _bodyBytes[191]* 256+_bodyBytes[192], nil)
		binToModel(streams, "ahsEnFunc", _bodyBytes[193]* 256+_bodyBytes[194], nil)
		binToModel(streams, "ahsPumpiControl", _bodyBytes[195]* 256+_bodyBytes[196], nil)
		binToModel(streams, "modeSetPri", _bodyBytes[197]* 256+_bodyBytes[198], nil)
		binToModel(streams, "pumpType", _bodyBytes[199]* 256+_bodyBytes[200], nil)
		binToModel(streams, "pumpiSilentOutput", _bodyBytes[201]* 256+_bodyBytes[202], nil)

I will try to make a video of the installation menu on the heatpump. But basically in there there's temperatures for water in, water out, Heat exchanger in, Heat Exchanger Out, Compressor In, Compressor Out, Compressor frequency (which according to the installer is something like a percentage power that the compressor is running at), water flow and much more...

I did try to replace the QUERY_BASIC command that gets sent to get the basic information with the QUERY_INSTALL however it then doesn't respond anymore

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.3.101:6444.
DEBUG:msmart.lan:Connected to 192.168.3.101:6444.
INFO:msmart.lan:Authenticating with 192.168.3.101:6444.
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370004020000000501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c
DEBUG:msmart.lan:Received data from 192.168.3.101:6444: 8370004020011e4210b7b334e26badbf5a2c9a9066b224e7f1c9679d07276bb9b9ab5def061e5043a24e52c8c2757b3db1125dd5f4bd744ef0102765cbf7363cad5472e4800507d1
INFO:msmart.lan:Authentication successful. Expiration: 2024-03-19T11:11:57, Local key: 478cf55bd96d8a9cbb4a234e2de3f9735773a4fed2a1876507478184a13c674e
DEBUG:msmart.base_device:Sending command to 192.168.3.101:6444: aa0bc3000000000000030827
DEBUG:msmart.lan:Sending packet to 192.168.3.101:6444: 5a5a01114800200000000000623a0b1712031814de630300008c0000000000000000000000000000b1ef3839d0c05576221da79daddc959a8207da6fdae050f66f6c60bcc474cc8b
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370006e2066f84be2c8f5df67b8bcf378ce9a22588ff90ab5c3d9df3c4c5f4e485abcc563888c2136bf243f0c91fca875e1947c789c05e07192038ccd3f7fad2156488d096f7e9abba689a805dc2aa2cc9732bee498b7edc3b6c0f9249c54001852261281e322852ffbd90cf47093ec17f179599f1e
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.3.101:6444: 5a5a01114800200000000000623a0b1712031814de630300008c0000000000000000000000000000b1ef3839d0c05576221da79daddc959a8207da6fdae050f66f6c60bcc474cc8b
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370006e20661af81b4277b94e1d8d6ad9f0d364417348ab752b2edc32181af1e0d87c5b0656d671b13bf8b86c8e0ff0c0be309a19d2a84e16df85dd68974df94b7b8c66395b1e49829df9161f8992536f534af5358b86f206d53213cc8706ec45b40ce3541b9ba3187a66cf8b018a290640e2fd7b00
DEBUG:msmart.lan:Request timeout. Resending.
DEBUG:msmart.lan:Sending packet to 192.168.3.101:6444: 5a5a01114800200000000000623a0b1712031814de630300008c0000000000000000000000000000b1ef3839d0c05576221da79daddc959a8207da6fdae050f66f6c60bcc474cc8b
DEBUG:msmart.lan:Sending data to 192.168.3.101:6444: 8370006e20665981827e73f0af172e631cebf20f22ada23697a5cbfe9a950833b8fb1530fb06338ca3d6f2471eaea89f68495dd5c2b0a5f3c9efc79ac88baae98e0cefcd58735f388a7bd2df33220e5a00fb9feda6926430418a07abbe1f3bc51757e269452186a05627ffcbcd552dd03f5146262c0e
DEBUG:msmart.lan:Disconnecting from 192.168.3.101:6444.
WARNING:msmart.base_device:Network timeout 192.168.3.101:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.3.101:6444 in 6.010000 seconds.
{'ip': '192.168.3.101', 'port': 6444, 'id': 153931628110814, 'online': False, 'supported': False, 'type': <DeviceType.HEAT_PUMP: 195>, 'name': None, 'sn': None, 'key': '2d4cbef18462421ea9de63cd24d0b8f4794d6179710c42e0b7ac4601d7dea0ca', 'token': '501414b51bbdbd1a4226a50675af1c283419e2d252b716a90b79b31e26b7500fcbddb9a6beed25189d9eea35d5ef7e623b77dfd334423d9bbbbf3a3ab87b199c', 'mode': <RunMode.AUTO: 1>, 'zone1_power': False, 'zone1_target_temperature': 25, 'zone2_power': None, 'zone2_target_temperature': None, 'dhw_power': False, 'dhw_target_temperature': 25, 'tbh_power': 0, 'water_temperature': None, 'outdoor_temperature': None, 'electric_power': None, 'thermal_power': None, 'voltage': None}

Not sure if that's how it's supposed to work, but what was interesting was that if I replaced QUERY_BASIC (0x1) with anything from 0x2 to 0x7 it didn't timeout, only 0x8 (QUERY_INSTALL) failed. I guess it has something to do with the toBytes function. Anyway, I'm going a bit blind on this :) Don't really understand how things work...

@mill1000
Copy link
Owner

However, what I meant by more information is I think the info part of QUERY_INSTALL

I will try to make a video of the installation menu on the heatpump. But basically in there there's temperatures for water in, water out, Heat exchanger in, Heat Exchanger Out, Compressor In, Compressor Out, Compressor frequency (which according to the installer is something like a percentage power that the compressor is running at), water flow and much more...

I may be wrong, but I interpreted the QUERY_INSTALL message to contain configuration/installation settings and not any actual sensor data. I think the QUERY_UNITPARA would really have the information you'd want, but alas previous testing showed the device did not respond to the request.

I did try to replace the QUERY_BASIC command that gets sent to get the basic information with the QUERY_INSTALL however it then doesn't respond anymore

Not sure if that's how it's supposed to work, but what was interesting was that if I replaced QUERY_BASIC (0x1) with anything from 0x2 to 0x7 it didn't timeout, only 0x8 (QUERY_INSTALL) failed. I guess it has something to do with the toBytes function. Anyway, I'm going a bit blind on this :) Don't really understand how things work...

This is more or less what happened on nixmeer's device. No response to anything beyond query 0x7. (#107 (comment)). I don't think anything is wrong with the query, I think the device just ignores it. Perhaps there's a special "install" mode that enables the functionality.

@AndreasTUHU
Copy link

AndreasTUHU commented Aug 26, 2024

This is more or less what happened on nixmeer's device. No response to anything beyond query 0x7. (#107 (comment)). I don't think anything is wrong with the query, I think the device just ignores it. Perhaps there's a special "install" mode that enables the functionality.

Another C3 owner here :) I'm not a programmer, just want to use more temperature values with Home Assistant without Midea cloud.
But the reason why I write: some setting in the WiFi controller protected by password, in the 'For serviceman' menu. (default password: 234)
Maybe the QUERY_INSTALL waits for this password?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants