asantaga / wiserHomeAssistantPlatform

Platform and related climate/sensors to support the Drayton Wiser Home Heating System
MIT License
231 stars 44 forks source link

HEADS UP - Manage Temps Recipe V2 Potentially Causing HA 2024.4 Crashes #464

Open jbeardon opened 6 months ago

jbeardon commented 6 months ago

Just a heads up for anyone using recipes/manage_temps_v2.md

I attempted to update to HA 2024.4.1 this morning and although everything seemed to go well, HA became unavailable within a matter of minutes. Tried the upgrade a few times after rolling back but experienced the same issue - removed a few HACS integrations that were documented as causing issues - no joy.

Looking at the logs, the trigger automation for manage_temps_v2 was referenced in multiple, repeated errors until losing connection to HA - example at the bottom of this issue.

I'm no expert but after eventually managing to get HA running long enough, I disabled the automations relating to Manage Temps V2 and HA has been stable since.

I've been using Manage Temps for at least 6 months - this problem was not present with HA 2024.3 but there is a definite corrolation.

2024-04-06 13:26:58.522 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback <_asyncio.TaskStepMethWrapper object at 0x7f960c8acc70>()
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
RuntimeError: Cannot enter into task <Task pending name='Task-10256' coro=<BaseSelectorEventLoop._accept_connection2() running at /usr/local/lib/python3.12/asyncio/selector_events.py:213>> while another task <Task finished name="event trigger {'domain': 'automation', 'name': 'Wiser External Sensor Event - ESPHome', 'home_assistant_start': True, 'variables': {'temp_sensor_integration': 'esphome', 'temp_sensor_prefix': 'sensor.ths', 'temp_sensor_suffix': 'temperature', 'this': {'entity_id': 'automation.wiser_fire_external_sensor_event_esphome', 'state': 'on', 'attributes': {'id': '1704796737667', 'last_triggered': datetime.datetime(2024, 4, 6, 12, 15, 40, 761858, tzinfo=datetime.timezone.utc), 'mode': 'queued', 'current': 0, 'max': 25, 'friendly_name': 'Wiser External Sensor Event - ESPHome'}, 'last_changed': '2024-04-06T12:16:50.536050+00:00', 'last_reported': '2024-04-06T12:16:50.536050+00:00', 'last_updated': '2024-04-06T12:16:50.536050+00:00', 'context': {'id': '01HTSNE3B8NVKSN2DQJR91ZA2V', 'parent_id': None, 'user_id': None}}}, 'trigger_data': {'id': '0', 'idx': '0', 'alias': None}}" result=None> is being executed.
2024-04-06 13:26:59.056 ERROR (MainThread) [homeassistant] Error doing job: Task was destroyed but it is pending!
2024-04-06 13:26:59.057 ERROR (MainThread) [homeassistant] Error doing job: Task was destroyed but it is pending!
2024-04-06 13:27:01.064 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback <_asyncio.TaskStepMethWrapper object at 0x7f9600b47850>()
msp1974 commented 6 months ago

Wierd an automation is causing this error. I have seen some similar errors logged on HA Core repo but they seem to be caused by integrations performing non thread safe operations.

I will have a look at this myself but what HACs integrations do you have loaded?

jbeardon commented 6 months ago

Hi Mark - I thought it odd as well but I have always had concerns about this setup (particularly the external sensor event automation). It literally gets triggered with every sensor state change and then has to evaluate whether the sensor is using a defined integration that it starts and ends with certain text - if, like myself, you have a lot of sensors, it's triggering almost continuously. I've been meaning to re-write the even trigger part of it so that it's only triggering from specific sensors and not having to do the whole valuation thing.

In answer to your question, although I do have a number of HACS integrations, the only one that was mentioned in any of the posts I came across was Watchman, which I removed prior to doing further troubleshooting. The only thing in the logs creating errors referenced this automation so didn't really look further.

For reference, I have these HACS integrations installed: Tapo: Cameras Control myenergi Moonraker Frigate (proxy) keymaster Haier hOn Event Sensor Holidays Alarmo WebRTC Camera Octopus Energy HASS.Agent Alexa Media Player Bambu Lab Drayton Wiser