Skip to content

fix: update JSON path syntax in binary_sensor and sensor modules#384

Merged
geertmeersman merged 2 commits into
mainfrom
dev-current
Jul 2, 2026
Merged

fix: update JSON path syntax in binary_sensor and sensor modules#384
geertmeersman merged 2 commits into
mainfrom
dev-current

Conversation

@geertmeersman

@geertmeersman geertmeersman commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes
    • Improved support for sensor, switch, and binary sensor data that comes from lists, so indexed values are now detected and displayed more reliably.
    • Fixed path handling for mower error, timer, and battery information to use the correct array item format.
    • Preserved GPS tracking details while keeping device attributes unchanged.

@github-actions github-actions Bot added the patch A change requiring a patch version bump label Jul 2, 2026
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3f00a476-ac98-489b-84a9-a42e9a24bf0e

📥 Commits

Reviewing files that changed from the base of the PR and between c672611 and 329a092.

📒 Files selected for processing (6)
  • custom_components/robonect/binary_sensor.py
  • custom_components/robonect/definitions.py
  • custom_components/robonect/device_tracker.py
  • custom_components/robonect/lawn_mower.py
  • custom_components/robonect/sensor.py
  • custom_components/robonect/utils.py

📝 Walkthrough

Walkthrough

This PR changes JSON path array indexing notation from dot-based (e.g. .0) to bracket-based (e.g. [0]) in entity definitions and in the runtime code that builds indexed sensor/binary_sensor entities. It also reorders some imports and reformats a return expression in device_tracker.py.

Changes

Bracket-Index Notation Migration

Layer / File(s) Summary
Entity description path updates
custom_components/robonect/definitions.py
Error, timer, and battery sensor/switch descriptions updated to use bracket indexing (e.g. errors[0], timer[0], batteries[0]) instead of dot indexing.
Sensor array-index entity creation
custom_components/robonect/sensor.py
Loop constructing per-index sensor entities now replaces "[0]" placeholders instead of ".0" in rest/rest_attrs; utility imports reordered.
Binary sensor array-index entity creation
custom_components/robonect/binary_sensor.py
Loop constructing per-index binary sensor entities updated to replace "[0]" placeholders instead of ".0" in rest_attrs and key.
Import reordering and formatting
custom_components/robonect/lawn_mower.py, custom_components/robonect/utils.py, custom_components/robonect/device_tracker.py
Import statement ordering adjusted in lawn_mower.py and utils.py; device_tracker.py's extra_state_attributes merge expression reformatted to multi-line without behavior change.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: updating JSON path syntax in the binary_sensor and sensor modules.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-current

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.

@geertmeersman geertmeersman merged commit 5d59f39 into main Jul 2, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch A change requiring a patch version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant