Skip to content

Conversation

@CoMPaTech
Copy link
Member

@CoMPaTech CoMPaTech commented Jan 6, 2026

No actual changes, just sorted JSON

Summary by CodeRabbit

Release Notes

  • New Features

    • Added comprehensive device attribute translations and entity mappings for enhanced device state visibility
    • Expanded configuration options and error handling capabilities
  • Improvements

    • Reorganized setup and configuration flow for improved clarity
    • Enhanced error and status message descriptions

✏️ Tip: You can customize this high-level summary in your review settings.

@CoMPaTech CoMPaTech requested a review from a team as a code owner January 6, 2026 19:18
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

Walkthrough

Restructures Plugwise Home Assistant integration's translation and configuration schemas by migrating from nested config structures to modular top-level sections (entity, exceptions, services, options). Adds new abort messages, expands error definitions, and introduces comprehensive entity naming for device types. Creates new translation files for language support.

Changes

Cohort / File(s) Summary
Core Configuration Schema
custom_components/plugwise/strings.json
Replaced config.options and config.step.user/reconfigure with new config.abort block (already_configured, anna_with_adam, not_the_same_smile, reconfigure_successful). Expanded error set with invalid_auth, invalid_setup, network_down, network_timeout, response_error, stick_init. Added top-level options block (init/none steps) with cooling_on, homekit_emulation, refresh_interval, scan_interval. Reorganized and added extensive entity translation keys across binary_sensor, climate, number, select, sensor, switch (e.g., cooling_state, electricity_\* variants, voltage_phase_\*, domestic_hot_water_setpoint). Updated services.delete_notification description and naming.
English Translations
custom_components/plugwise/translations/en.json
Reorganized JSON structure by moving keys from nested config sections to top-level (entity, button, climate, number, select, sensor, switch, exceptions, options, services). Restructured step block with explicit reconfigure/user flow. Preserved and re-housed error messages under new layout.
Dutch Translations
custom_components/plugwise/translations/nl.json
Mirrored English restructuring: moved from nested options/step to abort/error/step layout. Added abort messages for per-device configuration. Expanded config.step with reconfigure/user entries including host/port data. Updated entity keys for binary_sensor, sensor, climate, number, select, switch with Dutch translations. Added new keys: cooling_state, dhw_temperature, voltage_phase_\*, water_pressure. Updated services.delete_notification structure.
New Translation Files
custom_components/plugwise/translations/un.json, custom_components/plugwise/un
New translation bundles providing comprehensive localization across config (abort, error, step), entity mappings (binary_sensor, climate, number, select, sensor, switch), exceptions, options, and services. Enables English text for setup steps, error messages, entity names, state representations, and service descriptions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Translations hop and skip with care,
Config keys now everywhere!
From nested depths to top-level heights,
Entity names in German, Dutch, and lights ✨
Plugwise hops along just right! 🔌

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: JSON files have been sorted to conform to core standards, which aligns with the PR objective of 'No actual changes, just sorted JSON'.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jsonsort

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI Agents
In @custom_components/plugwise/translations/nl.json:
- Around line 227-229: The translation value for the key "heating_setpoint"
contains an unintended leading space; open the translations object where
"heating_setpoint" is defined and remove the leading whitespace so the value is
"Instelling verwarmen" (ensure only the string value is changed, preserving the
key name and surrounding JSON formatting).
- Around line 60-62: Remove the stale translation key "low_battery" from the
Dutch translations file because it no longer exists in the canonical translation
sources (strings.json and en.json); locate the "low_battery" entry and delete
that object (the "name": "Batterij status" pair) so the NL file matches the
current keys, and run the i18n/translation validation to ensure no other orphan
keys remain.

In @custom_components/plugwise/translations/un:
- Around line 1-345: The translation file is using an invalid language code
("un") and lacks the required .json extension; rename the file to a valid locale
filename (for example en.json) so Home Assistant will load it, or remove it if
it duplicates the existing English translation; ensure the JSON content
(top-level keys like "config", "entity", "exceptions", "options", "services")
remains unchanged after renaming.

In @custom_components/plugwise/un:
- Around line 1-345: The file "custom_components/plugwise/un" is misplaced and
missing a .json extension; move/rename it into the translations directory (e.g.,
custom_components/plugwise/translations/un.json or translations/en.json) so Home
Assistant recognizes the JSON (contains keys like "options", "config", "entity",
"exceptions", "services"), and remove any duplicate translation file in
translations/ to avoid conflicts.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b7b804c and 868eb5b.

📒 Files selected for processing (5)
  • custom_components/plugwise/strings.json
  • custom_components/plugwise/translations/en.json
  • custom_components/plugwise/translations/nl.json
  • custom_components/plugwise/translations/un
  • custom_components/plugwise/un
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: CoMPaTech
Repo: plugwise/plugwise-beta PR: 789
File: .pre-commit-config.yaml:3-3
Timestamp: 2024-12-08T11:23:47.692Z
Learning: CoMPaTech considers Python 3.13 stable and prefers to use it in the project.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Prepare and validate pre-commit
🔇 Additional comments (2)
custom_components/plugwise/translations/en.json (1)

1-345: LGTM!

The English translation file structure is correct and consistent with strings.json. Keys are properly organized across all sections.

custom_components/plugwise/strings.json (1)

1-345: LGTM!

The source strings file structure is well-organized with consistent formatting. All translation sections are properly defined.

Comment on lines +60 to 62
"low_battery": {
"name": "Batterij status"
},
Copy link
Contributor

@coderabbitai coderabbitai bot Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Stale translation key low_battery not present in strings.json or en.json.

This low_battery key exists in the Dutch translations but is missing from both strings.json and en.json. This suggests it may be a removed or renamed entity that should be cleaned up from this file as well.

🔎 Suggested fix
       "plugwise_notification": {
         "name": "Plugwise melding"
-      },
-      "low_battery": {
-        "name": "Batterij status"
       },
       "secondary_boiler_state": {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"low_battery": {
"name": "Batterij status"
},
"plugwise_notification": {
"name": "Plugwise melding"
},
"secondary_boiler_state": {
🤖 Prompt for AI Agents
In @custom_components/plugwise/translations/nl.json around lines 60 - 62, Remove
the stale translation key "low_battery" from the Dutch translations file because
it no longer exists in the canonical translation sources (strings.json and
en.json); locate the "low_battery" entry and delete that object (the "name":
"Batterij status" pair) so the NL file matches the current keys, and run the
i18n/translation validation to ensure no other orphan keys remain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an existing binary_sensor, please add this on to strings.json.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if low_battery exists in strings.json
echo "=== Checking strings.json for low_battery ==="
cat custom_components/plugwise/strings.json | jq '.entity.binary_sensor' | grep -i "low_battery" || echo "Not found in strings.json"

echo -e "\n=== Checking en.json for low_battery ==="
cat custom_components/plugwise/translations/en.json | jq '.entity.binary_sensor' | grep -i "low_battery" || echo "Not found in en.json"

echo -e "\n=== Searching for low_battery binary_sensor in Python code ==="
rg -n "low_battery" --type=py -C2

Length of output: 926


@bouwew, you're absolutely right! I apologize for the incorrect assessment. The low_battery binary_sensor is indeed used in the codebase (defined in const.py as BATTERY_STATE) and should be present in strings.json.

Here's what needs to be added to strings.json in the entity.binary_sensor section:

"low_battery": {
  "name": "Battery status"
}

This should also be added to custom_components/plugwise/translations/en.json in the same location for consistency. Given that this PR is about JSON sorting, the key should be placed in alphabetical order within the binary_sensor section (between heating_state and plugwise_notification based on the current structure).

Would you like me to help identify the exact placement in strings.json to maintain proper alphabetical sorting?


✏️ Learnings added
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 998
File: custom_components/plugwise/translations/nl.json:60-62
Timestamp: 2026-01-07T19:13:26.648Z
Learning: The low_battery binary_sensor (defined as BATTERY_STATE in custom_components/plugwise/const.py) is a valid entity in the Plugwise integration and should be included in translation files.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Comment on lines +227 to +229
"heating_setpoint": {
"name": " Instelling verwarmen"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Leading space in translation string.

The value " Instelling verwarmen" has an unintended leading space before "Instelling".

🔎 Suggested fix
       "heating_setpoint": {
-        "name": " Instelling verwarmen"
+        "name": "Instelling verwarmen"
       },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"heating_setpoint": {
"name": " Instelling verwarmen"
},
"heating_setpoint": {
"name": "Instelling verwarmen"
},
🤖 Prompt for AI Agents
In @custom_components/plugwise/translations/nl.json around lines 227 - 229, The
translation value for the key "heating_setpoint" contains an unintended leading
space; open the translations object where "heating_setpoint" is defined and
remove the leading whitespace so the value is "Instelling verwarmen" (ensure
only the string value is changed, preserving the key name and surrounding JSON
formatting).

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 6, 2026

@CoMPaTech
Copy link
Member Author

Findings related to translation, besides the mismatches CRAI already suggests: the following should be either updated in beta OR in Core. Building a checklist starting with strings.json

  • We are missing 'data_description' for step-reconfigure
  • step-user in core has Smile ID and Smile username + also missing data_description for this data
  • Core has just Please enter as a description for the user-step?
  • Title for the user-step is set to Connect to the Smile which we already updated to product names
  • climate-plugwise-state_attributes is missing the available and selected _schemas keys, see below
     "climate": {
       "plugwise": {
         "state_attributes": {
+          "available_schemas": {
+            "name": "Available schemas"
+          },
           "preset_mode": {
...
               "vacation": "Vacation"
             }
+          },
+          "selected_schema": {
+            "name": "Selected schema"
           }
  • Core has maximum boiler temperature set to 'Maximum boiler temperature' (i.e. without setpoint)
  • Core obviously has no options :) So we can safely skip that

This also induces changes to NL: full diff (as I didn't want an endless list) is at https://gist.github.com/CoMPaTech/07bd93f1a890c45a93df07ff430f396d

  • Config/Abort:
-  "config": {
-    "abort": {
-      "already_configured": "Dit apparaat is al geconfigureerd",
-      "anna_with_adam": "Zowel Anna als Adam gedetecteerd. Voeg alleen de Adam toe, niet de Anna",
-      "not_the_same_smile": "Het ingestelde Smile ID matcht niet met het ID van het ingegeven IP adres.",
-      "reconfigure_successful": "Herconfigureren gelukt"
+    "config": {
+        "abort": {
+            "already_configured": "Dienst is al geconfigureerd",
+            "anna_with_adam": "Zowel Anna als Adam gedetecteerd. Voeg je Adam toe in plaats van je Anna",
+            "not_the_same_smile": "De geconfigureerde Smile ID komt niet overeen met de Smile ID op het gevraagde IP-adres.",
+            "reconfigure_successful": "Herconfiguratie was succesvol"
  • Errors:
-    "error": {
-      "cannot_connect": "Verbinden is mislukt",
-      "invalid_auth": "Authenticatie mislukt",
       "invalid_setup": "Voeg je Adam toe in plaats van je Anna, lees de documentatie",
       "network_down": "Plugwise Zigbee netwerk is onbereikbaar",
       "network_timeout": "Network communicatie timeout",
-      "response_error": "Ongeldige XML data, of foutmelding ontvangen van de Plugwise Adam/Smile/Stretch",
       "stick_init": "Initaliseren van USB-stick mislukt",
-      "unknown": "Onbekende fout!",
-      "unsupported": "Apparaat met onbekende firmware"
+        "error": {
+            "cannot_connect": "Kan geen verbinding maken",
+            "invalid_auth": "Ongeldige authenticatie",
+            "response_error": "Ongeldige XML-gegevens, of foutindicatie ontvangen",
+            "unknown": "Onverwachte fout",
+            "unsupported": "Apparaat met niet ondersteunde firmware"
  • As per EN strings/translation just using Poort and Smile ID + the data_descriptions. Just rough-quoting here:
+        "step": {
+            "reconfigure": {
+                "data": {
+                    "host": "IP-adres",
+                    "port": "Poort"
+                },
+                "data_description": {
+                    "port": "Standaard gebruikt je Smile poort 80, normaal gesproken hoef je dit niet te veranderen."
+                },
+                "description": "Configuratie bijwerken voor {title}."
+            },
+            "user": {
+                "data": {
+                    "host": "IP-adres",
+                    "password": "Smile ID",
+                    "port": "Poort"
+                },
+                "data_description": {
+                    "password": "De Smile ID staat op het label aan de achterkant van de Adam, Smile-T of P1.",
+                    "port": "Standaard gebruikt je Smile poort 80, normaal gesproken hoef je dit niet te veranderen.",
+                    "username": "Standaard is `smile`, of `stretch` voor de oudere Stretch."
+                },
+                "description": "Voer product in:",
+                "title": "Verbind met de Smile"
+    "entity": {
+        "binary_sensor": {
+            "compressor_state": {
+                "name": "Compressor status"
+            },
+            "cooling_enabled": {
+                "name": "Koeling ingeschakeld"
+            },
+            "cooling_state": {
+                "name": "Koelen"
+            },
+            "dhw_state": {
+                "name": "SWW status"
+            },
+            "flame_state": {
+                "name": "Vlam status"
+            },
+            "heating_state": {
+                "name": "Verwarmen"
+            },
+            "plugwise_notification": {
+                "name": "Plugwise notificatie"
+            },
+            "secondary_boiler_state": {
+                "name": "Secundaire ketelstatus"
+            }
  • SWW generic:
# DHW/SWW specific
                "name": "SWW status"
                "name": "SWW temperatuur"
                "name": "SWW instelpunt"
                "name": "SWW comfort modus"

Copy link
Contributor

@bouwew bouwew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sorting looks fine 👍

@CoMPaTech
Copy link
Member Author

Superseeded by #1000 and @bouwew's actions in Lokalise

@CoMPaTech CoMPaTech closed this Jan 11, 2026
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.

3 participants