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

AC turns off after power outage #3

Closed
bearpawmaxim opened this issue Oct 31, 2022 · 28 comments
Closed

AC turns off after power outage #3

bearpawmaxim opened this issue Oct 31, 2022 · 28 comments

Comments

@bearpawmaxim
Copy link
Contributor

bearpawmaxim commented Oct 31, 2022

If an AC was in working state before the power outage, it immediately turns off when the electricity comes back (at that stage when both wifi network and/or HA is not yet available).

When ha and wifi network is up, I can't turn on an AC from HA without retoggling the fan speed setting - AC just not reacts on nor operation mode nor temperature change.

This behavior occurs with this component only.

@bearpawmaxim
Copy link
Contributor Author

One more thing: when turning AC on, it turns on with 24°C setting

@bearpawmaxim
Copy link
Contributor Author

Hi @paveldn, any idea about what is the cause of my issue?

@paveldn
Copy link
Owner

paveldn commented Nov 8, 2022

@bearpawmaxim
Sorry I didn't find the root cause of the problem. I just can't reproduce it with my AC. Yes, it resets to 24 degrees (which is expected because the temperature is taken from AC itself and it is losing its settings). But now I am reworking the whole code for AC communication to make it more reliable and easier to support. Let's see if the problem will be gone with those changes.
I will let you know once this new code will be available for testing.

@paveldn
Copy link
Owner

paveldn commented Nov 8, 2022

Oh, I just realized that probably the power outage problem is much bigger for you than I thought. I will make another attempt to fix it this evening.

@bearpawmaxim
Copy link
Contributor Author

@paveldn okay, thanks, will wait.
I think that it is somehow related to a fan/fan-only mode.

@bearpawmaxim
Copy link
Contributor Author

the power outage problem is much bigger for you than I thought

I think that I got used to this) It just annoys me to sometimes turn the AC on, late at night for example))

@paveldn
Copy link
Owner

paveldn commented Nov 8, 2022

@bearpawmaxim
Can you get me logs? Not a power outage of course but attempts to switch it ON when it is not working, then "fan speed magic" and then working turn ON

@bearpawmaxim
Copy link
Contributor Author

bearpawmaxim commented Nov 8, 2022

@paveldn here the logs,
https://pastebin.com/pYu2nyxd - step 1, when can't turn on by setting heat mode. Just after network and ha boot from power outage
https://pastebin.com/gGHB0raG - step 2, when set automatic fan mode
https://pastebin.com/EQ9HPqm6 - step 3, when set heat mode and the AC finally turned on

Like I said earlier, I must take these steps sequentially to turn the AC on.

P.S.: Looks like something's is causing message timeouts at step 1
P.P.S.: Config can be found here https://github.com/bearpawmaxim/esphome-configs/blob/master/.haier_device_common.yaml - base AC package, used in 3 configs. Actually, I have three AC units that behaves identically.

@paveldn
Copy link
Owner

paveldn commented Nov 9, 2022

Yes, it looks like AC side problem. Not much I can do. I have plans to use a different command to control AC probably that one will work better in your case. But it will take some time.

@bearpawmaxim
Copy link
Contributor Author

@paveldn, thank you! Any estimates?

Just in case it would be helpful for you: as I mentioned earlier, the original version does not have such bug

@paveldn
Copy link
Owner

paveldn commented Nov 10, 2022

@bearpawmaxim

Any estimates?

I don't want to give any promises it really depends on how much free time I will have. Rough estimation 2 weeks.

Just in case it would be helpful for you: as I mentioned earlier, the original version does not have such bug

I can't reproduce it so not really helpful but it gives hope that the problem will disappear after my ew code will start working.

@bearpawmaxim
Copy link
Contributor Author

bearpawmaxim commented Nov 12, 2022

I can't reproduce it

BTW, running sequentially actions from this and this automations also reproduces the problem.

@bearpawmaxim
Copy link
Contributor Author

Hi @paveldn!
Removing both the display/beeper switches and swing mode select (config is here ) fixes the problem..
I think that it may be somehow related to the switch/select restoring it's state on boot and sends a command to the AC while AC is initializing.
For example, turn_on_action/turn_off_action-s for switch are executing every time the device boots.

@paveldn
Copy link
Owner

paveldn commented Nov 21, 2022

Hi @bearpawmaxim !
Thanks. Will see how I can improve this. Need to dig in ESPHome code for this...

@bearpawmaxim
Copy link
Contributor Author

bearpawmaxim commented Nov 21, 2022

Will see how I can improve this. Need to dig in ESPHome code for this...

The most easy way is to somehow deny or schedule switch/select (still don't know which one caused the problem, likely switch) action until the communication with AC is initialized.

@paveldn
Copy link
Owner

paveldn commented Dec 7, 2022

Hi @bearpawmaxim,
I probably found the root cause of this problem (and probably some other similar problems). It looks like in case the data part of the packet (header, data, checksum, or CRC) contains 0xFF, AC adds an additional 0x55 byte and also expects it from the ESP32 module. So if this situation happens in your case after a power cut, AC will ignore our packets (because it is waiting for 1 byte more) until something is changed (and 0xFF disappears from a packet). I am not 100% sure but it looks like it.
I see from your log that your packets at the beginning have FF in a low byte of CRC:
FF FF 14 40 00 00 00 00 00 01 60 01 08 06 81 00 02 01 00 00 00 00 48 E1 FF
So it is ignored. But when you change mode (actually any value) CRC changes and everything works fine.
I will need to change the handling of packets on the lowest level. It will take some time but at least now I know what is happening and why.

@bearpawmaxim
Copy link
Contributor Author

Hi @paveldn!
Thanks for your work!
Does this answers the question why AC turns off after the power loss and how this is related to the display/beeper switch? (as we already know it might be related to the executing of the turn on/off actions by the switch on boot)

@paveldn
Copy link
Owner

paveldn commented Dec 7, 2022

@bearpawmaxim,
That is the answer to the question of why you can't turn it ON without switching something (like the beeper or display off). In your case, FF appears in CRC which is quite a rear event. So if you will change any byte in the packet most likely your CRC will change to something else that doesn't contain FF. So changing anything (like fan mode, swing mode, AC mode, or set temp, etc.) will help. After power loss, AC forgets all settings and falls into default mode. But the ESP module keeps settings for those switches and switches them on. Apparently, that is leading to this state where the control packet has FF in CRC which is causing the problem.
So it is a combination of AC's default settings and states of beeper and display that causes problems. And that is why I couldn't reproduce the problem on my AC. Probable different models have different default settings.

@bearpawmaxim
Copy link
Contributor Author

Okay @paveldn, that sounds logical.
With the only exception that my AC doesn't forgets it's settings during power losses (it restores with the mode and temperature that were set before the power loss).
Anyway, waiting for the solution! Thanks for your work!

@paveldn
Copy link
Owner

paveldn commented Dec 8, 2022

Hi @bearpawmaxim
Please, check the latest commits on the dev branch it should fix this issue. Let me know if it worked,

bearpawmaxim pushed a commit to bearpawmaxim/esphome-configs that referenced this issue Dec 8, 2022
@bearpawmaxim
Copy link
Contributor Author

Hi @paveldn!
Have updated the component to the latest version and uncommented display/beeper switch alongside with swing mode select, but unfortunately that haven't helped: AC still turns off and forgets it's settings...
After commenting out the display, beepee and swing mode stuff again AC starts normally and restores the settings.

Can't there be situation when due to switch startup logic the ESP8266 sends an empty command to the AC? (that happens on the early boot stage, long before the 1st status reception)

@bearpawmaxim
Copy link
Contributor Author

@paveldn with the new version I can turn the AC on without that fan magic! So we are on the right way.

@evlo
Copy link

evlo commented Dec 9, 2022

To ADD to the confusion, I have tried with AC that did have the CRC issues before and it does remember last settings both with the wifi adapter present and without it the same after power outage.

@bearpawmaxim
Copy link
Contributor Author

To ADD to the confusion, I have tried with AC that did have the CRC issues before and it does remember last settings both with the wifi adapter present and without it the same after power outage.

As I mentioned earlier the problem is caused by the display/beeper switch and/or swing mode select restore at boot logic: it executes on_turn_off/on_turn_on actions on the early boot stage and likely sends an empty commands to the AC.
Maybe you are using the component without that switches/selects ?

@paveldn
Copy link
Owner

paveldn commented Dec 10, 2022

@bearpawmaxim @evlo
Thanks for the update. With confirmation that the CRC issue is fixed, I can try to make a fix or at least a workaround.

@paveldn
Copy link
Owner

paveldn commented Dec 26, 2022

@bearpawmaxim Can you check if power on problems still happens on the latest dev branch commits?

@bearpawmaxim
Copy link
Contributor Author

Hi @paveldn! Thanks for you work! Power off after power on is fixed!!)
The only things that remains is:

  1. The display on AC blinks after power on
  2. The outdoor temperature sensor reports -64 for some time after power on
    but that is for another issues I think/

@evlo
Copy link

evlo commented Jan 13, 2023

Haha I was wondering if it actually can froze that cold during heating cycle. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants