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

Remove deprecated typing and fix thread safety issue #275

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

niekschoemaker
Copy link

Fixed issues with state updates, since newer home assistant versions async_write_ha_state gets blocked from other threads, so I replaced those calls with schedule_update_ha_state. And replaced the HomeAssistantType with HomeAssistant since HomeAssistantType is deprecated.

Also had some left overs from a while ago where I added the compressor frequency as a state which shows the load on the air conditioner currently.

I tested this running on my own Home Assistant setup with a few Haier Air Conditioners and this appears to fix the issues with the state not updating.

@niekschoemaker
Copy link
Author

Just pushed another two commits.

I finally figured out what was causing the thread safety issues in the first place.

However I'm not sure if the async_write_ha_state can be used at this point or not, and also don't see any issue with simply keeping it as schedule_update_ha_state.

The latest fix resolves issues with the things like "Current Temperature" and the state of the machine not updating when changed from anything other than home assistant, since these were done through mqtt which runs a different event loop.

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

Successfully merging this pull request may close these issues.

1 participant