fix: get_plugin_config() is synchronous in all AppDaemon >= 4.5.0#201
fix: get_plugin_config() is synchronous in all AppDaemon >= 4.5.0#201
Conversation
The upper bound `< (4, 5, 3)` assumed that AppDaemon would restore the
async variant of get_plugin_config() in 4.5.3, but it has remained
synchronous in every release from 4.5.0 onwards.
Any AppDaemon version >= 4.5.3 (e.g. 4.5.12, shipped with HA add-on
v0.17.12) hit the else branch and called:
mqtt_plugin_cfg = await self.get_plugin_config(namespace=...)
Awaiting a plain (non-awaitable) return value raises a TypeError,
crashing the gateway during initialize() and preventing the IQ panel
integration from starting.
Fix by removing the upper bound so all AD >= 4.5.0 is treated as sync.
Fixes xaf#197
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@roopesh I thought the change was already merged to revert in 4.5.3 at the time I patched this - did they revert the change? Also, I think you'll need to fix the tests for this to work. |
|
I guess so? I know I had been unable to update AppDaemon for a long time. I finally asked Claude to figure it out and this is what they came up with - and I was able to update AppDaemon finally. Are you on the latest AppDaemon? |
|
I am on 4.5.13 and it seems to be working fine: |
|
Hm I'm on the HA App of AppDaemon, which is 0.18.1, which seems to be AppDaemon 4.5.13 as well. 🤷🏽♂️. Are you running AppDaemon standalone or another image? |
|
I am running the I just quickly checked: This function is still |
|
I have no idea why this works for me 🤷🏽♂️ - i had rolled back AppDaemon at least 3x because it kept breaking on me. Oh well! I'll pull the PR back. |
|
@roopesh the other surprising aspect is that your fix also does not touch the part about the Add-On version, so it means your change is actually a no-op for you since you only touch the standalone appdaemon version, not the add-on one! |
Problem
gateway.pyhas a version-guard that decides whether toawaitget_plugin_config()or call it synchronously:The upper bound
< (4, 5, 3)was written with the assumption that AppDaemon would restore the async variant in 4.5.3. That never happened —get_plugin_config()has remained synchronous in every release from 4.5.0 onwards.As a result, any AppDaemon version >= 4.5.3 (e.g. 4.5.12, shipped with HA add-on v0.17.12) hits the
elsebranch and calls:await-ing a plain (non-awaitable) return value raises aTypeError, crashing the gateway duringinitialize()and preventing the IQ panel integration from ever starting. This is the root cause of the failures reported in #197.Fix
Remove the upper bound so that all AppDaemon >= 4.5.0 is treated as synchronous:
Tested
Verified on HA add-on v0.17.12 (AppDaemon 4.5.12): gateway initializes successfully, connects to the IQ Panel, and entities are published via MQTT discovery as expected.
Fixes #197