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

Invalid state for switchoff reason - lost most sensors in HA. (includes potential fix) #347

Open
nikojarvinen opened this issue Mar 9, 2025 · 2 comments

Comments

@nikojarvinen
Copy link

Hey,
I'm new to HA and everything, still building the house to get things going. Today I was in a bit of a hurry to turn off the heat pump (first time needed to do that) and I used the "switch.luxtronik_340606_050_heating". Well it turned it off allright but it was impossible to turn it back on from HA anymore. Used the myuplink app to turn it on...
At the same time I lost a large number of sensors/switches. I tried to fully remove and reinstall via HACS but that did not seem to fix.

I'm on HA 2025.3.1 and the version of luxtronik integration is 2024.9.30

Then I started digging through the debug logging and found the following error:

5-03-09 22:10:29.558 ERROR (MainThread) [custom_components.luxtronik2] Unexpected error fetching luxtronik2 data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 380, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/luxtronik2/coordinator.py", line 99, in _async_update_data self.data = await self._async_read_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/luxtronik2/coordinator.py", line 103, in _async_read_data return await self._async_read_or_write(False, None, None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/luxtronik2/coordinator.py", line 126, in _async_read_or_write self.async_set_updated_data(data) ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 515, in async_set_updated_data self.async_update_listeners() ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 178, in async_update_listeners update_callback() ~~~~~~~~~~~~~~~^^ File "/config/custom_components/luxtronik2/sensor.py", line 460, in _handle_coordinator_update self.async_write_ha_state() ~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1023, in async_write_ha_state self._async_write_ha_state() ~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1148, in _async_write_ha_state self.__async_calculate_state() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1085, in __async_calculate_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1029, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 614, in state raise ValueError( ...<2 lines>... ) ValueError: Sensor sensor.luxtronik_340606_050_switchoff_reason provides state value '26', which is not in the list of options provided

After this I added the value "26" to the const.py (row 228) and also to en.json translations to row 332.
Restart HA and everything seems to work as before.

I have no idea what that 26 actually means but seems to happen somehow. Anyways this should be relatively easy bug to squash with the above changes.

@ChrisMisker
Copy link

It's safe to run the latest beta. The beta has this fix included.

@nikojarvinen
Copy link
Author

Ahh thanks. I scrolled through the change logs but didn't catch that change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants