Skip to content

Add working example of Time since last boot.#6283

Open
n0tf0und wants to merge 1 commit intoesphome:currentfrom
n0tf0und:patch-1
Open

Add working example of Time since last boot.#6283
n0tf0und wants to merge 1 commit intoesphome:currentfrom
n0tf0und:patch-1

Conversation

@n0tf0und
Copy link

Description

Related issue (if applicable): fixes

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

  • esphome/esphome#

Checklist

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

  • 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 /src/content/docs/components/index.mdx 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 lower_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 /public/images/ folder of this repository.

  4. Use the image in your component's index table entry in /src/content/docs/components/index.mdx.

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

@esphomebot generate image dht22

Note: All images used in ImgTable components must be placed in /public/images/ as the component resolves them to absolute paths.

@esphome esphome bot added the current label Mar 15, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 15, 2026

Walkthrough

This PR adds a complete working configuration example for the uptime sensor in the documentation, demonstrating time-based sensor setup with Home Assistant time entity integration.

Changes

Cohort / File(s) Summary
Documentation
src/content/docs/components/sensor/uptime.mdx
Added a working example block under Configuration variables section, demonstrating time-based uptime sensor configuration with time entity, device_class, and entity_category properties.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

current

Suggested reviewers

  • nagyrobi
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add working example of Time since last boot' clearly and specifically summarizes the main change: adding a working example for the uptime sensor configuration in documentation.
Description check ✅ Passed The description is related to the changeset as it follows the standard PR template for documentation changes, indicating this is a documentation update (though minimal details are provided in the template itself).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can approve the review once all CodeRabbit's comments are resolved.

Enable the reviews.request_changes_workflow setting to automatically approve the review once all CodeRabbit's comments are resolved.

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.

🧹 Nitpick comments (1)
src/content/docs/components/sensor/uptime.mdx (1)

29-29: Add YAML language tag to the new fenced block.

Use ```yaml instead of ``` for consistent syntax highlighting and docs readability.

Proposed doc tweak
-```
+```yaml
 # Working example
 time:
   - platform: homeassistant
     id: esptime
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/docs/components/sensor/uptime.mdx` at line 29, Change the new
fenced code block that contains the lines starting with "# Working example" and
the "time:" list to include a YAML language tag by replacing the opening
backticks (```) with "```yaml" so the block reads as a YAML fenced block for
proper syntax highlighting and consistent docs readability.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/content/docs/components/sensor/uptime.mdx`:
- Line 29: Change the new fenced code block that contains the lines starting
with "# Working example" and the "time:" list to include a YAML language tag by
replacing the opening backticks (```) with "```yaml" so the block reads as a
YAML fenced block for proper syntax highlighting and consistent docs
readability.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 912a6bcf-6c46-457d-885c-1f4b82f4d8a5

📥 Commits

Reviewing files that changed from the base of the PR and between 4a35bec and be04256.

📒 Files selected for processing (1)
  • src/content/docs/components/sensor/uptime.mdx

@netlify
Copy link

netlify bot commented Mar 15, 2026

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit be04256
🔍 Latest deploy log https://app.netlify.com/projects/esphome/deploys/69b6b535fc17db0008765ae0
😎 Deploy Preview https://deploy-preview-6283--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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant