midea-msmart icon indicating copy to clipboard operation
midea-msmart copied to clipboard

Add support for humidity set point and power usage

Open mill1000 opened this issue 1 year ago • 2 comments
trafficstars

Add support for requesting indoor humidity, and power usage if devices claim support. Add support for setting target humidity.

Close #12 and close #105 and provide necessary support for https://github.com/mill1000/midea-ac-py/issues/5 and https://github.com/mill1000/midea-ac-py/issues/86

mill1000 avatar Mar 15 '24 02:03 mill1000

I lack access to devices that support these features. If there are an volunteers willing to test I can get this feature implemented.

mill1000 avatar May 01 '24 21:05 mill1000

Hello, one of my air conditioners supports it :) I'm happy to test it.

v1k70rk4 avatar May 02 '24 13:05 v1k70rk4

Hi. Thanks for your interest. I've just updated this PR against the latest released version.

To test, you need to install this branch via pip OR clone the repo and checkout the branch in a local copy.

Then try running this example, and post the logs.

import asyncio
import logging

from msmart.device import AirConditioner as AC
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():

    # Manually construct the device
    #  - See midea-discover to read ID, token and key
    device = AC(ip=DEVICE_IP, port=6444, device_id=int(DEVICE_ID))
    if DEVICE_TOKEN and DEVICE_KEY:
        await device.authenticate(DEVICE_TOKEN, DEVICE_KEY)

    # Get device capabilities
    await device.get_capabilities()

    while True:
        # Refresh the state
        await device.refresh()

        print({
            'id': device.id,
            'ip': device.ip,
            "online": device.online,
            "supported": device.supported,
            'power_state': device.power_state,
            'indoor_humidity': device.indoor_humidity,
            'power_usage': device.power_usage
        })

        await asyncio.sleep(1)

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

mill1000 avatar Jun 19 '24 20:06 mill1000

These are the logs I got: ac.log

They show there's no power usage reporting. However, I used to use another integration with the same AC, which reports:

Energy Consumption: 0 Realtime Power: 0 Total Energy Consumption: This value seems to correctly match power usage. It increases even when the integration is off so it must be pulled from somewhere.

At this point I'm confused whether my AC properly supports power usage reporting or these are common API woes.

Eskander avatar Jun 20 '24 12:06 Eskander

Thanks. It wouldn't be the first time a device incorrectly reported it's capabilities.

Can you try override the support flag?

Change this line

# Get device capabilities
await device.get_capabilities()

to

# Get device capabilities
await device.get_capabilities()

# Force power support
device._supports_power_usage = True

mill1000 avatar Jun 20 '24 20:06 mill1000

Here you go: ac.log

Eskander avatar Jun 20 '24 22:06 Eskander

Thanks! Looks like there is some power data in the response but I'm parsing the wrong field.

Here's 2 possible interpretations of total power usage. Does one seem correct to you?

  • 679.2
  • 42422.4

mill1000 avatar Jun 21 '24 16:06 mill1000

Yes, the first value ~700 kWh is the correct one

Eskander avatar Jun 21 '24 19:06 Eskander

Cool thanks for the input.

mill1000 avatar Jun 22 '24 16:06 mill1000

Here's mine: ac.log. I'm not sure if my AC does support reporting power usage

leandropineda avatar Jun 26 '24 10:06 leandropineda

Here's mine: ac.log. I'm not sure if my AC does support reporting power usage

Thanks. Your device is responding with power/energy information. I should double check my handling of the power capability because it seems neither of your devices claim support yet clearly respond to the request.

Here's how I decoded your power numbers. Do they make sense to you?

Total Energy: 5650.02 kWh?

Current Run Energy: 1514.0 kWh?

Real Time Power: 0

mill1000 avatar Jun 26 '24 20:06 mill1000

Would either of you mind adding the following to your example script and providing logs?

device._supports_humidity = True

mill1000 avatar Jun 26 '24 20:06 mill1000

Pulling latest changes from this branch resulted in:

Traceback (most recent call last):
  File "./midea-msmart/example.py", line 48, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "./midea-msmart/example.py", line 33, in main
    await device.refresh()
  File "./midea-msmart/example.py", line 364, in refresh
    self._update_state(response)
  File "./midea-msmart/example.py", line 182, in _update_state
    self._power_usage = res.power_bcd if self._power_usage_bcd else res.power
                                                                    ^^^^^^^^^
AttributeError: 'PowerUsageResponse' object has no attribute 'power'

I removed device._supports_power_usage = True for now and got the following with humidity enabled: ac.log

Eskander avatar Jun 26 '24 22:06 Eskander

Oops! Forgot to update the device class. Just fixed that.

Thanks for the log.

mill1000 avatar Jun 26 '24 22:06 mill1000

Cool. It looks like the devices respond to both message types even if they don't necessarily have data for it.

mill1000 avatar Jun 26 '24 22:06 mill1000

Here's mine: ac.log. I'm not sure if my AC does support reporting power usage

Thanks. Your device is responding with power/energy information. I should double check my handling of the power capability because it seems neither of your devices claim support yet clearly respond to the request.

Here's how I decoded your power numbers. Do they make sense to you?

Total Energy: 5650.02 kWh?

Current Run Energy: 1514.0 kWh?

Real Time Power: 0

I think they don't. Power usage is about 1kW, so the current run energy value doesn't look right.

leandropineda avatar Jul 01 '24 22:07 leandropineda

Ran the sample code with the very latest changes 368580c and I got

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.100.92:6444.
DEBUG:msmart.lan:Connected to 192.168.100.92:6444.
INFO:msmart.lan:Authenticating with 192.168.100.92:6444.
DEBUG:msmart.lan:Sending data to 192.168.100.92:6444: 83700040200000005bfcdf733c8926d892af2524c0976ec796f1abc5bfa3d8de22f7ce9707675470022b2630b1507462899978fd62e082b52670af50e29498eabc382073baa6642a
DEBUG:msmart.lan:Received data from 192.168.100.92:6444: 837000402001fb4a9803279b7c5e8875cb653d7fcf2ce6daca68d74f01e66ea24083f9612cc48ce6b463e8a3084df8f96fc8a9ca5264b41b11ea3a9ae457c9facf2dce5ad7178359
INFO:msmart.lan:Authentication successful. Expiration: 2024-07-02T10:32:33, Local key: xxxxxxxxxxxx
DEBUG:msmart.base_device:Sending command to 192.168.100.92:6444: aa0fac00000000000003b5010001e5a6
DEBUG:msmart.lan:Sending packet to 192.168.100.92:6444: 5a5a011158002000000000005722201601071814633d0200008a00000000000000000000000000000542065231b95b9123b7f675b1de90ae915c618b02ed2747fad73f2ffa0db1d344396f6a0ca45e3da9afb49179be6743
DEBUG:msmart.lan:Sending data to 192.168.100.92:6444: 8370007e2066fb5f4df6a0b869bc2912d0e7e7cf8d8e22129c18d8c740024e8437ea9cea1f70868239a67412c8a8dff17c485a234ab8018741684b83fbbd00357b5302e0f1d5a28a63b0fc153e98cd0f48ae0b688f3fe88df81778a7b96ed9eb5451c9b1a5e148527f10473690babdf7879ed32ad61061a86b9f5c4a5a2bcbd10255f49b9c46
DEBUG:msmart.lan:Received data from 192.168.100.92:6444: 8370009e20634731d7d0066a58cce57412fe74b87a501e84b317c076a3b8a1722bbadaf1d2dd5e71aee576c766b23b3744fc17f3c9c5302b9b53b67e3bfb3e5ffd2b737b16907e4356e2ed0b23929817206394bc8df43cf570daa88a5e742d8968381bba57c72ffa95ef0c08ea8b078bdb7df2c947ba9224642c3ffb803216b03d5932b43873a5cf23b52aace67d21f7e53d203eb669729aec81ce71be4493589bbb9b181c00
DEBUG:msmart.lan:Received packet from 192.168.100.92:6444: 5a5a011178002080000000004e23201601071814633d0200008a0000000000000000018000000000fd47f621f527a589be7379aa153dddebc3d5eb236c52bd02910eae00249ae9df07d4648d15d6e2f7a83b4fd3b703039487d37e7f08b1522d06eaf22ad82416e10f805d7b8048238d25210e0c752f97f8
DEBUG:msmart.lan:Received response from 192.168.100.92:6444: aa3dac00000000000203b50a12020101180001001402010115020101160201001a020101100201011f020100250207203c203c203c00400001000100c83a
DEBUG:msmart.base_device:Response from 192.168.100.92:6444 in 0.140000 seconds.
DEBUG:msmart.device.AC.command:Capabilities response payload: b50a12020101180001001402010115020101160201001a020101100201011f020100250207203c203c203c00400001000100
WARNING:msmart.device.AC.command:Unknown capability. ID: 0x0040, Size: 1.
DEBUG:msmart.device.AC.command:Raw capabilities: {'eco_mode': True, 'eco_mode_2': False, 'silky_cool': False, 'heat_mode': True, 'cool_mode': True, 'dry_mode': True, 'auto_mode': True, 'swing_horizontal': True, 'swing_vertical': True, 'energy_stats': False, 'energy_setting': False, 'energy_bcd': False, 'turbo_heat': True, 'turbo_cool': True, 'fan_silent': False, 'fan_low': False, 'fan_medium': False, 'fan_high': False, 'fan_auto': False, 'fan_custom': True, 'humidity_auto_set': False, 'humidity_manual_set': False, 'cool_min_temperature': 16.0, 'cool_max_temperature': 30.0, 'auto_min_temperature': 16.0, 'auto_max_temperature': 30.0, 'heat_min_temperature': 16.0, 'heat_max_temperature': 30.0, 'decimals': False}
DEBUG:msmart.base_device:Sending command to 192.168.100.92:6444: aa10ac00000000000003b501010102c1c6
DEBUG:msmart.lan:Sending packet to 192.168.100.92:6444: 5a5a011158002000000000000223201601071814633d0200008a00000000000000000000000000004704d4f6cb7e757d97bb0fb355e696691c6cb0cecabc7672cd44e0d17faa5708ad5a3db551c01a7fbdd07b73d6a492cf
DEBUG:msmart.lan:Sending data to 192.168.100.92:6444: 8370007e2066228a476c8a74944e8455bb008488c53d66dfec6176953cd2d7389fc5b656a6a76d1b9d1cde9a7e2d69108621e999b4307028832634cf5da3e571abd455ed2dbf2ce2eaa003dd374dda52eb2c34c200a741e7e60828e3b0675e6213c94c1ec31d8a8a4a87fc24a432d716bfc07d4d6487d7ccb304d9024998cb072699f2d56150
DEBUG:msmart.lan:Received data from 192.168.100.92:6444: 8370009e206305eca94ee4f6af67f4f55698513661f58b91da5dc26e0c8f328d1fb0a4674149fdd71e3203d2956758caf807f72bc53bcac0e7108644ec4cecf1d9ecb29cd5f90e2f834737f40373fff02816514499cb986ce382156daa85aa8df1a4bc8d57980657631a7dab2f33d773949cc611e38309efa8df59c035b9673b5929e8f240d9ecbe9e79e516fb87f1a0c58fd571bc2f69f99c7002d15bd87ae293fb1aa1aadd
DEBUG:msmart.lan:Received packet from 192.168.100.92:6444: 5a5a01117800208000000000d523201601071814633d0200008a000000000000000001800000000034a388355e4a208f9971c44c48082c155eab2881baca7cf77395a43aa7e53eabe065702bba646a72fab00dbd339a523e915c618b02ed2747fad73f2ffa0db1d3a365602a3bb8bcedc2e559e33a35470c
DEBUG:msmart.lan:Received response from 192.168.100.92:6444: aa2fac00000000000203b5081e0201011302010122020100190201003900010142000101090001010a00010100008bc8
DEBUG:msmart.base_device:Response from 192.168.100.92:6444 in 0.140000 seconds.
DEBUG:msmart.device.AC.command:Capabilities response payload: b5081e0201011302010122020100190201003900010142000101090001010a0001010000
DEBUG:msmart.device.AC.command:Raw capabilities: {'anion': True, 'freeze_protection': True, 'fahrenheit': True, 'aux_electric_heat': False, 'self_clean': True, 'one_key_no_wind_on_me': True, 'swing_vertical_angle': True, 'swing_horizontal_angle': True}
DEBUG:msmart.device.AC.command:Merged raw capabilities: {'eco_mode': True, 'eco_mode_2': False, 'silky_cool': False, 'heat_mode': True, 'cool_mode': True, 'dry_mode': True, 'auto_mode': True, 'swing_horizontal': True, 'swing_vertical': True, 'energy_stats': False, 'energy_setting': False, 'energy_bcd': False, 'turbo_heat': True, 'turbo_cool': True, 'fan_silent': False, 'fan_low': False, 'fan_medium': False, 'fan_high': False, 'fan_auto': False, 'fan_custom': True, 'humidity_auto_set': False, 'humidity_manual_set': False, 'cool_min_temperature': 16.0, 'cool_max_temperature': 30.0, 'auto_min_temperature': 16.0, 'auto_max_temperature': 30.0, 'heat_min_temperature': 16.0, 'heat_max_temperature': 30.0, 'decimals': False, 'anion': True, 'freeze_protection': True, 'fahrenheit': True, 'aux_electric_heat': False, 'self_clean': True, 'one_key_no_wind_on_me': True, 'swing_vertical_angle': True, 'swing_horizontal_angle': True}
DEBUG:msmart.base_device:Sending command to 192.168.100.92:6444: aa21ac00000000000003418100ff03ff00020000000000000000000000000303d590
DEBUG:msmart.lan:Sending packet to 192.168.100.92:6444: 5a5a011168002000000000000f23201601071814633d0200008a000000000000000000000000000065cd8728fc6a5d31e6464235e81fa3b3553c1270500a690b50db22f43e80f968dfc4835a9e1397466b9ae12661353e34f492645e74c4c6a16209f9f36cec8459
DEBUG:msmart.lan:Sending data to 192.168.100.92:6444: 8370008e20663a7cd53b3d3dbfbb6439f9831c52c8f7708a2fee32956b9a764f4660226a5f820dc1bc8b659d07bbca538e57a4c12457bd880aa71b249c42276d61abd4c4d2619cc84e2e9329017e7d926487a0668ca780dc46aa5e99fa6b67f13a592be16db0f812feab125a86b5c5d0753f66750ddaad0aa8122a1be37a11f9f288f10a77393e2e7d0e674495c181173d5a73041341
DEBUG:msmart.lan:Received data from 192.168.100.92:6444: 8370008e2063cbb029e686c3884963f2acfbe8b003d501c502924c6cee7f381e0f7cbc9e265fcaaa342bf2672bbc1272238adc67eeb7226e85a8dee244bfc63548dcaaef4135c2f896dffff6c6aa0af1a610aff1621fec7224e46c1e68e3a877dc7a24d6d7578e173546558af305f45e6f2a58fe63bb702c00b1b6d29e6a57f9b9fadc7f890290cc265dd61b87b4becdc808ad1a13db
DEBUG:msmart.lan:Received packet from 192.168.100.92:6444: 5a5a011168002080000000005e63201601071814633d0200008a000000000000000001800000000035da2adad61d69f1c15935709d6c24e47691d31edc6c2b06fd88e435123e0990410511e45705d894619d73fee48f36eb65434c1e9b037df165f242399d0ddcbd
DEBUG:msmart.lan:Received response from 192.168.100.92:6444: aa23ac00000000000203c0008a667f7f000000000062ff0e000100000000000000035caf
DEBUG:msmart.base_device:Response from 192.168.100.92:6444 in 0.140000 seconds.
DEBUG:msmart.device.AC.command:State response payload: c0008a667f7f000000000062ff0e00010000000000000003
DEBUG:msmart.base_device:Sending command to 192.168.100.92:6444: aa12ac00000000000003b10209000a0004284d
DEBUG:msmart.lan:Sending packet to 192.168.100.92:6444: 5a5a011158002000000000001d23201601071814633d0200008a0000000000000000000000000000c2235a913b9c5bd45d3a6e8eab07ed77e1af443f3affb3d28a44ed05d38fa718e2d21709d4e33e80dd87152fbbcb8de0
DEBUG:msmart.lan:Sending data to 192.168.100.92:6444: 8370007e20660d0e1ddc665ca8f65d97eeb7254202230ac85bb4dd838f2cd56bef4bb4eb5aaadcf12bdc48983fc3b3496398bd4a1a39c79569d886e0d51d472c676164ae8df21f8861a451ce7e1e6c24d8f47979daab977b4272311df14b38e279e8db06585fea99c29da26c2da50bc9f2132c61b5cdf3e1ad04ed80ca84b12dbec6e5f177c9
DEBUG:msmart.lan:Received data from 192.168.100.92:6444: 8370007e20630d45e9a7036588c073389a640ab3d6bc48782963231836a9e18d24e3facb0ba4b2d2a8f31bb065bfcbe01d116a5a874642cc34d08e55be6723c139e6dc20163e0c43389d8edb99ff41fca3b589d9cf7fc7ac96ed27ed3281d4adac5eed23f9193dfb3bae3590a155207433295331e386c1282a8e4db41445717a2d28bc0ba26b
DEBUG:msmart.lan:Received packet from 192.168.100.92:6444: 5a5a01115800208000000000d563201601071814633d0200008a0000000000000000018000000000dd58dfbddb170ae32d64cbde2c3b5f5cce548da8234bf6d761c116d45aa04dd761a742670887507881deeb08207ed30b
DEBUG:msmart.lan:Received response from 192.168.100.92:6444: aa18ac00000000000203b10209000001000a0000010000c8a7
DEBUG:msmart.base_device:Response from 192.168.100.92:6444 in 0.120000 seconds.
DEBUG:msmart.device.AC.command:Properties response payload: b10209000001000a0000010000
Traceback (most recent call last):
  File "msmart_test.py", line 47, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "msmart_test.py", line 41, in main
    'power_usage': device.power_usage
AttributeError: 'AirConditioner' object has no attribute 'power_usage'

leandropineda avatar Jul 01 '24 22:07 leandropineda

Ran the sample code with the very latest changes 368580c and I got

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.100.92:6444.
DEBUG:msmart.lan:Connected to 192.168.100.92:6444.
INFO:msmart.lan:Authenticating with 192.168.100.92:6444.
DEBUG:msmart.lan:Sending data to 192.168.100.92:6444: 83700040200000005bfcdf733c8926d892af2524c0976ec796f1abc5bfa3d8de22f7ce9707675470022b2630b1507462899978fd62e082b52670af50e29498eabc382073baa6642a
DEBUG:msmart.lan:Received data from 192.168.100.92:6444: 837000402001fb4a9803279b7c5e8875cb653d7fcf2ce6daca68d74f01e66ea24083f9612cc48ce6b463e8a3084df8f96fc8a9ca5264b41b11ea3a9ae457c9facf2dce5ad7178359
INFO:msmart.lan:Authentication successful. Expiration: 2024-07-02T10:32:33, Local key: xxxxxxxxxxxx
DEBUG:msmart.base_device:Sending command to 192.168.100.92:6444: aa0fac00000000000003b5010001e5a6
DEBUG:msmart.lan:Sending packet to 192.168.100.92:6444: 5a5a011158002000000000005722201601071814633d0200008a00000000000000000000000000000542065231b95b9123b7f675b1de90ae915c618b02ed2747fad73f2ffa0db1d344396f6a0ca45e3da9afb49179be6743
DEBUG:msmart.lan:Sending data to 192.168.100.92:6444: 8370007e2066fb5f4df6a0b869bc2912d0e7e7cf8d8e22129c18d8c740024e8437ea9cea1f70868239a67412c8a8dff17c485a234ab8018741684b83fbbd00357b5302e0f1d5a28a63b0fc153e98cd0f48ae0b688f3fe88df81778a7b96ed9eb5451c9b1a5e148527f10473690babdf7879ed32ad61061a86b9f5c4a5a2bcbd10255f49b9c46
DEBUG:msmart.lan:Received data from 192.168.100.92:6444: 8370009e20634731d7d0066a58cce57412fe74b87a501e84b317c076a3b8a1722bbadaf1d2dd5e71aee576c766b23b3744fc17f3c9c5302b9b53b67e3bfb3e5ffd2b737b16907e4356e2ed0b23929817206394bc8df43cf570daa88a5e742d8968381bba57c72ffa95ef0c08ea8b078bdb7df2c947ba9224642c3ffb803216b03d5932b43873a5cf23b52aace67d21f7e53d203eb669729aec81ce71be4493589bbb9b181c00
DEBUG:msmart.lan:Received packet from 192.168.100.92:6444: 5a5a011178002080000000004e23201601071814633d0200008a0000000000000000018000000000fd47f621f527a589be7379aa153dddebc3d5eb236c52bd02910eae00249ae9df07d4648d15d6e2f7a83b4fd3b703039487d37e7f08b1522d06eaf22ad82416e10f805d7b8048238d25210e0c752f97f8
DEBUG:msmart.lan:Received response from 192.168.100.92:6444: aa3dac00000000000203b50a12020101180001001402010115020101160201001a020101100201011f020100250207203c203c203c00400001000100c83a
DEBUG:msmart.base_device:Response from 192.168.100.92:6444 in 0.140000 seconds.
DEBUG:msmart.device.AC.command:Capabilities response payload: b50a12020101180001001402010115020101160201001a020101100201011f020100250207203c203c203c00400001000100
WARNING:msmart.device.AC.command:Unknown capability. ID: 0x0040, Size: 1.
DEBUG:msmart.device.AC.command:Raw capabilities: {'eco_mode': True, 'eco_mode_2': False, 'silky_cool': False, 'heat_mode': True, 'cool_mode': True, 'dry_mode': True, 'auto_mode': True, 'swing_horizontal': True, 'swing_vertical': True, 'energy_stats': False, 'energy_setting': False, 'energy_bcd': False, 'turbo_heat': True, 'turbo_cool': True, 'fan_silent': False, 'fan_low': False, 'fan_medium': False, 'fan_high': False, 'fan_auto': False, 'fan_custom': True, 'humidity_auto_set': False, 'humidity_manual_set': False, 'cool_min_temperature': 16.0, 'cool_max_temperature': 30.0, 'auto_min_temperature': 16.0, 'auto_max_temperature': 30.0, 'heat_min_temperature': 16.0, 'heat_max_temperature': 30.0, 'decimals': False}
DEBUG:msmart.base_device:Sending command to 192.168.100.92:6444: aa10ac00000000000003b501010102c1c6
DEBUG:msmart.lan:Sending packet to 192.168.100.92:6444: 5a5a011158002000000000000223201601071814633d0200008a00000000000000000000000000004704d4f6cb7e757d97bb0fb355e696691c6cb0cecabc7672cd44e0d17faa5708ad5a3db551c01a7fbdd07b73d6a492cf
DEBUG:msmart.lan:Sending data to 192.168.100.92:6444: 8370007e2066228a476c8a74944e8455bb008488c53d66dfec6176953cd2d7389fc5b656a6a76d1b9d1cde9a7e2d69108621e999b4307028832634cf5da3e571abd455ed2dbf2ce2eaa003dd374dda52eb2c34c200a741e7e60828e3b0675e6213c94c1ec31d8a8a4a87fc24a432d716bfc07d4d6487d7ccb304d9024998cb072699f2d56150
DEBUG:msmart.lan:Received data from 192.168.100.92:6444: 8370009e206305eca94ee4f6af67f4f55698513661f58b91da5dc26e0c8f328d1fb0a4674149fdd71e3203d2956758caf807f72bc53bcac0e7108644ec4cecf1d9ecb29cd5f90e2f834737f40373fff02816514499cb986ce382156daa85aa8df1a4bc8d57980657631a7dab2f33d773949cc611e38309efa8df59c035b9673b5929e8f240d9ecbe9e79e516fb87f1a0c58fd571bc2f69f99c7002d15bd87ae293fb1aa1aadd
DEBUG:msmart.lan:Received packet from 192.168.100.92:6444: 5a5a01117800208000000000d523201601071814633d0200008a000000000000000001800000000034a388355e4a208f9971c44c48082c155eab2881baca7cf77395a43aa7e53eabe065702bba646a72fab00dbd339a523e915c618b02ed2747fad73f2ffa0db1d3a365602a3bb8bcedc2e559e33a35470c
DEBUG:msmart.lan:Received response from 192.168.100.92:6444: aa2fac00000000000203b5081e0201011302010122020100190201003900010142000101090001010a00010100008bc8
DEBUG:msmart.base_device:Response from 192.168.100.92:6444 in 0.140000 seconds.
DEBUG:msmart.device.AC.command:Capabilities response payload: b5081e0201011302010122020100190201003900010142000101090001010a0001010000
DEBUG:msmart.device.AC.command:Raw capabilities: {'anion': True, 'freeze_protection': True, 'fahrenheit': True, 'aux_electric_heat': False, 'self_clean': True, 'one_key_no_wind_on_me': True, 'swing_vertical_angle': True, 'swing_horizontal_angle': True}
DEBUG:msmart.device.AC.command:Merged raw capabilities: {'eco_mode': True, 'eco_mode_2': False, 'silky_cool': False, 'heat_mode': True, 'cool_mode': True, 'dry_mode': True, 'auto_mode': True, 'swing_horizontal': True, 'swing_vertical': True, 'energy_stats': False, 'energy_setting': False, 'energy_bcd': False, 'turbo_heat': True, 'turbo_cool': True, 'fan_silent': False, 'fan_low': False, 'fan_medium': False, 'fan_high': False, 'fan_auto': False, 'fan_custom': True, 'humidity_auto_set': False, 'humidity_manual_set': False, 'cool_min_temperature': 16.0, 'cool_max_temperature': 30.0, 'auto_min_temperature': 16.0, 'auto_max_temperature': 30.0, 'heat_min_temperature': 16.0, 'heat_max_temperature': 30.0, 'decimals': False, 'anion': True, 'freeze_protection': True, 'fahrenheit': True, 'aux_electric_heat': False, 'self_clean': True, 'one_key_no_wind_on_me': True, 'swing_vertical_angle': True, 'swing_horizontal_angle': True}
DEBUG:msmart.base_device:Sending command to 192.168.100.92:6444: aa21ac00000000000003418100ff03ff00020000000000000000000000000303d590
DEBUG:msmart.lan:Sending packet to 192.168.100.92:6444: 5a5a011168002000000000000f23201601071814633d0200008a000000000000000000000000000065cd8728fc6a5d31e6464235e81fa3b3553c1270500a690b50db22f43e80f968dfc4835a9e1397466b9ae12661353e34f492645e74c4c6a16209f9f36cec8459
DEBUG:msmart.lan:Sending data to 192.168.100.92:6444: 8370008e20663a7cd53b3d3dbfbb6439f9831c52c8f7708a2fee32956b9a764f4660226a5f820dc1bc8b659d07bbca538e57a4c12457bd880aa71b249c42276d61abd4c4d2619cc84e2e9329017e7d926487a0668ca780dc46aa5e99fa6b67f13a592be16db0f812feab125a86b5c5d0753f66750ddaad0aa8122a1be37a11f9f288f10a77393e2e7d0e674495c181173d5a73041341
DEBUG:msmart.lan:Received data from 192.168.100.92:6444: 8370008e2063cbb029e686c3884963f2acfbe8b003d501c502924c6cee7f381e0f7cbc9e265fcaaa342bf2672bbc1272238adc67eeb7226e85a8dee244bfc63548dcaaef4135c2f896dffff6c6aa0af1a610aff1621fec7224e46c1e68e3a877dc7a24d6d7578e173546558af305f45e6f2a58fe63bb702c00b1b6d29e6a57f9b9fadc7f890290cc265dd61b87b4becdc808ad1a13db
DEBUG:msmart.lan:Received packet from 192.168.100.92:6444: 5a5a011168002080000000005e63201601071814633d0200008a000000000000000001800000000035da2adad61d69f1c15935709d6c24e47691d31edc6c2b06fd88e435123e0990410511e45705d894619d73fee48f36eb65434c1e9b037df165f242399d0ddcbd
DEBUG:msmart.lan:Received response from 192.168.100.92:6444: aa23ac00000000000203c0008a667f7f000000000062ff0e000100000000000000035caf
DEBUG:msmart.base_device:Response from 192.168.100.92:6444 in 0.140000 seconds.
DEBUG:msmart.device.AC.command:State response payload: c0008a667f7f000000000062ff0e00010000000000000003
DEBUG:msmart.base_device:Sending command to 192.168.100.92:6444: aa12ac00000000000003b10209000a0004284d
DEBUG:msmart.lan:Sending packet to 192.168.100.92:6444: 5a5a011158002000000000001d23201601071814633d0200008a0000000000000000000000000000c2235a913b9c5bd45d3a6e8eab07ed77e1af443f3affb3d28a44ed05d38fa718e2d21709d4e33e80dd87152fbbcb8de0
DEBUG:msmart.lan:Sending data to 192.168.100.92:6444: 8370007e20660d0e1ddc665ca8f65d97eeb7254202230ac85bb4dd838f2cd56bef4bb4eb5aaadcf12bdc48983fc3b3496398bd4a1a39c79569d886e0d51d472c676164ae8df21f8861a451ce7e1e6c24d8f47979daab977b4272311df14b38e279e8db06585fea99c29da26c2da50bc9f2132c61b5cdf3e1ad04ed80ca84b12dbec6e5f177c9
DEBUG:msmart.lan:Received data from 192.168.100.92:6444: 8370007e20630d45e9a7036588c073389a640ab3d6bc48782963231836a9e18d24e3facb0ba4b2d2a8f31bb065bfcbe01d116a5a874642cc34d08e55be6723c139e6dc20163e0c43389d8edb99ff41fca3b589d9cf7fc7ac96ed27ed3281d4adac5eed23f9193dfb3bae3590a155207433295331e386c1282a8e4db41445717a2d28bc0ba26b
DEBUG:msmart.lan:Received packet from 192.168.100.92:6444: 5a5a01115800208000000000d563201601071814633d0200008a0000000000000000018000000000dd58dfbddb170ae32d64cbde2c3b5f5cce548da8234bf6d761c116d45aa04dd761a742670887507881deeb08207ed30b
DEBUG:msmart.lan:Received response from 192.168.100.92:6444: aa18ac00000000000203b10209000001000a0000010000c8a7
DEBUG:msmart.base_device:Response from 192.168.100.92:6444 in 0.120000 seconds.
DEBUG:msmart.device.AC.command:Properties response payload: b10209000001000a0000010000
Traceback (most recent call last):
  File "msmart_test.py", line 47, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "msmart_test.py", line 41, in main
    'power_usage': device.power_usage
