RobHofmann / HomeAssistant-GreeClimateComponent

Custom Gree climate component written in Python3 for Home Assistant. Controls AC's supporting the Gree protocol.
GNU General Public License v3.0
321 stars 107 forks source link

Device availability #163

Closed toughvj closed 5 months ago

toughvj commented 6 months ago

Solved problem of device unavailability if home assistant starts when devices are offline or have no power. From now on, devices are correctly added to the home assistant. There is a specific time interval when the home assistant checks whether the devices are online or not. If not, device is marked as unavailable until it appears on the network.

jodewee commented 5 months ago

@toughvj, @RobHofmann it seems like the issue with encryption is fixed now, but the horizontal swing is now gone (was in the "preset" mode): image

After adding the line: horizontal_swing: true to the climate.yaml file, this is also fixed (maybe something to add in the readme file when publishing this fix in a new release)

great work man!

jodewee commented 5 months ago

error_log-2.txt @toughvj in case you need the logs ..

toughvj commented 5 months ago

this is a very strange situation because I didn't change anything in the code, apart from adding a logger in a few places :) maybe there was something wrong with the last commit.

To be sure, please check the attached file to see if everything is OK. @RobHofmann , also test this file please, I added 2 variables to the configuration in the yaml file:

If everything will be ok with this file, I will complete the readme file with all changes.

climate.txt

jodewee commented 5 months ago

Strange, not at home at the momen5, but try with deleting the whole repo, download 2.12 and overwrite the climate.py with the new one. I’ll come back with this this afternoon

jodewee commented 5 months ago

@toughvj I don't get it.

jodewee commented 5 months ago

@toughvj files in my gree folder now: (working config) init.py.txt climate.py.txt manifest.json.txt

jodewee commented 5 months ago

@toughvj do i need to test the 2 additional parameters in the yaml file also? disable_available_check: true/false max_online_attempts:

toughvj commented 5 months ago

Magic :D, no U don't have to, this is specially for @RobHofmann ;)

toughvj commented 5 months ago

@toughvj I don't get it.

  • redownload 2.12 from hacs --> broken (see logfile 1)
  • change the climate.py file with the one above --> still broken
  • download 2.11 from hacs --> OK
  • change the climate.py file with the one above --> also OK (logfile 2)
  • deleted the files in pycache --> stays OK
  • redownload 2.12 from hacs, but now, removed the climate.py file and replaced it with the one above, and after that do the reboot --> seems to be working. (logfile 3)

logfile2-2.11_climatedotpy_adjust.log logfile1-2.12_not_working.log logfile3-2.12_retry_adjust_climatepy_before_reboot.log

when U. are changing files in custom_components folder U need always make reboot.

jodewee commented 5 months ago

yeah i know,i think when the integration failed when download 2.12, it takes a while for HA to fully startup. and i initiate a reboot before HA maybe fully was started. redid the whole process again to be sure, and it now works fine with the provided climate file you gave. The only thing i had to add in the config.yaml file was the horizontal_swing:true

toughvj commented 5 months ago

yeah, to have horizontal swing enabled, horizontal_swing: true must be set - @RobHofmann want's this in #156. hope everything work like a charm now. Please let me know in couple of days and I will make PR

jodewee commented 5 months ago

Ok, i ll let you know on monday

RobHofmann commented 5 months ago

this is a very strange situation because I didn't change anything in the code, apart from adding a logger in a few places :) maybe there was something wrong with the last commit.

To be sure, please check the attached file to see if everything is OK. @RobHofmann , also test this file please, I added 2 variables to the configuration in the yaml file:

  • disable_available_check: true if the component should not check device availability
  • max_online_attempts: some integer value - specifies after how many attempts the component should switch the device to the unavailable state

If everything will be ok with this file, I will complete the readme file with all changes.

climate.txt

@toughvj Both features seem to work as intended! Can you PR these in?

I see less unavailable states when i put the max attempts to 15 for example. However I had to use the disable option to make it really work correctly again.