Unit unavailable after upgrading to v1.5.0
mihsu81 opened this issue · 14 comments
After upgrading to v1.5.0 the unit becomes unavailable (also in the Onecta app) but it still replies to pings.
I can see the following errors in HA. I've tested individually the 2 PRs from v1.5.0 and #95 causes the issue.
At this point even reverting the integration to v1.4.0 + #94 (as was running for the past few weeks) doesn't help and i have to power cycle the heating unit.
Here's the debug log in case it helps. home-assistant_daikin_altherma_2024-07-25T20-18-31.706Z.log
Logger: homeassistant.components.switch
Source: helpers/entity_platform.py:364
integration: Comutator (documentation, issues)
First occurred: 09:48:49 (1 occurrences)
Last logged: 09:48:49
Error while setting up daikin_altherma platform for switch
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/daikin_altherma/switch.py", line 19, in async_setup_entry
operations = climate_control.unit.operations
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'unit'
Această eroare originează într-o integrare non-standard.
Logger: custom_components.daikin_altherma
Source: custom_components/daikin_altherma/__init__.py:191
integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 09:48:49 (1 occurrences)
Last logged: 09:48:49
Something went wrong while updating data from the device
Traceback (most recent call last):
File "/config/custom_components/daikin_altherma/__init__.py", line 191, in async_update
self._climate_control_powered = await self._device.climate_control.is_turned_on
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'is_turned_on'
Această eroare originează într-o integrare non-standard.
Logger: custom_components.daikin_altherma.select
Source: custom_components/daikin_altherma/select.py:34
integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 09:48:49 (1 occurrences)
Last logged: 09:48:49
Cant read operation modes from the profile. Raise an issue!
Această eroare originează într-o integrare non-standard.
Logger: custom_components.daikin_altherma.water_heater
Source: custom_components/daikin_altherma/water_heater.py:32
integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 09:48:49 (1 occurrences)
Last logged: 09:48:49
Cannot find daikin hot water tank unit.
None of the errors in the log refers to the code changes that were done in #95
From what i can understand these errors are related to the unit being offline.
@mihsu81 what is the operation mode that you’re running your unit? After installing v1.5.0, did the unit immediately went offline? Can you maybe provide the logs after installing v1.5.0?
@tadasdanielius any thoughts?
Still, can't reproduce. Tried fresh install as well as upgrade. Seems to be working for me.
@mihsu81 have you made any updates to the device, recently?
@mxilievski After applying the changes from your PR and restarting HA the integration does a query of device properties etc. That's when the gateway goes in a sort of blocked state when it is only able to reply to ping and nothing else. Power cycling the gateway and gas boiler doesn't help.
@tadasdanielius There haven't been any updates for this gateway since it was initially installed in 2019.
My assumption is that, the way the device is initialized by the integration is causing it to get stuck. I don't know what troubleshooting steps I could take to give you an ideea what causes the issue.
So, does that mean that integration "kill" the device and it becomes unresponsive?
Indeed, the moment HA is restarted after upgrading the integration to v1.5.0, the gateway becomes unresponsive, but still replies to ICMP packets. At the moment I'm using 1.4.0 + #94
@tadasdanielius i believe we're writing something that is not expected by the unit in async_set_native_value
.
@mihsu81 in what mode are you running your unit?
@mihsu81 do you have Room Thermostat? Might be a problem that it is somehow conflicting. Can you share the profile? Just uncomment those lines and restart integration.
@mihsu81 in what mode are you running your unit?
@mihsu81 do you have Room Thermostat?
This is a Gas Boiler with a Daikin LAN Gateway which is also connected to a Daikin OpenTherm room thermostat.
@tadasdanielius The thermostat is DOTROOMTHEAA
I'm getting an error after uncommenting those lines and restarting HA and the integration doesn't load anymore:
Logger: homeassistant.config_entries
Source: config_entries.py:604
First occurred: 22:46:50
Last logged: 22:51:45
Error setting up entry Daikin HVAC controller (180400597) for daikin_altherma
Traceback (most recent call last):
File "/config/custom_components/daikin_altherma/__init__.py", line 40, in setup_api_instance
filepath: str = os.path.join(hass.config.config_dir, f'daikin_altherma_{profile["idx"]}.json')
^^
NameError: name 'os' is not defined. Did you forget to import 'os'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daikin_altherma/__init__.py", line 68, in async_setup_entry
hass.data[DOMAIN][entry.entry_id] = api = await setup_api_instance(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daikin_altherma/__init__.py", line 44, in setup_api_instance
_LOGGER.warning(f'Failed to save profile state to file {filepath}. It does not affect the operation of the integration.', exc_info=True)
^^^^^^^^
UnboundLocalError: cannot access local variable 'filepath' where it is not associated with a value
My pure speculation here is that "gateway" tries to change values in thermostat and thermostat isn't smart enough and does not understand it, so it keeps hanging and gateway stops responding.
@mihsu81 sorry for "outdated" code. Could you try to update with this
try:
import os
import json
for profile in unit_profiles:
filepath: str = os.path.join(hass.config.config_dir, f'daikin_altherma_{profile["idx"]}.json')
with open(filepath, 'w') as f:
f.write(json.dumps(profile['profile']))
except Exception as e:
_LOGGER.warning(f'Failed to save profile state to file {filepath}. It does not affect the operation of the integration.', exc_info=True)
basically, just add extra two lines after try:
import os
import json
Thanks, @tadasdanielius; adding those 2 lines allowed the creation of the profiles.
Here they are:
daikin_altherma_0.json
daikin_altherma_1.json
daikin_altherma_2.json
P.S. When the LAN gateway is installed, the boiler can only function when the room thermostat is connected. If I remove the room thermostat, the boiler goes into error mode and keeps heating up the water.
Something is confusing here. Based on the profile there is nothing that could affect your device. The changes which has been made shouldn't even be triggered as your device does not have those operations
RoomTemperatureHeating
RoomTemperatureCooling
RoomTemperatureAuto
I've made some changes in the order of the conditions and the issue disappeared, ending up with this:
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up Daikin climate based on config_entry."""
api = hass.data[DOMAIN].get(entry.entry_id)
coordinator = hass.data[DOMAIN]['coordinator']
entities = []
device = api.device
climate_control = device.climate_control
if climate_control is not None:
unit = climate_control.unit
if unit is not None:
operations = unit.operations
if 'LeavingWaterTemperatureOffsetHeating' in operations or \
'LeavingWaterTemperatureOffsetCooling' in operations or \
'LeavingWaterTemperatureOffsetAuto' in operations:
entities.append(AlthermaUnitTemperatureControl(coordinator, api))
if 'RoomTemperatureHeating' in operations or \
'RoomTemperatureCooling' in operations or \
'RoomTemperatureAuto' in operations:
entities.append(RoomTemperatureOperationControl(coordinator, api))
if 'TargetTemperatureDay' in operations:
profile = operations['TargetTemperatureDay']
if type(profile) is dict:
entities.append(
GenericOperationControl(
coordinator, api, 'Target Temperature Day', 'TargetTemperatureDay', profile)
)
else:
_LOGGER.error(f'Profile (TargetTemperatureDay) is not dictionary!')
if 'TargetTemperatureNight' in operations:
profile = operations['TargetTemperatureNight']
if type(profile) is dict:
entities.append(
GenericOperationControl(
coordinator, api, 'Target Temperature Night', 'TargetTemperatureNight', profile)
)
else:
_LOGGER.error(f'Profile (TargetTemperatureNight) is not dictionary!')
But I don't really know what to make of this 'finding'. 😁
I think it was just accident problem and original version should just work as fine
I've redownloaded 1.5.0 an hour ago and the issue didn't reappear, which is strange because I've tried that multiple times in July.
So maybe the issue was actually caused by one of the previous HA versions from July and got solved with one of the 2 from August.
I'll close the issue and let you know if it comes back.