Skip to content

fix(sensor): Add safe guards for missing coordinator data in KACO integration#20

Open
MIKOLAJW197 wants to merge 1 commit intoKoljaWindeler:masterfrom
MIKOLAJW197:master
Open

fix(sensor): Add safe guards for missing coordinator data in KACO integration#20
MIKOLAJW197 wants to merge 1 commit intoKoljaWindeler:masterfrom
MIKOLAJW197:master

Conversation

@MIKOLAJW197
Copy link

Issue

Custom KACO integration crashes when coordinator.data["extra"] is None.
This caused sensors not to be added and TypeError exceptions in the logs.

Solution

  • Added safe access to extra data in unique_id and device_info.
  • Provided fallback values for serialno and model to prevent crashes.
  • Sensors will now load even if the API response is incomplete or missing extra.

Tests

  • Verified sensors are created with fallback values.
  • No errors in logs when extra is missing.

@KoljaWindeler
Copy link
Owner

KoljaWindeler commented Dec 17, 2025

Hi, thanks for your work, I see the same behavior that the entity is not getting loaded when no data are received and always wanted to fix this.
Testing your changes leads to multiple entities (one with serial nr and one without for me) do you see the same?
image

@MIKOLAJW197
Copy link
Author

For me with this code I am seeing one entity
But if there is an issue on your end, I may rethink the solution

image

@KoljaWindeler
Copy link
Owner

I'll also spend some time today and playaround with chatgpt :D

@KoljaWindeler
Copy link
Owner

I've played around some time and chatGPT suggested to do many many changes .. honestly .. I've only tested the result .. once with disconnected inverter and once with .. both worked fine .. so this is at least better :)

@MIKOLAJW197
Copy link
Author

MIKOLAJW197 commented Dec 17, 2025

@KoljaWindeler You messed something up :D
now in new version config-flow for edit don't work
image

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.

2 participants