Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add calibration values for BL0942 #4163

Merged
merged 3 commits into from
Sep 5, 2024
Merged

Conversation

dwmw2
Copy link
Contributor

@dwmw2 dwmw2 commented Aug 16, 2024

Description:

Related issue (if applicable): fixes

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

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 /index.rst when creating new documents for new components or cookbook.

Copy link
Contributor

coderabbitai bot commented Aug 16, 2024

Walkthrough

The recent updates significantly enhance the usability and configurability of various components within the ESPHome documentation. Key changes include the introduction of optional configuration variables, enhanced calibration instructions for sensors, and the reclassification of service terminology to actions. These modifications streamline interactions, clarify documentation, and provide users with the necessary tools to integrate and configure their devices effectively.

Changes

Files Change Summary
components/sensor/bl0942.rst Introduced new optional configuration variables: line_frequency, address, current_reference, voltage_reference, power_reference, and energy_reference. Added a detailed calibration section.
components/api.rst Replaced "services" with "actions" throughout, clarifying terminology for user-defined functionalities.
components/ble_client.rst Changed terminology from "services" to "actions" for BLE client functionalities.
components/mqtt.rst Introduced new configuration variable discover_ip for device discovery; renamed discovery to discover_ip.
components/light/index.rst Added new optional configuration option brightness_limits with parameters for controlling brightness.
components/update/index.rst Introduced new automation and action related to updates: on_update_available, update.perform, and update.is_available.
components/switch/homeassistant.rst New documentation for Home Assistant Switch platform, detailing setup via ESPHome.
components/select/lvgl.rst New documentation for LVGL Select component, including configuration examples.
components/lvgl/index.rst Comprehensive documentation for LVGL integration, covering widgets and user interface components.
components/sensor/apds9306.rst Added documentation for the APDS9306 ambient light sensor, detailing configuration and usage.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BL0942
    participant CalibrationTool

    User->>BL0942: Set configuration parameters
    BL0942->>User: Acknowledge configuration
    User->>CalibrationTool: Measure current and voltage
    CalibrationTool-->>User: Returns measured values
    User->>BL0942: Input calibration values
    BL0942->>User: Acknowledge calibration
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Aug 16, 2024

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit f72aa8f
🔍 Latest deploy log https://app.netlify.com/sites/esphome/deploys/66d8f63fd946f9000853b315
😎 Deploy Preview https://deploy-preview-4163--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 site configuration.

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.

Caution

Inline review comments failed to post

Actionable comments posted: 1

Comments failed to post (1)
components/sensor/bl0942.rst

87-87: Fix formatting issues with code-block directives.

Each code-block directive should be followed by an empty line to adhere to documentation standards.

.. code-block:: json

                {
.. code-block:: json

  {'dps': {'1': False, '9': 0, '18': 0, '19': 0, '20': 2344, '21': 1, '22': 15968, '23': 12418, '24': 3091, '25': 2653, '26': 0, '38': 'memory', '40': 'relay', '41': False, '42': ''}}
.. code-block:: yaml

    voltage_reference: 15968    # DPS 21

Also applies to: 108-108, 114-114

Tools
GitHub Check: build

[failure] 87-87:
Directive 'code-block' is not followed by an empty line. Please insert an empty line after components/sensor/bl0942.rst:87

@dwmw2 dwmw2 force-pushed the bl0942-cal branch 9 times, most recently from 640bdb7 to 8b1ed3f Compare August 16, 2024 15:28
@dwmw2 dwmw2 changed the base branch from current to next August 16, 2024 15:31
@probot-esphome probot-esphome bot added next and removed current labels Aug 16, 2024
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.

Caution

Inline review comments failed to post

Actionable comments posted: 5

Outside diff range, codebase verification and nitpick comments (14)
components/select/lvgl.rst (2)

1-2: Ensure Consistent Title Formatting.

The title "LVGL Select" should be consistently formatted across all related documentation to maintain uniformity.


8-9: Clarify Dependency on LVGL.

Consider adding a brief explanation of what LVGL is or a link to its documentation for users unfamiliar with it.

+ For more information about LVGL, see the LVGL documentation.
components/text/lvgl.rst (2)

1-2: Ensure Consistent Title Formatting.

The title "LVGL Text" should be consistently formatted across all related documentation to maintain uniformity.


8-9: Clarify Dependency on LVGL.

Consider adding a brief explanation of what LVGL is or a link to its documentation for users unfamiliar with it.

+ For more information about LVGL, see the LVGL documentation.
components/text_sensor/lvgl.rst (2)

1-2: Ensure Consistent Title Formatting.

The title "LVGL Text Sensor" should be consistently formatted across all related documentation to maintain uniformity.


8-9: Clarify Dependency on LVGL.

Consider adding a brief explanation of what LVGL is or a link to its documentation for users unfamiliar with it.

+ For more information about LVGL, see the LVGL documentation.
changelog/2024.8.0.rst (1)

24-31: Clarify LVGL Graphics Section.

The section on LVGL Graphics is informative but could benefit from a brief explanation of what LVGL stands for and its significance.

+ LVGL (Light and Versatile Graphics Library) for short, has been worked on by :ghuser:`clydebarrow` (and multiple other users doing testing and documentation etc)
components/sensor/index.rst (1)

300-318: Clarify the round_to_multiple_of filter description.

The description for the round_to_multiple_of filter is clear, but it might benefit from specifying that the multiple must be a positive non-zero float.

- Rounds the value to the nearest multiple. Takes a float greater than zero.
+ Rounds the value to the nearest specified multiple. The multiple must be a positive non-zero float.
components/mqtt.rst (2)

44-45: Clarify the discover_ip configuration variable.

The description for discover_ip is clear, but adding a note about its interaction with discovery could enhance understanding.

- If Home Assistant automatic device discovery should be enabled. Defaults to ``true``.
+ If Home Assistant automatic device discovery should be enabled. Defaults to ``true``. Note: This works in conjunction with the `discovery` setting.

145-176: Inconsistent JSON Key Descriptions Found

The JSON key project_version is described twice with different notes, which may lead to confusion. Ensure each key is uniquely described to maintain consistency across the documentation.

  • project_version is mentioned twice with different descriptions.
Analysis chain

Ensure consistency in JSON key descriptions.

The JSON key descriptions are comprehensive, but ensure consistency in formatting and terminology across the documentation.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistency in JSON key descriptions across the documentation.

# Test: Search for JSON key descriptions. Expect: Consistent formatting and terminology.
rg --type rst 'JSON keys:' -A 20

Length of output: 1615

components/modbus_controller.rst (1)

732-748: Clarify on_command_sent automation example.

The example for on_command_sent is clear, but consider adding more context about the use case to help users understand its application.

-          then:
-            - number.increment: modbus_commands
+          then:
+            # Example: Increment a counter each time a command is sent
+            - number.increment: modbus_commands
components/light/index.rst (1)

322-330: Clarify brightness_limits documentation.

The new brightness_limits configuration option is well-documented. Ensure that the descriptions for min_brightness, max_brightness, and limit_mode are clear and consistent with the rest of the documentation. Consider adding examples to illustrate usage.

components/lvgl/index.rst (1)

1-692: Ensure consistency and clarity in LVGL documentation.

The new LVGL documentation is comprehensive and well-structured. Verify that all references and links are correct and ensure consistency with existing documentation style. Consider adding more examples or diagrams to enhance understanding if needed.

index.rst (1)

Line range hint 445-984: Verify new entries for accuracy and consistency.

The new entries for components like BME68x via BSEC2, APDS9306, and LVGL widgets are well-integrated. Ensure that all descriptions are accurate and consistent with the rest of the documentation. Verify that all links and references are correct.

Comments failed to post (5)
components/sensor/lvgl.rst

8-8: Typographical error: Correct "semsor" to "sensor".

There's a typographical error in the description of the lvgl sensor platform.

- The ``lvgl`` sensor platform creates a semsor component from an LVGL widget
+ The ``lvgl`` sensor platform creates a sensor component from an LVGL widget
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.

The ``lvgl`` sensor platform creates a sensor component from an LVGL widget
components/select/lvgl.rst

30-30: Correct Typographical Error.

The word "correspponding" should be corrected to "corresponding."

-    Widget-specific actions (``lvgl.dropdown.update``, ``lvgl.roller.update``) will trigger correspponding component updates to be sent to Home Assistant.
+    Widget-specific actions (``lvgl.dropdown.update``, ``lvgl.roller.update``) will trigger corresponding component updates to be sent to Home Assistant.
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.

    Widget-specific actions (``lvgl.dropdown.update``, ``lvgl.roller.update``) will trigger corresponding component updates to be sent to Home Assistant.
components/text/lvgl.rst

29-29: Correct Typographical Error.

The word "correspponding" should be corrected to "corresponding."

-    Widget-specific actions (``lvgl.label.update``, ``lvgl.textarea.update``) will trigger correspponding component updates to be sent to Home Assistant.
+    Widget-specific actions (``lvgl.label.update``, ``lvgl.textarea.update``) will trigger corresponding component updates to be sent to Home Assistant.
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.

    Widget-specific actions (``lvgl.label.update``, ``lvgl.textarea.update``) will trigger corresponding component updates to be sent to Home Assistant.
components/text_sensor/lvgl.rst

30-30: Correct Typographical Error.

The word "correspponding" should be corrected to "corresponding."

-    Widget-specific actions (``lvgl.label.update``, ``lvgl.textarea.update``) will trigger correspponding component updates to be sent to Home Assistant.
+    Widget-specific actions (``lvgl.label.update``, ``lvgl.textarea.update``) will trigger corresponding component updates to be sent to Home Assistant.
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.

    Widget-specific actions (``lvgl.label.update``, ``lvgl.textarea.update``) will trigger corresponding component updates to be sent to Home Assistant.
components/sensor/xiaomi_ble.rst

158-158: Potential Security Issue: Generic API Key Detected.

A generic API key is detected in the configuration example. Ensure that this key is either a placeholder or properly secured to prevent unauthorized access.

Consider replacing the key with a placeholder or providing guidance on securing it.

Tools
Gitleaks

158-158: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

jesserockz
jesserockz previously approved these changes Sep 5, 2024
@jesserockz jesserockz merged commit 81f8f3d into esphome:next Sep 5, 2024
1 of 2 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants