Closed RobHofmann closed 1 month ago
Included @toughvj
I think this happened when upgrading my HASS version to latest. I guess it lost old state and then null checks seem to fail. climate.txt
With this file I no longer have errors in the logs, however one of the AC's is still Unavailable
.
Another addition. After a while the last AC is also Available again. So it seems these null checks are needed. let me know your thoughts @toughvj.
I'll take a look at it tomorrow. This looks like a state machine problem to me. looking at your log, the problem affects every input_boolean. Did the problem occur before the HASS update?
Ok, check if auto_xfan and auto_light input_booleans really exists in your system. It looks like they are missing and that's why they are Nonetype.
input_boolean:
zolderkamer_ac_lights:
name: Lights
zolderkamer_ac_xfan:
name: XFan
zolderkamer_ac_auto_lights:
name: Auto Lights
zolderkamer_ac_auto_xfan:
name: Auto XFan
zolderkamer_ac_health:
name: Health
zolderkamer_ac_sleep:
name: Sleep
zolderkamer_ac_powersave:
name: Powersave
slaapkamer_ac_lights:
name: Lights
slaapkamer_ac_xfan:
name: XFan
slaapkamer_ac_auto_xfan:
name: Auto XFan
slaapkamer_ac_health:
name: Health
slaapkamer_ac_sleep:
name: Sleep
slaapkamer_ac_powersave:
name: Powersave
slaapkamer_<redacted>_ac_lights:
name: Lights
slaapkamer_<redacted>_ac_xfan:
name: XFan
slaapkamer_<redacted>_ac_auto_xfan:
name: Auto XFan
slaapkamer_<redacted>_ac_health:
name: Health
slaapkamer_<redacted>_ac_sleep:
name: Sleep
slaapkamer_<redacted>_ac_powersave:
name: Powersave
These are all AC related input booleans. The input booleans exist whenever I look in HASS, but I assume the script gets initialized before the booleans are available. This seems to happen specifically after an upgrade (I assume the state is wiped at that point?).
Right now the AC's work again, and im unsure how to reproduce this. So my suggestion is: lets do some null checks (look at my version, i added several null checks which seems to have done the trick. I was getting several more errors after fixing the first batch).
HA never ceases to surprise me. If we do it the way you suggested, in my opinion, if the input_booleans have no state when the integration starts, they will become useless. We need a loop that will check whether a specific entity id has already appeared in the state machine. Take a look at the attached file.
pay attention to the UpdateInputBooleans function, which executes in a loop in the update function.
With your version i'm still getting this (without any upgrades of HASS versions or w/e):
2024-07-16 17:36:54.194 ERROR (Dummy-2) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 792, in _async_xfan_entity_state_changed
_LOGGER.info('xfan_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.202 ERROR (SyncWorker_0) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 820, in _async_health_entity_state_changed
_LOGGER.info('health_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.206 ERROR (SyncWorker_0) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 873, in _async_sleep_entity_state_changed
_LOGGER.info('sleep_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.206 ERROR (SyncWorker_0) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 844, in _async_powersave_entity_state_changed
_LOGGER.info('powersave_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.214 ERROR (SyncWorker_0) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 792, in _async_xfan_entity_state_changed
_LOGGER.info('xfan_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.214 ERROR (SyncWorker_0) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 820, in _async_health_entity_state_changed
_LOGGER.info('health_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.220 ERROR (SyncWorker_0) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 873, in _async_sleep_entity_state_changed
_LOGGER.info('sleep_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.220 ERROR (SyncWorker_0) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 844, in _async_powersave_entity_state_changed
_LOGGER.info('powersave_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.221 ERROR (SyncWorker_0) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 792, in _async_xfan_entity_state_changed
_LOGGER.info('xfan_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.233 ERROR (SyncWorker_5) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 820, in _async_health_entity_state_changed
_LOGGER.info('health_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.234 ERROR (SyncWorker_5) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 873, in _async_sleep_entity_state_changed
_LOGGER.info('sleep_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.234 ERROR (SyncWorker_5) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 844, in _async_powersave_entity_state_changed
_LOGGER.info('powersave_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.877 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/gree/climate.py", line 1004, in _async_auto_light_entity_state_changed
_LOGGER.info('auto_light_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.913 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/gree/climate.py", line 1032, in _async_auto_xfan_entity_state_changed
_LOGGER.info('auto_xfan_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.929 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/gree/climate.py", line 1032, in _async_auto_xfan_entity_state_changed
_LOGGER.info('auto_xfan_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-16 17:36:54.930 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/gree/climate.py", line 1032, in _async_auto_xfan_entity_state_changed
_LOGGER.info('auto_xfan_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
strange, because I didn't make any changes in the input booleans event handling. it seems that after the HA update, input booleans are loaded after the integration is loaded
No I remember also seeing this with the version I modified (thats also why in my version i check all the states on None).
Also with your version shared in this thread there seems to be a big delay in booting (it gets stuck for 30ish seconds).
I'm trying to test this on a separate test environment atm.
yeah i'm still getting the errors just shared by me. However I can confirm that after an upgrade the AC's are no longer available with your version shared in this thread.
Whenever I downgrade HASS & also use the 2.14 version, it will give me an error after upgradeing HASS again. So you did fix something with this version :).
Ok, and how about that: take clean 2.14 version but set "dependencies": ["input_boolean"] in manifest.json and restart.
Unavailable again:
2024-07-17 01:22:03.901 ERROR (MainThread) [homeassistant.components.climate] Error while setting up gree platform for climate
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/gree/climate.py", line 165, in async_setup_platform
GreeClimate(hass, name, ip_addr, port, mac_addr, timeout, target_temp_step, temp_sensor_entity_id, lights_entity_id, xfan_entity_id, health_entity_id, powersave_entity_id, sleep_entity_id, eightdegheat_entity_id, air_entity_id, target_temp_entity_id, anti_direct_blow_entity_id, hvac_modes, fan_modes, swing_modes, preset_modes, auto_xfan_entity_id, auto_light_entity_id, horizontal_swing, light_sensor_entity_id, encryption_version, disable_available_check, max_online_attempts, encryption_key, uid)
File "/config/custom_components/gree/climate.py", line 305, in __init__
if self.hass.states.get(auto_light_entity_id).state is STATE_ON:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:03.902 ERROR (MainThread) [homeassistant.components.climate] Error while setting up gree platform for climate
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/gree/climate.py", line 165, in async_setup_platform
GreeClimate(hass, name, ip_addr, port, mac_addr, timeout, target_temp_step, temp_sensor_entity_id, lights_entity_id, xfan_entity_id, health_entity_id, powersave_entity_id, sleep_entity_id, eightdegheat_entity_id, air_entity_id, target_temp_entity_id, anti_direct_blow_entity_id, hvac_modes, fan_modes, swing_modes, preset_modes, auto_xfan_entity_id, auto_light_entity_id, horizontal_swing, light_sensor_entity_id, encryption_version, disable_available_check, max_online_attempts, encryption_key, uid)
File "/config/custom_components/gree/climate.py", line 315, in __init__
if self.hass.states.get(auto_xfan_entity_id).state is STATE_ON:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:03.904 ERROR (MainThread) [homeassistant.components.climate] Error while setting up gree platform for climate
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/gree/climate.py", line 165, in async_setup_platform
GreeClimate(hass, name, ip_addr, port, mac_addr, timeout, target_temp_step, temp_sensor_entity_id, lights_entity_id, xfan_entity_id, health_entity_id, powersave_entity_id, sleep_entity_id, eightdegheat_entity_id, air_entity_id, target_temp_entity_id, anti_direct_blow_entity_id, hvac_modes, fan_modes, swing_modes, preset_modes, auto_xfan_entity_id, auto_light_entity_id, horizontal_swing, light_sensor_entity_id, encryption_version, disable_available_check, max_online_attempts, encryption_key, uid)
File "/config/custom_components/gree/climate.py", line 315, in __init__
if self.hass.states.get(auto_xfan_entity_id).state is STATE_ON:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:04.813 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 781, in _async_xfan_entity_state_changed
_LOGGER.info('xfan_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:04.816 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 809, in _async_health_entity_state_changed
_LOGGER.info('health_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:04.817 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 862, in _async_sleep_entity_state_changed
_LOGGER.info('sleep_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:04.817 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 833, in _async_powersave_entity_state_changed
_LOGGER.info('powersave_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:04.817 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 781, in _async_xfan_entity_state_changed
_LOGGER.info('xfan_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:04.818 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 809, in _async_health_entity_state_changed
_LOGGER.info('health_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:04.818 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 862, in _async_sleep_entity_state_changed
_LOGGER.info('sleep_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:04.818 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 833, in _async_powersave_entity_state_changed
_LOGGER.info('powersave_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:04.819 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 781, in _async_xfan_entity_state_changed
_LOGGER.info('xfan_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:04.819 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 809, in _async_health_entity_state_changed
_LOGGER.info('health_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:04.819 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 862, in _async_sleep_entity_state_changed
_LOGGER.info('sleep_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2024-07-17 01:22:04.819 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/gree/climate.py", line 833, in _async_powersave_entity_state_changed
_LOGGER.info('powersave_entity state changed | ' + str(entity_id) + ' from ' + str(old_state.state) + ' to ' + str(new_state.state))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
Hi guys,
I've manually added those 2 helpers and my AC became available again. I also had to create target_temp manually in order to set specific value directly.
None of those options (light/target temp) became available/selectable in UI cards. Should they?
What about built-in temp sensor? In the changelog you have mentioned it's going to be supported. In the official mobile app there's a button to get actual temp.
I just gave it a try with light input_boolean. I can control lights after creating it manually. This is very first time I had to create inputs manually for the inegration, so I assume something's wrong?
Fixed in 2.14.2.
Describe the bug Bug with auto_light & auto_xfan input booleans
To Reproduce Steps to reproduce the behavior:
Configuration
Expected behavior HVAC will get added as normally.
Platform:
Logs