[json] Add a note reminding people to put json: in config to use json
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
nextbecause this is new documentation that has a matching pull-request in esphome as linked above.
or -
[X] I am merging into
currentbecause 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.rstwhen 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:
-
Comment on this pull request with the following command, replacing
COMPONENT_NAMEwith your component name in UPPER_CASE format with underscores (e.g.,BME280,SHT3X,DALLAS_TEMP):@esphomebot generate image COMPONENT_NAME -
The ESPHome bot will respond with a downloadable ZIP file containing the SVG image.
-
Extract the SVG file and place it in the
images/folder of this repository. -
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
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 componentcontent/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-
volhandling.
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.
Comment @coderabbitai help to get the list of available commands and usage tips.
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...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
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.
I don't want this to be stale.
CI fails constantly with timeouts.