AttributeError: 'AirConditioner' object has no attribute 'power_usage'

nvm, I replaced power_usage with real_time_power_usage and it didn't crash. However, it shows no data.

{'id': xxxxxx, 'ip': '192.168.100.92', 'online': True, 'supported': True, 'power_state': False, 'indoor_humidity': None, 'real_time_power_usage': None}

leandropineda avatar Jul 01 '24 22:07 leandropineda

However, it shows no data.

That's because I renamed the property to enable energy usage requests.

The example now needs

device.enable_energy_usage_requests = True

instead of

device._supports_power_usage = True

mill1000 avatar Jul 02 '24 01:07 mill1000

Total Energy: 5650.02 kWh? Current Run Energy: 1514.0 kWh? Real Time Power: 0

I think they don't. Power usage is about 1kW, so the current run energy value doesn't look right.

Hmm... well none of the other interpretations I've found online make it any better.

  • Mode 1 Current Energy 1514.0
  • Mode 2 Current Energy 135526.4
  • Mode 3 Current Energy 2174.0

Unless maybe the units are off by a power of 10?

mill1000 avatar Jul 02 '24 01:07 mill1000

Hi, not sure if it's relevant, but I just tested with the latest changes and indoor_humidity shows correct data.

PandaDriver156 avatar Jul 06 '24 17:07 PandaDriver156

Thanks! That is great to know.

mill1000 avatar Jul 08 '24 15:07 mill1000

@PandaDriver156 Could you provide logs from your test?

mill1000 avatar Jul 09 '24 02:07 mill1000

Sure, here they are: ac.log

PandaDriver156 avatar Jul 09 '24 15:07 PandaDriver156

Thanks! Your device supports a lot of features. Might have to keep it around for testing :)

Have you tried enabling energy usage requests? i.e.

device.enable_energy_usage_requests = True

mill1000 avatar Jul 09 '24 17:07 mill1000

Thanks! Your device supports a lot of features. Might have to keep it around for testing :)

Haha sure, I'm here to test when needed.

Have you tried enabling energy usage requests? i.e.

device.enable_energy_usage_requests = True

Yes, unfortunately it shows 0, i guess it does not support energy monitoring.

PandaDriver156 avatar Jul 09 '24 17:07 PandaDriver156

Could I bother you for a log of that too? I want to add some additional test cases when a device doesn't support energy monitoring

mill1000 avatar Jul 09 '24 20:07 mill1000

There you go: ac.log

PandaDriver156 avatar Jul 09 '24 21:07 PandaDriver156

I have a Midea PortaSplit and tried getting energy consumption with version 2024.7.5

I'm getting the following values:

current_energy_usage = 1.1400000000000001
real_time_power_usage = 87.5
total_energy_usage = 9.38

Whereas the Midea app shows a real time usage of 232.5W Which logs do you need to look into that?

Gishan86 avatar Jul 18 '24 13:07 Gishan86

Hi. Thanks for testing and reporting back.

Are you using Home Assistant, or the example script above?

Either way I just need logs with debugging enabled.

mill1000 avatar Jul 18 '24 14:07 mill1000