Checklist
What version of Home Assistant Core?
2026.4
Describe the issue
Bug: KeyError: 'domain' when adding integration
Description
Adding the Panasonic CC integration fails with KeyError: 'domain' in config_flow.py at line 49. The code attempts to access entry.data[KEY_DOMAIN] using direct dictionary indexing, but the domain key does not exist inside entry.data — it is a top-level attribute of the config entry, not part of the data payload.
Steps to Reproduce
- Open Home Assistant
- Go to Settings → Integrations → Add Integration
- Search for and select Panasonic CC
- Enter Comfort Cloud credentials and submit
- Integration fails with "Unknown error"
Error
File "/config/custom_components/panasonic_cc/config_flow.py", line 49, in _create_entry
if entry.data[KEY_DOMAIN] == PANASONIC_DOMAIN:
~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'domain'
Root Cause
config_flow.py line 49 uses entry.data[KEY_DOMAIN] which raises KeyError because the domain key is not present in entry.data. The fix is to use .get() instead:
# Before (broken)
if entry.data[KEY_DOMAIN] == PANASONIC_DOMAIN:
# After (fixed)
if entry.data.get(KEY_DOMAIN) == PANASONIC_DOMAIN:
Temporary Workaround (via SSH terminal)
Until this is fixed in a release, the patch can be applied manually via the Home Assistant SSH terminal:
1. Patch the file:
nano /config/custom_components/panasonic_cc/config_flow.py
Go to line 49 (Ctrl+_ → type 49 → Enter) and change:
if entry.data[KEY_DOMAIN] == PANASONIC_DOMAIN:
to:
if entry.data.get(KEY_DOMAIN) == PANASONIC_DOMAIN:
Save with Ctrl+X → Y → Enter.
2. Clear the Python cache (required or the fix won't take effect):
rm -rf /config/custom_components/panasonic_cc/__pycache__
3. Restart Home Assistant:
4. Re-add the integration:
Settings → Integrations → + Add Integration → Panasonic CC
Environment
- Home Assistant version: 2026.4
- Panasonic CC version: (installed via HACS)
- Device: Panasonic CS-HZ25ZKE
- Comfort Cloud API: connecting successfully (API login and device list confirmed working in logs)
Additional Notes
The Comfort Cloud API connection itself works fine — device data is retrieved successfully in the logs before the error occurs. The bug is purely in the config flow duplicate-entry check.
Error/Debug Logs
Checklist
What version of Home Assistant Core?
2026.4
Describe the issue
Bug: KeyError: 'domain' when adding integration
Description
Adding the Panasonic CC integration fails with
KeyError: 'domain'inconfig_flow.pyat line 49. The code attempts to accessentry.data[KEY_DOMAIN]using direct dictionary indexing, but thedomainkey does not exist insideentry.data— it is a top-level attribute of the config entry, not part of the data payload.Steps to Reproduce
Error
Root Cause
config_flow.pyline 49 usesentry.data[KEY_DOMAIN]which raisesKeyErrorbecause thedomainkey is not present inentry.data. The fix is to use.get()instead:Temporary Workaround (via SSH terminal)
Until this is fixed in a release, the patch can be applied manually via the Home Assistant SSH terminal:
1. Patch the file:
Go to line 49 (
Ctrl+_→ type49→ Enter) and change:to:
Save with
Ctrl+X→Y→ Enter.2. Clear the Python cache (required or the fix won't take effect):
3. Restart Home Assistant:
4. Re-add the integration:
Settings → Integrations → + Add Integration → Panasonic CC
Environment
Additional Notes
The Comfort Cloud API connection itself works fine — device data is retrieved successfully in the logs before the error occurs. The bug is purely in the config flow duplicate-entry check.
Error/Debug Logs