esphome-docs icon indicating copy to clipboard operation
esphome-docs copied to clipboard

[json] Add a note reminding people to put json: in config to use json

Open ChadMatsalla opened this issue 2 months ago โ€ข 4 comments

Description:

It wasn't obvious that one should include json: in the config to parse json in a lambda.

Related issue (if applicable): fixes

Pull request in esphome with YAML changes (if applicable):

  • esphome/esphome#<esphome PR number goes here>

Checklist:

  • [ ] I am merging into next because this is new documentation that has a matching pull-request in esphome as linked above.
    or

  • [X] I am merging into current because this is a fix, change and/or adjustment in the current documentation and is not for a new component or feature.

  • [ ] Link added in /components/index.rst when creating new documents for new components or cookbook.

New Component Images

If you are adding a new component to ESPHome, you can automatically generate a standardized black and white component name image for the documentation.

To generate a component image:

  1. Comment on this pull request with the following command, replacing COMPONENT_NAME with your component name in UPPER_CASE format with underscores (e.g., BME280, SHT3X, DALLAS_TEMP):

    @esphomebot generate image COMPONENT_NAME
    
  2. The ESPHome bot will respond with a downloadable ZIP file containing the SVG image.

  3. Extract the SVG file and place it in the images/ folder of this repository.

  4. Use the image in your component's index table entry in /components/index.rst.

Example: For a component called "DHT22 Temperature Sensor", use:

@esphomebot generate image DHT22

ChadMatsalla avatar Sep 24 '25 15:09 ChadMatsalla

Walkthrough

Updated the JSON component documentation: added a root-config requirement note, expanded the Parsing JSON example with payload {"status":"play","vol":"42","mute":"0"} and a template/number extraction snippet that handles missing keys, and changed See Also links to display-name + path pairs.

Changes

Cohort / File(s) Summary
Docs: JSON component
content/components/json.md
Added note that the json component must be declared in the root config; replaced Parsing JSON payload with {"status":"play","vol":"42","mute":"0"}, added a template/number extraction snippet showing handling for a missing vol key; updated See Also entries to use display-name + path pairs (HTTP Request, json_util.h).

Estimated code review effort

๐ŸŽฏ 2 (Simple) | โฑ๏ธ ~10 minutes

Possibly related PRs

  • esphome/esphome-docs#4349 โ€” Parallel documentation update with the same JSON parsing example and missing-vol handling.

Suggested reviewers

  • jesserockz

Pre-merge checks and finishing touches

โœ… Passed checks (3 passed)
Check name Status Explanation
Description Check โœ… Passed The description explains that the pull request adds documentation clarifying the need to include json: in the ESPHome configuration to parse JSON in a lambda and includes relevant checklist and context, which aligns with the actual changes made.
Docstring Coverage โœ… Passed No functions found in the changes. Docstring coverage check skipped.
Title Check โœ… Passed The title succinctly indicates the addition of a documentation note reminding users to include the json: component in their root configuration. It clearly focuses on the main change and references the affected component. This ensures a teammate scanning history immediately understands the purpose of the update.
โœจ Finishing touches
  • [ ] ๐Ÿ“ Generate Docstrings
๐Ÿงช Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

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.

coderabbitai[bot] avatar Sep 24 '25 15:09 coderabbitai[bot]

Deploy Preview for esphome ready!

Name Link
Latest commit 552562d557664202bfa6971bbd181c09dbd6d0d6
Latest deploy log https://app.netlify.com/projects/esphome/deploys/69441913aa8ca700086d1477
Deploy Preview https://deploy-preview-5397--esphome.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Sep 24 '25 15:09 netlify[bot]

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

github-actions[bot] avatar Dec 06 '25 02:12 github-actions[bot]

I don't want this to be stale.

ChadMatsallaNRC avatar Dec 11 '25 14:12 ChadMatsallaNRC

CI fails constantly with timeouts.

ChadMatsalla avatar Dec 18 '25 15:12 ChadMatsalla