Skip to content

Update derivative docs for a new total_increasing handling#33152

Merged
frenck merged 3 commits intohome-assistant:nextfrom
Smankusors:non-negative-derivative
Sep 23, 2024
Merged

Update derivative docs for a new total_increasing handling#33152
frenck merged 3 commits intohome-assistant:nextfrom
Smankusors:non-negative-derivative

Conversation

@Smankusors
Copy link
Contributor

@Smankusors Smankusors commented Jun 8, 2024

Proposed change

home-assistant/core#119141

I'm adding a new "Ignore negative derivative" setting to the derivative sensor.
I updated the derivative integration so that it now handles total_increasing sensor correctly. So this PR updates the relevant paragraph for that.

I also removed the link to utility meter sensor because it doesn't solve the original issue.

Type of change

  • Spelling, grammar or other readability improvements (current branch).
  • Adjusted missing or incorrect information in the current documentation (current branch).
  • Added documentation for a new integration I'm adding to Home Assistant (next branch).
  • Added documentation for a new feature I'm adding to Home Assistant (next branch).
  • Removed stale or deprecated documentation.

Additional information

Checklist

  • This PR uses the correct branch, based on one of the following:
    • I made a change to the existing documentation and used the current branch.
    • I made a change that is related to an upcoming version of Home Assistant and used the next branch.
  • The documentation follows the Home Assistant documentation standards.

Summary by CodeRabbit

  • New Features
    • Introduced a new configuration option Ignore negative derivative with a description and default value.

@home-assistant home-assistant bot added has-parent This PR has a parent PR in another repo next This PR goes into the next branch labels Jun 8, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 8, 2024

Walkthrough

Walkthrough

The updates to derivative.markdown introduce a new ignore_negative_derivative configuration option, rename the Precision option to round for clarity, and update guidance for handling sensors that reset to zero after power interruptions, emphasizing the importance of using sensors with a total_increasing state class.

Changes

File Change Summary
source/_integrations/derivative.markdown New ignore_negative_derivative option added, Precision renamed to round, guidance for handling reset sensors updated.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Sensor
    participant Derivative Integration

    User->>+Derivative Integration: Configure `ignore_negative_derivative`
    Derivative Integration-->>-User: Acknowledgement

    User->>+Sensor: Get readings
    Sensor-->>-User: Sensor Data

    User->>+Derivative Integration: Provide sensor data
    Derivative Integration->>+Sensor: Check for `total_increasing` state class
    Sensor-->>-Derivative Integration: State class verified
    
    Derivative Integration-->>Derivative Integration: Compute derivative
    alt negative derivative ignored
        Derivative Integration-->>Derivative Integration: Ignore negative values
    end
    alt round value configured
        Derivative Integration-->Derivative Integration: Round the result
    end
    Derivative Integration-->>-User: Computed derivative value
Loading

Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 2a96134 and 4f99f93.

Files selected for processing (1)
  • source/_integrations/derivative.markdown (1 hunks)
Additional context used
LanguageTool
source/_integrations/derivative.markdown

[uncategorized] ~35-~35: Did you mean: “By default,”?
Context: ... or to filter out short duration noise. By default the derivative is calculated between tw...

(BY_DEFAULT_COMMA)


[typographical] ~62-~62: This sentence does not start with an uppercase letter.
Context: ...ription: Name to use in the frontend. required: false default: source entity ID deri...

(UPPERCASE_SENTENCE_START)


[typographical] ~67-~67: This sentence does not start with an uppercase letter.
Context: ...ve value to at most N decimal places. required: false default: 3 type: integer uni...

(UPPERCASE_SENTENCE_START)


[typographical] ~72-~72: This sentence does not start with an uppercase letter.
Context: ...3), "M" (1e6), "G" (1e9), "T" (1e12). required: false default: None type: string u...

(UPPERCASE_SENTENCE_START)


[misspelling] ~76-~76: Make sure that the single character ‘s’ is correct and is not a typing error.
Context: ... of the derivative. Available units are s, min, h, d. If this parameter is set, t...

(SINGLE_CHARACTER)


[typographical] ~77-~77: This sentence does not start with an uppercase letter.
Context: ...ameter and y is the value given here. required: false default: h type: string unit...

(UPPERCASE_SENTENCE_START)


[grammar] ~81-~81: You used an adverb (‘automatically’) instead of an adjective, or a noun (‘set’) instead of another adjective.
Context: ...the derivative. This will overwrite the automatically set unit_of_measurement as explained ab...

(A_RB_NN)


[typographical] ~82-~82: This sentence does not start with an uppercase letter.
Context: ..._of_measurement** as explained above. required: false type: string time_window: de...

(UPPERCASE_SENTENCE_START)


[uncategorized] ~85-~85: Did you mean: “By default,”?
Context: ... or to filter out short duration noise. By default the derivative is calculated between tw...

(BY_DEFAULT_COMMA)


[typographical] ~86-~86: This sentence does not start with an uppercase letter.
Context: ...cutive updates without any smoothing. default: 0 required: false type: time {% en...

(UPPERCASE_SENTENCE_START)


[misspelling] ~89-~89: Possible spelling mistake found.
Context: ...lt: 0 required: false type: time {% endconfiguration %} ## Temperature example For example...

(MORFOLOGIK_RULE_EN_US)


[misspelling] ~94-~94: Possible spelling mistake found.
Context: ...might be the same (so the derivative is Δy/Δx=0 because Δy=0 !) However, the te...

(MORFOLOGIK_RULE_EN_US)


[misspelling] ~94-~94: Possible spelling mistake found.
Context: ...(so the derivative is Δy/Δx=0 because Δy=0 !) However, the temperature might ac...

(MORFOLOGIK_RULE_EN_US)


[style] ~95-~95: Consider a shorter alternative to avoid wordiness.
Context: ...e might actually be changing over time. In order to capture this, you should use a `time_wi...

(IN_ORDER_TO_PREMIUM)


[grammar] ~96-~96: “derivatives” is a plural noun. It appears that the verb form is incorrect.
Context: ...the next sensor update, the derivatives doesn't vanish to zero. An example YAML conf...

(PCT_PLURAL_NOUN_SINGULAR_VERB_AGREEMENT)

Additional comments not posted (4)
source/_integrations/derivative.markdown (4)

Line range hint 76-76: Verify the single character 's'.

Ensure that the single character 's' is correct and not a typing error.


Line range hint 89-89: Possible spelling mistake found.

Ensure that "endconfiguration" is correct and not a typing error.


Line range hint 94-94: Possible spelling mistake found.

Ensure that "Δy/Δx=0" and "Δy=0" are correct and not typing errors.


24-24: Add a comma after "By default".

Missing comma after "By default" for grammatical correctness.

- By default the derivative is calculated between two consecutive updates without any smoothing.
+ By default, the derivative is calculated between two consecutive updates without any smoothing.

Likely invalid or redundant comment.


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

@netlify
Copy link

netlify bot commented Jun 8, 2024

Deploy Preview for home-assistant-docs ready!

Name Link
🔨 Latest commit 4f99f93
🔍 Latest deploy log https://app.netlify.com/sites/home-assistant-docs/deploys/6682d128602bd40008b14b3c
😎 Deploy Preview https://deploy-preview-33152--home-assistant-docs.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.

Actionable comments posted: 1

to increase clarity of which negative I mean
in case in the future we want a ignore_negative_value...
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.

Actionable comments posted: 1

@Smankusors Smankusors changed the title Add ignore_negative docs to the derivative sensor Add ignore_negative_derivative docs to the derivative sensor Jun 9, 2024
@Smankusors Smankusors changed the title Add ignore_negative_derivative docs to the derivative sensor Update derivative docs for a new total_increasing handling Jul 1, 2024
this integration now supports handling total_increasing state class.
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.

Actionable comments posted: 0

Outside diff range comments (10)
source/_integrations/derivative.markdown (10)

Line range hint 62-62: Capitalize the first letter of the sentence.

The sentence should start with an uppercase letter.

-   required: false
+   Required: false

Line range hint 67-67: Capitalize the first letter of the sentence.

The sentence should start with an uppercase letter.

-   required: false
+   Required: false

Line range hint 72-72: Capitalize the first letter of the sentence.

The sentence should start with an uppercase letter.

-   required: false
+   Required: false

Line range hint 77-77: Capitalize the first letter of the sentence.

The sentence should start with an uppercase letter.

-   required: false
+   Required: false

Line range hint 81-81: Use 'automatically-set' instead of 'automatically set'.

Use the correct adjective form.

- the automatically set **unit_of_measurement** as explained above.
+ the automatically-set **unit_of_measurement** as explained above.

Line range hint 82-82: Capitalize the first letter of the sentence.

The sentence should start with an uppercase letter.

-   required: false
+   Required: false

Line range hint 85-85: Add a comma after "By default".

Missing comma after "By default" for grammatical correctness.

- By default the derivative is calculated between two consecutive updates without any smoothing.
+ By default, the derivative is calculated between two consecutive updates without any smoothing.

Line range hint 86-86: Capitalize the first letter of the sentence.

The sentence should start with an uppercase letter.

-   default: 0
+   Default: 0

Line range hint 95-95: Consider a shorter alternative to avoid wordiness.

Consider simplifying the phrase "In order to" to "To".

- In order to capture this, you should use a `time_window`
+ To capture this, you should use a `time_window`

Line range hint 96-96: Fix the verb agreement.

The verb form is incorrect. Use "don't" instead of "doesn't".

- the derivatives doesn't vanish to zero.
+ the derivatives don't vanish to zero.

@frenck frenck added the parent-merged The parent PR has been merged already label Sep 23, 2024
@frenck frenck merged commit 95a860c into home-assistant:next Sep 23, 2024
@home-assistant home-assistant bot removed the parent-merged The parent PR has been merged already label Sep 23, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

has-parent This PR has a parent PR in another repo next This PR goes into the next branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants