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

Generate repair indication in HA, if required entity unvailable #1431

Open
der-seemann opened this issue Nov 2, 2024 · 6 comments
Open

Generate repair indication in HA, if required entity unvailable #1431

der-seemann opened this issue Nov 2, 2024 · 6 comments
Assignees
Labels

Comments

@der-seemann
Copy link

What is the feature?

Me and may other users have problems that under some circumstances a Better Tmermostat Entity is "not avaiable".
Sometimes it is very difficult to find the reason why it is not loading. There might be a Problem with the original thermostat entity, or with a sensor, or something else...
It would be great if there is an Status entity for each BetterThermostat device showing the reason why it is not avaiable.

Description

Additional Information

@Panoramiac
Copy link

I currently encounter the issue that a BT is not available, but all Zigbee devices are fine. A reload of the BT or a configuration loop with removing and then adding the window sensor again fixes the issues. Need to get a goog debug log and create an bug ticket.

@KartoffelToby
Copy link
Owner

BT shoud send a HA Repair issue with detaild infos, or if you use the BT UI its displayed in the UI itself.

@okba-zoueghi
Copy link

okba-zoueghi commented Nov 7, 2024

@KartoffelToby I am facing the same issue, I have seen nothing in HA Repairs coming from BT.
However I enabled debug logs and I see the following:

2024-11-07 18:25:30.722 INFO (MainThread) [custom_components.better_thermostat.adapters.delegate] better_thermostat None: integration: tuya isn't native supported, feel free to open an issue, fallback adapter generic
2024-11-07 18:25:30.778 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat better thermostat office: Waiting for entity to be ready...
2024-11-07 18:25:39.110 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat better thermostat office: Starting version 1.6.1. Waiting for entity to be ready...
2024-11-07 18:25:39.110 DEBUG (MainThread) [custom_components.better_thermostat.climate] better_thermostat better thermostat office: Undefined target temperature, falling back to 30.0
2024-11-07 18:25:39.110 DEBUG (MainThread) [custom_components.better_thermostat.climate] better_thermostat better thermostat office: No previously hvac mode found on startup, turn bt to trv mode heat
2024-11-07 18:25:39.110 DEBUG (MainThread) [custom_components.better_thermostat.climate] better_thermostat better thermostat office: Startup config, BT hvac mode is heat, Target temp 30.0
2024-11-07 18:25:39.113 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.thermostat_office - new setpoint calibration: 30.0 | external_temp: 22.1, target_temp: 30.0, trv_temp: 22.9
2024-11-07 18:25:39.113 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: TO TRV set_hvac_mode: climate.thermostat_office from: heat_cool to: heat
2024-11-07 18:25:39.113 DEBUG (MainThread) [custom_components.better_thermostat.adapters.generic] better_thermostat None: set_hvac_mode heat
2024-11-07 18:25:39.114 WARNING (MainThread) [homeassistant.components.climate] tuya::TuyaClimateEntity sets the hvac_mode heat which is not valid for this entity with modes: off, heat_cool, heat_cool. This will stop working in 2025.4 and raise an error instead. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+tuya%22
2024-11-07 18:25:39.182 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/better_thermostat/climate.py", line 858, in startup
await control_trv(self, trv)
File "/config/custom_components/better_thermostat/utils/controlling.py", line 220, in control_trv
await set_hvac_mode(self, heater_entity_id, _new_hvac_mode)
File "/config/custom_components/better_thermostat/adapters/delegate.py", line 84, in set_hvac_mode
return await self.real_trvs[entity_id]["adapter"].set_hvac_mode(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/better_thermostat/adapters/generic.py", line 124, in set_hvac_mode
await self.hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 772, in async_handle_set_hvac_mode_service
await self.async_set_hvac_mode(hvac_mode)
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 780, in async_set_hvac_mode
await self.hass.async_add_executor_job(self.set_hvac_mode, hvac_mode)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/tuya/climate.py", line 290, in set_hvac_mode
self._send_command(commands)
File "/usr/src/homeassistant/homeassistant/components/tuya/entity.py", line 276, in _send_command
self.device_manager.send_commands(self.device.id, commands)
File "/usr/local/lib/python3.12/site-packages/tuya_sharing/manager.py", line 93, in send_commands
return self.device_repository.send_commands(device_id, commands)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tuya_sharing/device.py", line 180, in send_commands
self.api.post(f"/v1.1/m/thing/{device_id}/commands", None, {"commands": commands})
File "/usr/local/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 192, in post
return self.__request("POST", path, params, body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 121, in __request
raise Exception(f"network error:({ret['code']}) {ret['msg']}")
Exception: network error:(2008) command or value not support

As far as I understood, the problem is caused by setting hvac_mode to 'heat' which is not supported by my thermostat.

2024-11-07 18:25:39.113 DEBUG (MainThread) [custom_components.better_thermostat.adapters.generic] better_thermostat None: set_hvac_mode heat
2024-11-07 18:25:39.114 WARNING (MainThread) [homeassistant.components.climate] tuya::TuyaClimateEntity sets the hvac_mode heat which is not valid for this entity with modes: off, heat_cool, heat_cool. This will stop working in 2025.4 and raise an error instead. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+tuya%22

Any hints on how to fix the issue?

Note: some times the entity gets available after trying to reconfigure lots of time (more than 5 times).
After restarting HA the entity becomes unavailable.

@jojoro1
Copy link

jojoro1 commented Dec 3, 2024

I have the same issue with my thermostatu (Moes Wifi). Any progress with that?

@Drakknar
Copy link

Currently experiencing the same (SONOFF TRVZB). I can't see anything under HA Repairs as well. If I go to Better Thermostat and I reload each integration entry, things start working again.

@folfy
Copy link
Collaborator

folfy commented Jan 9, 2025

Atm you have to check the BT or HA logs, to determine the reason unfortunately.

I've had created #1556 for actually generating repair messages, but guess in the end the same was anticipated here, so moving into this ticket instead:

Throw a "repair" indication to HA at some point, i.e. after waiting 60s for some dependent entity, so users at least see what's going wrong / why BT is not working/starting and unavailable. There are many out-of-scope bug reports coming in due to this atm.

Originally posted by @folfy in #1549 (comment)

Changed the title of the issue, as I suppose the repair indication is also fine for you @der-seemann? Don't see a need for some special, dedicated "entity".

@folfy folfy changed the title Show add status entity with reason for "not avaiable" Generate repair indication in HA, if required entity unvailable Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants