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

Air Conditioner Temp is one degree off #148

Open
billg118 opened this issue Jun 23, 2024 · 13 comments
Open

Air Conditioner Temp is one degree off #148

billg118 opened this issue Jun 23, 2024 · 13 comments
Labels
bug Something isn't working need more info Further information is requested

Comments

@billg118
Copy link

Pretty much what the title says. My midea air conditioner is set to 60 degrees but the integration is saying it's set to 61. If I set it to 62 it reports 61.

It's a midea u shape ac.

@mill1000 mill1000 added bug Something isn't working need more info Further information is requested labels Jun 23, 2024
@mill1000
Copy link
Owner

Can you enable debug logs and post them here?

@billg118
Copy link
Author

Not totally sure if I enabled logging correctly or not. I added this to my configuration.yaml

logger:
  default: info
  logs:
    homeassistant.components: info
    custom_components.midea_ac: debug

Im not seeing a lot of output from midea_ac. All Im seeing is this on startup:

2024-06-23 06:47:39.772 DEBUG (MainThread) [custom_components.midea_ac.climate] Supported operational modes: '[<HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.DRY: 'dry'>, <HVACMode.COOL: 'cool'>, <HVACMode.AUTO: 'auto'>, <HVACMode.OFF: 'off'>]'.
2024-06-23 06:47:39.772 DEBUG (MainThread) [custom_components.midea_ac.climate] Supported preset modes: '['none', 'sleep', 'eco', 'boost']'.
2024-06-23 06:47:39.772 DEBUG (MainThread) [custom_components.midea_ac.climate] Supported fan modes: '['silent', 'low', 'medium', 'high', 'auto']'.
2024-06-23 06:47:39.772 DEBUG (MainThread) [custom_components.midea_ac.climate] Supported swing modes: '['off', 'vertical']'.

and I can see the fetches:

2024-06-23 06:47:54.461 DEBUG (MainThread) [custom_components.midea_ac.coordinator] Finished fetching midea_ac data in 0.134 seconds (success: True)

@mill1000
Copy link
Owner

You can turn it on from the integration page in Home Assistant. I find that easier.

Here's the full configuration you'll need for the YAML

logger:
  default: warning
  logs:
    custom_components.midea_ac: info
    msmart: debug

@billg118
Copy link
Author

billg118 commented Jun 23, 2024

Gotcha. I see the more robust logging now. Here's a snippet of it. I'm not sure if any of this will be helpful though.

Is there something specific you're looking for in the logs?

Aside from the issue I posted about the integration works fine so I wouldn't expect to see any errors.

I actually have two of these ACs and they both do it. It was happening before I paired the second one too. They're the .89 and .37 IPs


2024-06-23 08:43:08.004 DEBUG (MainThread) [msmart.device.AC.command] State response payload: c00040287f7f00300000045d57040000000000000000009a
2024-06-23 08:43:08.005 DEBUG (MainThread) [custom_components.midea_ac.coordinator] Finished fetching midea_ac data in 0.153 seconds (success: True)
2024-06-23 08:43:08.982 DEBUG (MainThread) [msmart.lan] Received data from 192.168.0.89:6444: 8370008e206355ac4046bb243c9b1f48db62d4940b0e5385cc5bd1a8a94b5c724020c9bf29f47d84c6de2fe90553f0896cb51868baa08f5658dc8bcf049edb2abb87c9b3f89ec63b3572c2689b9ae09a9795eeb8bdc275a20e0422d1e6179ebe53d2ad77fd3e2ab48d31c544972ce1649f38e918f893e2f19efa018c4acc3596eb27dadd3da10416df7c157714c07d617ad8135179e1
2024-06-23 08:43:09.008 DEBUG (MainThread) [msmart.base_device] Sending command to 192.168.0.89:6444: aa21ac00000000000003418100ff03ff0002000000000000000000000000039b06c7
2024-06-23 08:43:09.009 DEBUG (MainThread) [msmart.lan] Received packet from 192.168.0.89:6444: 5a5a011168004400aa0a0000ddc82b0c17061814221b0b0000890000000000000000018000000000a9b207bd0ce15103d470e400c32f1911fbf92e541b9062d02bc3115380385af5cc7e6ca4bbdedaa93dfcc7a08ca38b8c176690c73ce19a140707d9db70214ff1
2024-06-23 08:43:09.009 DEBUG (MainThread) [msmart.lan] Received response from 192.168.0.89:6444: aa22ac00000000000305a0084028000000300080000000000000000000000000a5794c
2024-06-23 08:43:09.009 DEBUG (MainThread) [msmart.lan] Sending packet to 192.168.0.89:6444: 5a5a0111680020000000000000092b0c17061814221b0b000089000000000000000000000000000065cd8728fc6a5d31e6464235e81fa3b398d2c1d19678005a70071868e8b88b3b4386eead0b4434142dcc805ff9de3969cb12f283cda873c89f6ceba409d78a21
2024-06-23 08:43:09.010 DEBUG (MainThread) [msmart.lan] Sending data to 192.168.0.89:6444: 8370008e20662290a825d09840b5e37e4d10f46108beb5746640446b8a5f57719bbcce98093cb16fce921b71c0b7f32b9f881fd6510a6198bfe7db76c7abcd18d55d8a9c06ab1f54f4bb480c9811dc65f25784135a1694140cc281d45c924df0f122a3ad020a031931b052b59b425155d2236049932b1e8045a62d11fa7e52380f7cb3cd02e96f061753ffe3bc9f34a66adc7f0f97aa
2024-06-23 08:43:09.122 DEBUG (MainThread) [msmart.lan] Received data from 192.168.0.89:6444: 8370008e2063776be603c25f9df34db4ac29a7e1f8ed08e42553ee52fd3839cab667e1bec0a5306a0381bac592d9962e3fceb691b4dbd8e89f54a55995f13a2769d1b880f8901b2b4e02fc84e304492476e33ace0764b5cfb638f17c88e952b6bee8a1b4bbf43d358d6dfc1b79158071f18a73dbe769006bbff88cf09264984e8e2f6784680598fcc923d627bdec0849754c082c5866
2024-06-23 08:43:09.123 DEBUG (MainThread) [msmart.lan] Received packet from 192.168.0.89:6444: 5a5a0111680020800000000082092b0c17061814221b0b00008900000000000000000180000000006e6d5bdfb0fef039274d4d1953fe166d95f9fed27bc478380057c9cd91e0f7fbf83ef4c284c609f5ee86322557d4881b263f9cf4b75f0c9f8bad760c2ee91602
2024-06-23 08:43:09.124 DEBUG (MainThread) [msmart.lan] Received response from 192.168.0.89:6444: aa23ac00000000000303c00040287f7f00300000045c57040000000000000000009b0b74
2024-06-23 08:43:09.124 DEBUG (MainThread) [msmart.base_device] Response from 192.168.0.89:6444 in 0.120000 seconds.
2024-06-23 08:43:09.124 DEBUG (MainThread) [msmart.device.AC.command] State response payload: c00040287f7f00300000045c57040000000000000000009b
2024-06-23 08:43:09.124 DEBUG (MainThread) [msmart.device.AC.device] Ignored unknown response from 192.168.0.89:6444: a0084028000000300080000000000000000000000000a5
2024-06-23 08:43:09.125 DEBUG (MainThread) [custom_components.midea_ac.coordinator] Finished fetching midea_ac data in 0.117 seconds (success: True)
2024-06-23 08:43:09.328 DEBUG (MainThread) [msmart.base_device] Sending command to 192.168.0.37:6444: aa21ac00000000000003418100ff03ff0002000000000000000000000000039c8547
2024-06-23 08:43:09.329 DEBUG (MainThread) [msmart.lan] Sending packet to 192.168.0.37:6444: 5a5a0111680020000000000020092b0c17061814f8190b00008a000000000000000000000000000065cd8728fc6a5d31e6464235e81fa3b35d15f2183cb1a00db0aa357358f2681802bd88868c15a19894089c414e52fcdbb733dd0672e1c99c04cf81ebc9c94eed
2024-06-23 08:43:09.329 DEBUG (MainThread) [msmart.lan] Sending data to 192.168.0.37:6444: 8370008e20667a0fad596c6b88e9e5ba186c5490e36e24d03503e334694e7d202da2da593af2c1ba7017586a0506629071b3000b62626cbcc0e2683698e8bced46bf8bfb4e4e56c0213f23e49ce8035456154253e3088c28e33c6e8575e84acac25795130aef04283b1ca4b518621d96c656b58dfc901a52e012d2727614821139688d81d25d04fb1b140cb6258e9cb45e670c91a64d
2024-06-23 08:43:09.589 DEBUG (MainThread) [msmart.lan] Received data from 192.168.0.37:6444: 8370008e2063775604e05935db8bfb121e618f8f2985fc528750ae1b9d6fb4f271353463b6cc381d17d488a7130dc49c26e295f9238dcb4fec15d7af259396859c8d72f6683642371b328eeb5c8c88f29cac13f585115b02a0fd72c59c7197614d441af741f15e6cc872996082aff4fd0170f2a5e395258e2940cc6ee3917d14c48a7c60d96154619eab5f0e623114799155f582a674
2024-06-23 08:43:09.590 DEBUG (MainThread) [msmart.lan] Received packet from 192.168.0.37:6444: 5a5a01116800208000000000d7492b0c17061814f8190b00008a00000000000000000180000000006e6d5bdfb0fef039274d4d1953fe166d262701a95bc87c3848d1b8d567641261dcc9d5aabfc22c713d4da9ebdada75b9f34f322bf005ee291adbc6ad4f98aed8
2024-06-23 08:43:09.590 DEBUG (MainThread) [msmart.lan] Received response from 192.168.0.37:6444: aa23ac00000000000303c00040287f7f00300000045a55040000000000000000009ca1e1
2024-06-23 08:43:09.590 DEBUG (MainThread) [msmart.base_device] Response from 192.168.0.37:6444 in 0.260000 seconds.
2024-06-23 08:43:09.590 DEBUG (MainThread) [msmart.device.AC.command] State response payload: c00040287f7f00300000045a55040000000000000000009c
2024-06-23 08:43:09.590 DEBUG (MainThread) [custom_components.midea_ac.coordinator] Finished fetching midea_ac data in 0.262 seconds (success: True)

@billg118
Copy link
Author

I did more testing and found the "problem" temp is 63. If the temp is 64 or higher the AC and the integration show the same temp. When I lower temp on the integration from 64 to 63 the AC temp actually lowers from 64 to 62. The integration still says 63. So it's only a problem at 63 degrees and under. Still pretty weird

@mill1000
Copy link
Owner

Thanks for that additional detail. Temperatures below 17 C (approx 62-63 F) are handled by a different section of code. So it's possible there's a latent bug.

@mill1000
Copy link
Owner

Could you provide 2 logs, one when set to 64, the other when set to 63?

@billg118
Copy link
Author

Sure.

Here is the log going from 64 to 63 using the integration. This is where it actually sets the AC temp from 64 to 62, which causes the mismatch.

2024-06-29 07:41:28.720 DEBUG (MainThread) [msmart.base_device] Sending command to 192.168.0.89:6444: aa21ac00000000000003418100ff03ff0002000000000000000000000000031595be
2024-06-29 07:41:28.721 DEBUG (MainThread) [msmart.lan] Received packet from 192.168.0.89:6444: 5a5a01116800440060610000689c290b1d061814221b0b0000890000000000000000018000000000fc00f28aebe81be32a9d8df39574863f500a1db30dde42ea9bb59090a33d682e3c5a4a11463f6c37d14a20284adbbf440730bd412ccc0b29156d176a30ba0804
2024-06-29 07:41:28.721 DEBUG (MainThread) [msmart.lan] Received response from 192.168.0.89:6444: aa22ac00000000000305a00b40280000003000900000000000000000000000001f67d1
2024-06-29 07:41:28.722 DEBUG (MainThread) [msmart.lan] Sending packet to 192.168.0.89:6444: 5a5a01116800200000000000481c290b1d061814221b0b000089000000000000000000000000000065cd8728fc6a5d31e6464235e81fa3b3aa7f71beb34f4f9cf0535e01983847684b2f2a41717fa93e4dbf899250df42818f8f5aba6e44628294deca65fa47b767
2024-06-29 07:41:28.722 DEBUG (MainThread) [msmart.lan] Sending data to 192.168.0.89:6444: 8370008e20669cfb9dc009d80a6e9b72d87da889d5e023ed63f46df91afbdb24884632f6b1f59652dbac4d379db2b14340418be3bba4326beb595686eac4ec4bae495f5a1dbcde7717425f3e16705e6b6af50e97a5be4227430724474eac5b671fe232c2c4bef85dc966ac5ccbe1978827b2356fe31f1dd061e4681ec71b8abb3119aef36eed45d5e6196f0dee420d7899a161eddc9e
2024-06-29 07:41:28.913 DEBUG (MainThread) [msmart.lan] Received data from 192.168.0.89:6444: 8370008e20633ec249193aa471caed204bdb60e4d6738af85df08999fdf5294d8e08e6be4770326f6ee7cd3883ff867c34a5bf905f11f73200c8196854618b5ee844cc96ea1ff12a5791f8854cb2396c5458b7bab0cf3364599cb4a6271a94ce37b67ea06426193ae8bfc593f0f949a2cda8a58822e2b34a642444bd7f9989d12835404026b0b52d76f87208ad07da247ac42497bfb6
2024-06-29 07:41:28.914 DEBUG (MainThread) [msmart.lan] Received packet from 192.168.0.89:6444: 5a5a01116800208000000000ff9c290b1d061814221b0b00008900000000000000000180000000001ffe4c2b8fe89f34031a9ad3a315d972220f0d080d7396904d14f77fc242b3c25fd29ce09010d45285eb475de54353dff4ff2e1f5b46dc2b424e636a035966dc
2024-06-29 07:41:28.914 DEBUG (MainThread) [msmart.lan] Received response from 192.168.0.89:6444: aa23ac00000000000303c00141287f7f00300010045a55000000000000000000001503f8
2024-06-29 07:41:28.914 DEBUG (MainThread) [msmart.base_device] Response from 192.168.0.89:6444 in 0.190000 seconds.
2024-06-29 07:41:28.914 DEBUG (MainThread) [msmart.device.AC.command] State response payload: c00141287f7f00300010045a550000000000000000000015
2024-06-29 07:41:28.914 DEBUG (MainThread) [msmart.device.AC.device] Ignored unknown response from 192.168.0.89:6444: a00b40280000003000900000000000000000000000001f
2024-06-29 07:41:28.914 DEBUG (MainThread) [custom_components.midea_ac.coordinator] Finished fetching midea_ac data in 0.195 seconds (success: True)
2024-06-29 07:41:31.786 DEBUG (MainThread) [msmart.lan] Received data from 192.168.0.89:6444: 8370008e206304a3dfb9f48e71ccec7c9511c3fb93e0e5d6aade94ade86013219fbafffb6a552437ab77a59384c79fa6ed2fc7e820f6a09a449c3dbd6c1d20daa51c2d35586cba24563b7a944ddf7530cc9a86d8e2dec9817a8a13f83f02d6c634d8e17468dfcc2c086597375b8cb8c40419e0c7994dcfe3ea316701d14e784dbfdc27fd688d7d19170aefa56b50673ad8eb0872217e

And heres the log going from 63 to 64 which fixes the mismatch

2024-06-29 07:46:40.695 DEBUG (MainThread) [msmart.base_device] Sending command to 192.168.0.37:6444: aa21ac00000000000003418100ff03ff0002000000000000000000000000034a0f0f
2024-06-29 07:46:40.696 DEBUG (MainThread) [msmart.lan] Sending packet to 192.168.0.37:6444: 5a5a0111680020000000000045282e0b1d061814f8190b00008a000000000000000000000000000065cd8728fc6a5d31e6464235e81fa3b3d5f698a3012284e3d1d2ce32b7de69f1610d0662c504df11b6e067fd35f5a387e18a289c32792f72a1418696dcc5c024
2024-06-29 07:46:40.697 DEBUG (MainThread) [msmart.lan] Sending data to 192.168.0.37:6444: 8370008e2066e0f769c735b48ec8294033cfc71f65b899730f0e717243cfa3aa924c68209ca7f6ea54b5465742577157e68f97033a28e13465ca5ca0417d910f451b2bda16e31710c299a7ede00fcaf3e1a622a548d20d331eefe945f560ac7153d7978d1251c259dab9051d5e33f9b5baf6a6961e90842a8ba21c9c9ff049d5b42f13def4b15e452fee517541c493a86de7921ff313
2024-06-29 07:46:40.806 DEBUG (MainThread) [msmart.lan] Received data from 192.168.0.89:6444: 8370008e2063b52745610cefb9c60d15251bd1194e4f7bc712f369b2190d2c664ddcbfed81b78ce464b801282c14bbd52f4e682b5e004d361ba1c4eb883028adb1c7a0a7cd8189c2c83ff37bc0dd4ace69d1a64c54b40e41cdd1caf1723a08212db95d0522b24f510616287d0cb896302a96e9db9bd918adaced01464f2d4f773d58f5a8653f2573351f22c3a248aa9de89958d5e1b7
2024-06-29 07:46:40.807 DEBUG (MainThread) [msmart.lan] Received packet from 192.168.0.89:6444: 5a5a01116800208000000000aea82e0b1d061814221b0b000089000000000000000001800000000007d04134879fc654a610b7651d8fd993804a3c4eed5ee90976221fcd87b46e63429093a5febc7a3b64ebeedce485e8b8861b7ac04d35b0c0edf5216652b3bd0c
2024-06-29 07:46:40.807 DEBUG (MainThread) [msmart.lan] Received response from 192.168.0.89:6444: aa23ac00000000000303c00142287f7f00300010045c5600000000000000000000499a29
2024-06-29 07:46:40.807 DEBUG (MainThread) [msmart.base_device] Response from 192.168.0.89:6444 in 0.250000 seconds.
2024-06-29 07:46:40.808 DEBUG (MainThread) [msmart.device.AC.command] State response payload: c00142287f7f00300010045c560000000000000000000049
2024-06-29 07:46:40.808 DEBUG (MainThread) [msmart.device.AC.device] Ignored unknown response from 192.168.0.89:6444: a00d402800000030009000000000000000000000000053
2024-06-29 07:46:40.808 DEBUG (MainThread) [custom_components.midea_ac.coordinator] Finished fetching midea_ac data in 0.254 seconds (success: True)
2024-06-29 07:46:40.875 DEBUG (MainThread) [msmart.lan] Received data from 192.168.0.37:6444: 8370008e20632f2be771cd887aff31c8e870833da508d62d55ac2a1866acda53b4c2420a70119227ebe9a3f477ec7018276917c8fae251a1c7b4918aff2e089a5e0d69ddb9f925e0550e3828bd6275b5148da5a2b56f70d7cfbce160d463ee11dd903dd9d79e4a894b3dae05f8572f99fd24d155b91fec3fa8532025c2e0c52c9bbc0914759b14cd57cbd8d81549ea0a1d48627378ba
2024-06-29 07:46:40.875 DEBUG (MainThread) [msmart.lan] Received packet from 192.168.0.37:6444: 5a5a0111680020800000000063e82e0b1d061814f8190b00008a00000000000000000180000000007c43b38bcf956e7f800887608096bd2347df5fe850da60c910e7be7e90ee4ab07512fb38429a03d172fa7500435a0b0abe609bd3b48a6eef0803d35479f9dbfc
2024-06-29 07:46:40.876 DEBUG (MainThread) [msmart.lan] Received response from 192.168.0.37:6444: aa23ac00000000000303c00044157f7f00300000045656007000000000000000004aa0da
2024-06-29 07:46:40.876 DEBUG (MainThread) [msmart.base_device] Response from 192.168.0.37:6444 in 0.180000 seconds.
2024-06-29 07:46:40.876 DEBUG (MainThread) [msmart.device.AC.command] State response payload: c00044157f7f00300000045656007000000000000000004a
2024-06-29 07:46:40.876 DEBUG (MainThread) [custom_components.midea_ac.coordinator] Finished fetching midea_ac data in 0.181 seconds (success: True)
2024-06-29 07:46:43.612 DEBUG (MainThread) [msmart.lan] Received data from 192.168.0.89:6444: 8370008e20631d020a9f0197d4ecfa848fcb51a046aa1978becce7de69720abe9a0733037aa3b7869a1cf58b81e1f9b4b2f860124d8f49a2f8cdc4529bd3c70a753ebd56cc6bef0491d32966c4058a448b255885650359dc2ad59a326f85fb45a3cd9c22ab06897244bd46ebbc058935da928cb5cc329165799ff3dac29b3d0326c74c70ef41b9a860fc223d01216660ddb42c70e7e1

@mill1000
Copy link
Owner

mill1000 commented Jul 1, 2024

Ok. Thanks.

Here is the log going from 64 to 63 using the integration. This is where it actually sets the AC temp from 64 to 62, which causes the mismatch.

In this log the target temperature is 17 C (62.6 F)

And heres the log going from 63 to 64 which fixes the mismatch

In this log the target temperatures is 18 C (64.4 F)

In these logs you haven't set the temperature low enough to enable the "alternate" temperature bits (< 17 C). I'm wondering if there's an issue with how the fractional term (.5 degree C) is being handled.

Can you post the full logs? I need to see the commands we're sending to determine if the correct fractional temperature information is present.

@v1k70rk4
Copy link

v1k70rk4 commented Jul 14, 2024

Hi, the climate is like this at Fahrenheit degrees :( It depends on which device rounds from what. Especially if you have an air conditioner that can't be set to whole degrees in Celsius.
60 °F is 15.55 °C -> rounded to 61
61 °F is 16 °C -> this is exactly 61
62 °F is 16.66 °C -> and if it can't handle decimal degrees in Celsius, this is also 61
So, between 60-62 °F, it is technically 16 degrees Celsius, and the air conditioner converts this back to Fahrenheit.

Midea didn't explain this well because it specifically converts every Fahrenheit value to Celsius, sets it, and then converts this Celsius value back to Fahrenheit for feedback.
Additionally, the air conditioner cannot be set below 16°C, so I don't understand why it allows this in Fahrenheit.
For Midea, 16 degrees seems like it's set as the "min" value, so the code might be different because of this.

Check for any oddities at higher Fahrenheit values as well, if this is the issue:
60°F = 15.56°C
61°F = 16.11°C
62°F = 16.67°C
63°F = 17.22°C
64°F = 17.78°C
65°F = 18.33°C
66°F = 18.89°C
67°F = 19.44°C
68°F = 20.00°C
69°F = 20.56°C
70°F = 21.11°C
71°F = 21.67°C
72°F = 22.22°C
73°F = 22.78°C
74°F = 23.33°C
75°F = 23.89°C
76°F = 24.44°C
77°F = 25.00°C

@apella12
Copy link

Don't know if this will help because it is in java for another program, but I had issues setting some temperatures in F degrees. This fixed it; The temperature is in C, but was converted from a whole number degrees F like the table above.

public void setTargetTemperature(float temperature) {
        data[0x0c] &= ~0x0f;
        data[0x0c] |= (int) (Math.round(temperature * 2) / 2) & 0xf;
        setTemperatureDot5((Math.round(temperature * 2)) % 2 != 0);
    }

So 63 f =17.22*2 = 34/2 = 17 masked the last 4 are 0001 & 34/2 is an even 17, so no 0.5 (00000001) which is actually 62.6 F. 62 is going to 16.5 and 64 is going to be 18

@mill1000
Copy link
Owner

Similar logic is applied here

# Round temperature to nearest .5
self._device.target_temperature = round(temperature * 2) / 2

and here
https://github.com/mill1000/midea-msmart/blob/e614ee5d80ab840d27ec1bef07525a5e305d6eb3/msmart/device/AC/command.py#L220-L235

@apella12
Copy link

I only commented to help on the issue and used 63 F because that was mentioned. The issue is likely that the calc is coming up with 17.5 which is 63.5 and is getting rounded to 64. My example gets 17 which is 62.6 that rounds to 63 (and that's what my device sets to with the IR). I think it is the dot calculation that needs to be checked.

Also I was hoping you would see my question on the LED. Thanks for that. I'll close that one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants