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

Fix alarm states after update to HA 2024.11.0 #31

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

karelkryda
Copy link

@karelkryda karelkryda commented Nov 7, 2024

As I described in #30, hassio apparently made a breaking change and this integration stopped reporting alarm entity states correctly. This PR fixes setting entity states, including changing deprecated parts of the code to the current one.

Changes made:

  • changed attribute _attr_state to _attr_alarm_state
  • changed STATE_ALARM_* constants to AlarmControlPanelState
  • changed unit of degrees to type UnitOfTemperature
  • replaced deprecated StrEnum with current one
  • fixed KeyError when no PGs are available
  • improved Czech translation

Fixes #30

@karelkryda karelkryda changed the title Fixed alarm states functionality after update to HA 2024.11.0 Fix alarm states after update to HA 2024.11.0 Nov 7, 2024
@karelkryda
Copy link
Author

@Pigotka, may I ask what the status is?

@Pigotka
Copy link
Owner

Pigotka commented Nov 12, 2024

@karelkryda WAiting for you to answer PR question.

@karelkryda
Copy link
Author

@Pigotka where exactly is the question?

@Pigotka
Copy link
Owner

Pigotka commented Nov 15, 2024

@karelkryda can you answer so we can move on with it?

@karelkryda
Copy link
Author

@Pigotka, As I wrote 3 days ago, I don't see any question asked anywhere.
Could you please ask me a question again?

Thank you in advance

@Pigotka
Copy link
Owner

Pigotka commented Nov 15, 2024

Very strange I mentioned you there and I can see them a few messages above here. Never mind my concerns is about backward compatibility of the integration. You started using alarm_state and I need to know from what HA version this property exists and limit the min required version.

@karelkryda
Copy link
Author

Strange, they must have gotten lost somewhere on the way.
Anyway, I looked at the commit in the hassio developer documentation and it looks like the change is effective from version 2024.11.

Hopefully it's okay this way.
Let me know if anything

@karelkryda
Copy link
Author

Btw it looks like they fix the state attr in the 2024.11.2 - see.

@jirihelmich
Copy link

Can confirm, it started working again after updating HA to 2024.11.2 and there was additional fix for Homekit bridge to deal with alarm devices with state Uknown. I was looking at the docs and everything and they documented it as backwards compatible until 2025.11, but removed the backwards compatibility immediately.

So to answer the question above, this fix requires 2024.11 and newer, but the current version of this integration without this fix is now, yet again, working until 2025.11.

@Pigotka
Copy link
Owner

Pigotka commented Nov 18, 2024

@jirihelmich thank you so much for explaining. I looked into all this and indeed they made such a strange decision. Now the alarm entity has both state and alarm_state and I'm not sure what was the motivation to this. I guess there is a possibility of typing the state using Enum now.
With regards to this I would suggest to leave this PR open for several months since it contains breaking changes and forcing users to update to latest HA to continue using this integration. After a few months I will approve it and bump min HA version for the integration to avoid problem running on older versions.

Do you agree?

@jirihelmich
Copy link

jirihelmich commented Nov 19, 2024

They simply said they would make this backwards compatible, but they forgot to actually do it.

Now that they fixed that, I’d agree, I’d either wait for this fix to be released, or, it would have to be redone to be backwards compatible as well.

@DaRockwilder187
Copy link

Hi @Pigotka, @karelkryda, @jirihelmich,

the integration doesn't work since yesterday HASS Core Update.
Is this because of the changes I made from the November issue? Did they make it backwards compatibility and now it won't work with the changed one?

Shall I open an issue?
Thanks in advance

@karelkryda
Copy link
Author

karelkryda commented Jan 4, 2025

Hi @DaRockwilder187,
I'm using all changes from this PR and mine works just fine with HASSIO 2025.1.0.

What problems are you facing?

@DaRockwilder187
Copy link

DaRockwilder187 commented Jan 4, 2025

Hi @karelkryda,
the Integration doesn't work, I guess since the HA Update last night.
The state is unkown and the integration "need attention".

here is the debug log after a reload of the integration:
2025-01-04 14:40:07.339 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Jablotron Cloud for jablotron_cloud
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 640, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/jablotron_cloud/init.py", line 46, in async_setup_entry
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2278, in async_forward_entry_setups
await integration.async_get_platforms(platforms)
File "/usr/src/homeassistant/homeassistant/loader.py", line 1185, in async_get_platforms
import_future.result()
~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1173, in async_get_platforms
platforms.update(self._load_platforms(platform_names))
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1098, in _load_platforms
platform_name: self._load_platform(platform_name)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1272, in _load_platform
cache[full_name] = self._import_platform(platform_name)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1304, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.13/importlib/init.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 1026, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/jablotron_cloud/sensor.py", line 12, in
from homeassistant.const import TEMP_CELSIUS

I also tried to deaktivate and configure the connection new, but this doesn't work either.

Can you see something from this log?

@karelkryda
Copy link
Author

I see nothing special in the log you provided, also didn't find anything in the release notes for the new 2025 release.

I would try to reinstall the integration and then open issue if it persist 🤷🏻‍♂️.

@DaRockwilder187
Copy link

hmm thats strange. I reinstalled, but doesn't work.
There are no entities after reinstallation.

I'm doing a restore to yesterdays backup, maybe this will help.

Thanks and BR

@DaRockwilder187
Copy link

@karelkryda and @Pigotka
There seems to be an issue with TEMP_CELSIUS constant in HA 2025.01.

After the change as suggested in #34 it works again.

Thanks for having a look though!

@karelkryda
Copy link
Author

Yeah I see, btw this is a change I did in this PR too, so :D
Mby we could already merge it, what do you think @Pigotka?

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

Successfully merging this pull request may close these issues.

Jablotron Cloud Entities states are not available since HA Core 2024.11
4 participants