Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bayesian Config Flow #35705

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

Open
wants to merge 12 commits into
base: next
Choose a base branch
from
Open

Bayesian Config Flow #35705

wants to merge 12 commits into from

Conversation

HarvsG
Copy link
Contributor

@HarvsG HarvsG commented Nov 11, 2024

Proposed change

  1. Adds config flow to configuration
  2. Improves documentation clarity

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

  • Link to parent pull request in the codebase: Baysesian Config Flow core#122552
  • Link to parent pull request in the Brands repository:
  • This PR fixes or closes issue: fixes #

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

  • Documentation
    • Revised and enhanced documentation for the Bayesian binary sensor platform for improved clarity and detail.
    • Expanded explanations of Bayes' rule and its application in sensor state determination with new illustrative examples.
    • Updated configuration instructions and examples, including new terminology and practical tips for effective setup.
    • Added a new section with guidelines on estimating probabilities using Home Assistant history.
    • Improved structure and readability for easier navigation and understanding.

@home-assistant home-assistant bot added has-parent This PR has a parent PR in a other repo next This PR goes into the next branch labels Nov 11, 2024
Copy link

netlify bot commented Nov 11, 2024

Deploy Preview for home-assistant-docs ready!

Name Link
🔨 Latest commit a1a7214
🔍 Latest deploy log https://app.netlify.com/projects/home-assistant-docs/deploys/6848bc8557640f00087cb2e5
😎 Deploy Preview https://deploy-preview-35705--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 project configuration.

Copy link
Contributor

coderabbitai bot commented Nov 11, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The documentation for the bayesian binary sensor platform has been revised to clarify its function as a virtual binary sensor combining multiple sensors probabilistically. The theory section was expanded with clearer explanations and examples, configuration instructions were updated with clearer terminology and added config flow snippets, and guidance on estimating probabilities was reorganized and enhanced. Minor wording and formatting improvements were also applied.

Changes

File Change Summary
source/_integrations/bayesian.markdown Revised documentation clarifying sensor concept, expanded theory section with examples, updated configuration details including config flow snippet, refined terminology, reorganized probability estimation guidance, and minor wording/formatting improvements.

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
🪧 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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 or @coderabbitai title 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
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 and nitpick comments (5)
source/_integrations/bayesian.markdown (5)

26-26: Consider enhancing the UI vs YAML format explanation

To prevent potential user confusion, consider expanding this line to be more explicit about the format differences:

-Both UI and YAML setup is supported, importantly YAML uses probabilities of `0` to `1` whereas UI uses percentages.
+Both UI and YAML setup is supported. Important note on probability formats:
+- YAML configuration: Use decimal values between `0` and `1` (e.g., `0.5` for 50%)
+- UI configuration: Use percentage values between `0` and `100` (e.g., `50` for 50%)

61-62: Minor improvement in prior description

To improve clarity and conciseness:

-     The baseline probability of the event (0 to 1). At any point in time
-     (ignoring all external influences) how likely is this event to be occurring?
+     The baseline probability of the event (0 to 1). At any time
+     (ignoring all external influences) how likely is this event to be occurring?
🧰 Tools
🪛 LanguageTool

[style] ~61-~61: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


69-69: Add comma for better readability

Add a comma after the conditional clause:

-    Note: If the threshold is higher than the `prior` then the default state will be `off`
+    Note: If the threshold is higher than the `prior`, then the default state will be `off`
🧰 Tools
🪛 LanguageTool

[typographical] ~69-~69: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


130-130: Fix hyphenation and consider adding validation guidance

  1. Fix the hyphenation:
-If your Bayesian sensor ends up triggering `on` too easily, re-check that the probabilities set and estimated make sense, then consider increasing `probability_threshold:` and vice-versa.
+If your Bayesian sensor ends up triggering `on` too easily, re-check that the probabilities set and estimated make sense, then consider increasing `probability_threshold:` and vice versa.
  1. Consider adding a note about validating probabilities:
+7. Validate your probabilities: For each observation, ensure that `prob_given_true` is significantly different from `prob_given_false` to make the observation meaningful. If they're too close, the observation might not contribute meaningfully to the final probability.
🧰 Tools
🪛 LanguageTool

[grammar] ~130-~130: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)


224-224: Clarify range boundary behavior

The explanation about range boundaries could be clearer:

-When more than one range is specified for the same entity, if a value falls on `below`, it will be included with the range that lists it in `below`. `below` then means "below or equal to". This is not true when only a single range is specified, where both `above` and `below` do not include "equal to".
+Range boundary behavior differs based on configuration:
+- Multiple ranges for same entity:
+  - `below: X` means "less than or equal to X"
+  - A value exactly equal to X belongs to the range that specifies it in `below`
+- Single range:
+  - Both `above` and `below` are exclusive (not including the boundary values)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 8ceb866 and e3361a3.

📒 Files selected for processing (1)
  • source/_integrations/bayesian.markdown (4 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/bayesian.markdown

[style] ~61-~61: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


[typographical] ~69-~69: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


[grammar] ~130-~130: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)

🔇 Additional comments (1)
source/_integrations/bayesian.markdown (1)

Line range hint 1-224: Documentation is comprehensive and well-structured

The documentation effectively explains the Bayesian integration, provides clear configuration guidance, and includes practical examples. The theory section is particularly well-written, making complex concepts accessible to users.

🧰 Tools
🪛 LanguageTool

[grammar] ~130-~130: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)

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 and nitpick comments (3)
source/_integrations/bayesian.markdown (3)

32-36: Fix minor grammatical issues in the theory section

While the content is excellent, there are a few grammatical issues to address:

Apply these corrections:

-However the probability that motion is detected
+However, the probability that motion is detected
-popular with the cats. However the probability
+popular with the cats. However, the probability
-(e.g 95%, p = 0.95)
+(e.g., 95%, p = 0.95)
-(e.g motion detected)
+(e.g., motion detected)
-(e.g human-occupancy of the room)
+(e.g., human-occupancy of the room)
🧰 Tools
🪛 LanguageTool

[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). ## Confi...

(E_G)


63-71: Improve clarity of probability descriptions and fix grammar

The descriptions are good but could be more precise:

Apply these improvements:

-At any point in time
+(ignoring all external influences) how likely is this event to be occurring?
-if the threshold is higher than the `prior` then
+if the threshold is higher than the `prior`, then

Also, consider adding a note about the relationship between prior and probability_threshold:
"Setting probability_threshold close to prior will make the sensor more sensitive to changes in observations."

🧰 Tools
🪛 LanguageTool

[style] ~63-~63: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


[typographical] ~71-~71: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


123-133: LGTM! Excellent practical guidance for probability estimation

The guidance is clear and practical, especially the tip about using Home Assistant history to estimate probabilities.

One minor fix needed:

-vice-versa
+vice versa
🧰 Tools
🪛 LanguageTool

[grammar] ~132-~132: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e3361a3 and 350b39f.

📒 Files selected for processing (1)
  • source/_integrations/bayesian.markdown (4 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/bayesian.markdown

[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). ## Confi...

(E_G)


[style] ~63-~63: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


[typographical] ~71-~71: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


[grammar] ~132-~132: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)

🔇 Additional comments (3)
source/_integrations/bayesian.markdown (3)

22-26: LGTM! Clear and practical introduction

The introduction effectively explains what a Bayesian sensor is and provides practical use cases that users can relate to.


226-226: LGTM! Clear explanation of range behavior

The explanation of how ranges work with multiple states is precise and helpful for users.


Line range hint 22-226: Overall excellent documentation improvements

The documentation is now more comprehensive, clearer, and more practical. Key strengths:

  1. Clear explanation of the theory with relatable examples
  2. Practical guidance for estimating probabilities
  3. Well-documented examples with realistic scenarios
  4. Thorough explanation of multiple state handling

The changes align perfectly with the PR objective of improving the documentation for Bayesian features.

🧰 Tools
🪛 LanguageTool

[grammar] ~132-~132: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)

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

🧹 Nitpick comments (8)
source/_integrations/bayesian.markdown (8)

22-28: Grammar and clarity: pluralize “setup” and refine punctuation
The sentence uses singular “setup” for two items and runs clauses together. Consider pluralizing “setup” and adding proper punctuation for readability.

-Both UI and YAML setup is supported, importantly YAML uses probabilities of `0` to `1` whereas UI uses percentages.
+Both UI and YAML setups are supported; importantly, YAML uses probabilities from 0 to 1, while the UI uses percentages.

32-36: Theory section: fix commas and e.g. formatting
Add missing commas after introductory clauses and ensure “e.g.” is punctuated correctly. Also clarify “motion detected” and remove unnecessary words.

-Now consider the above but in a home that has cats. The probability that the room is human-occupied *given* that motion detected may be quite low (e.g. 20%, p=0.2) if the room is popular with the cats. However the probability that motion is detected *given* that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is accurate.
+Now consider the above, but in a home that has cats. The probability that the room is human-occupied *given* that motion is detected may be quite low (e.g., 20%, p=0.2) if the room is popular with cats. However, the probability that motion is detected *given* that it is occupied by a human is high (e.g., 95%, p=0.95) if our motion sensor is accurate.

-When configuring these conditional probabilities define the probability of the sensor observation (e.g motion detected) *given* the thing you are trying to estimate (e.g human-occupancy of the room).
+When configuring these conditional probabilities, define the probability of the sensor observation (e.g., motion detected) *given* the thing you are trying to estimate (e.g., human occupancy of the room).
🧰 Tools
🪛 LanguageTool

[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


[uncategorized] ~36-~36: Possible missing comma found.
Context: ...ve. When configuring these conditional probabilities define the probability of the sensor ob...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). {% inclu...

(E_G)


61-62: Combine and punctuate description for prior
Merge the two lines into a single sentence and add commas for better flow.

-    The baseline probability of the event (0 to 1). At any point in time
-    (ignoring all external influences) how likely is this event to be occurring?
+    The baseline probability of the event (0 to 1): at any point in time (ignoring all external influences), how likely is this event to be occurring?
🧰 Tools
🪛 LanguageTool

[style] ~61-~61: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


69-69: Add comma in note under probability_threshold
Insert a comma and terminal period for correct punctuation.

-    Note: If the threshold is higher than the `prior` then the default state will be `off`
+    Note: If the threshold is higher than the `prior`, the default state will be `off`.
🧰 Tools
🪛 LanguageTool

[typographical] ~69-~69: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


112-112: Clarify prob_given_true description
Add “that” for grammatical correctness and capitalize “Bayesian”.

-        Assuming the bayesian binary_sensor is `on`, the probability the entity state is occurring.
+        Assuming the Bayesian binary_sensor is `on`, the probability that the entity state is occurring.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~112-~112: Possible missing preposition found.
Context: ... binary_sensor is on, the probability the entity state is occurring. requir...

(AI_HYDRA_LEO_MISSING_OF)


116-116: Clarify prob_given_false description
Add missing comma after “off” and include “that” for alignment with other descriptions.

-      description: Assuming the bayesian binary_sensor is `off` the probability the entity state is occurring.
+      description: Assuming the Bayesian binary_sensor is `off`, the probability that the entity state is occurring.

121-130: Consistent list formatting in “Estimating probabilities”

  • Change bullet 2 to use a comma instead of a period.
  • Remove hyphen in “vice versa”.
-2. When using `0.99` and `0.001`. The number of `9`s and `0`s matters.
+2. When using `0.99` and `0.001`, note that the number of `9`s and `0`s matters.
...
-6. If your Bayesian sensor ends up triggering `on` too easily, re-check that the probabilities set and estimated make sense, then consider increasing `probability_threshold:` and vice-versa.
+6. If your Bayesian sensor ends up triggering `on` too easily, re-check that the probabilities set and estimated make sense, then consider increasing `probability_threshold:` and vice versa.
🧰 Tools
🪛 LanguageTool

[grammar] ~130-~130: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)


224-224: Clarify range inclusion rules
Rephrase for clarity and add transition word for readability.

-When more than one range is specified for the same entity, if a value falls on `below`, it will be included with the range that lists it in `below`. `below` then means 'below or equal to'. This is not true when only a single range is specified, where both `above` and `below` do not include 'equal to'.
+When more than one range is specified for the same entity, if a value falls on `below`, it will be included with the range that lists it in `below` (i.e., 'below or equal to'). However, when only a single range is specified, both `above` and `below` do not include 'equal to'.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 350b39f and 8d3b4ff.

📒 Files selected for processing (1)
  • source/_integrations/bayesian.markdown (4 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/bayesian.markdown

[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


[uncategorized] ~36-~36: Possible missing comma found.
Context: ...ve. When configuring these conditional probabilities define the probability of the sensor ob...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). {% inclu...

(E_G)


[style] ~61-~61: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


[typographical] ~69-~69: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


[uncategorized] ~112-~112: Possible missing preposition found.
Context: ... binary_sensor is on, the probability the entity state is occurring. requir...

(AI_HYDRA_LEO_MISSING_OF)


[grammar] ~130-~130: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)

🔇 Additional comments (2)
source/_integrations/bayesian.markdown (2)

38-38: Include config flow snippet
The {% include integrations/config_flow.md %} directive correctly injects the config flow example.


107-107: Value template description clarity
The description is clear and concise. No changes needed.

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

🧹 Nitpick comments (6)
source/_integrations/bayesian.markdown (6)

34-34: Fix punctuation and e.g. formatting
Add missing comma after “However” and standardize “e.g.,” formatting for consistency.

- ...cats). However the probability that motion is detected *given* it is occupied by a human is high (e.g 95%, p = 0.95)...
+ ...cats). However, the probability that motion is detected *given* it is occupied by a human is high (e.g., 95%, p = 0.95)...
🧰 Tools
🪛 LanguageTool

[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


36-36: Improve introductory clause and e.g. syntax
Insert a comma after the introductory phrase and update “e.g.” punctuation.

- When configuring these conditional probabilities define the probability of the sensor observation (e.g motion detected) *given* the thing you are trying to estimate (e.g human-occupancy of the room).
+ When configuring these conditional probabilities, define the probability of the sensor observation (e.g., motion detected) *given* the thing you are trying to estimate (e.g., human-occupancy of the room).
🧰 Tools
🪛 LanguageTool

[uncategorized] ~36-~36: A comma might be missing here.
Context: ...ve. When configuring these conditional probabilities define the probability of the sensor ob...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). {% inclu...

(E_G)


61-62: Remove redundant phrase
“At any point in time” can be shortened to “At any point” to improve readability.

- At any point in time (ignoring all external influences) how likely is this event to be occurring?
+ At any point (ignoring all external influences) how likely is this event to be occurring?
🧰 Tools
🪛 LanguageTool

[style] ~61-~61: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


[uncategorized] ~62-~62: This verb may not be in the correct tense. Consider changing the tense to fit the context better.
Context: ...influences) how likely is this event to be occurring? required: true type: float probabi...

(AI_EN_LECTOR_REPLACEMENT_VERB_TENSE)


67-69: Fix sentence casing and punctuation
Capitalize the second line, add missing periods, and insert a comma in the Note.

- use higher values to reduce false positives (and increase false negatives)
+ Use higher values to reduce false positives (and increase false negatives).

- Note: If the threshold is higher than the `prior` then the default state will be `off`
+ Note: If the threshold is higher than the `prior`, then the default state will be `off`.
🧰 Tools
🪛 LanguageTool

[typographical] ~69-~69: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


112-112: Clarify prob_given_true description
Consider rewording for parallel structure, e.g.:
“The probability that the entity state is occurring given the Bayesian sensor is on.”

- Assuming the bayesian binary_sensor is `on`, the probability the entity state is occurring.
+ The probability that the entity state is occurring given the Bayesian sensor is `on`.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~112-~112: Possible missing preposition found.
Context: ... binary_sensor is on, the probability the entity state is occurring. requir...

(AI_HYDRA_LEO_MISSING_OF)


116-116: Add missing comma after “off”
Insert a comma after the introductory clause for clarity.

- Assuming the bayesian binary_sensor is `off` the probability the entity state is occurring.
+ Assuming the bayesian binary_sensor is `off`, the probability the entity state is occurring.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 8d3b4ff and eae5093.

📒 Files selected for processing (1)
  • source/_integrations/bayesian.markdown (3 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/bayesian.markdown

[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


[uncategorized] ~36-~36: A comma might be missing here.
Context: ...ve. When configuring these conditional probabilities define the probability of the sensor ob...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). {% inclu...

(E_G)


[style] ~61-~61: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


[uncategorized] ~62-~62: This verb may not be in the correct tense. Consider changing the tense to fit the context better.
Context: ...influences) how likely is this event to be occurring? required: true type: float probabi...

(AI_EN_LECTOR_REPLACEMENT_VERB_TENSE)


[typographical] ~69-~69: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


[uncategorized] ~112-~112: Possible missing preposition found.
Context: ... binary_sensor is on, the probability the entity state is occurring. requir...

(AI_HYDRA_LEO_MISSING_OF)


[uncategorized] ~129-~129: A comma might be missing here.
Context: ... as you can, if your behavior is not as expected consider adding more sensors or see #6....

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[grammar] ~130-~130: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - home-assistant-docs
  • GitHub Check: Header rules - home-assistant-docs
  • GitHub Check: Pages changed - home-assistant-docs
🔇 Additional comments (11)
source/_integrations/bayesian.markdown (11)

22-22: Approve updated introduction
The new description clearly defines the bayesian helper as a virtual binary sensor using probabilistic methods.


24-24: Approve expanded use cases
Listing complex events and unreliable sensors adds valuable context for users.


26-26: Approve Bayes’ rule explanation
The description of prior and posterior probabilities is clear and concise.


28-28: Approve UI vs YAML note
Clarifying the difference between UI percentages and YAML decimals is helpful.


32-32: Approve theory section intro
The distinction between event-given-observation and vice versa is well stated.


38-38: Verify config_flow include path
Ensure integrations/config_flow.md exists and is correctly referenced in this integration.


47-49: Approve YAML example metadata
The sample shows correct usage of name, prior, and probability_threshold.


51-53: Approve observation example snippet
Entity-ID and probability mappings are clear and correctly formatted.


107-107: Approve template description
The guidance on value_template outputting True or False is clear.


121-131: Approve “Estimating probabilities” section
This numbered guidance is thorough and provides clear best practices.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~129-~129: A comma might be missing here.
Context: ... as you can, if your behavior is not as expected consider adding more sensors or see #6....

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[grammar] ~130-~130: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)


224-224: Approve multi-range behavior clarification
The note on how below is interpreted with multiple ranges is precise and helpful.

The  integration pages are hard to find for helpers
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

🧹 Nitpick comments (4)
source/_integrations/bayesian.markdown (4)

34-36: Punctuation and abbreviation corrections in Theory section
Fix missing commas and standardize 'e.g.' usage for clarity.

- Now consider the above but in a home that has cats. The probability that the room is human-occupied *given* that motion detected may be quite low (e.g 20%, p=0.2)...
+ Now consider the above but in a home that has cats. The probability that the room is human-occupied *given* that motion is detected may be quite low (e.g. 20%, p = 0.2)...

- However the probability that motion is detected *given* that it is occupied by a human is high (e.g 95%, p = 0.95)...
+ However, the probability that motion is detected *given* that it is occupied by a human is high (e.g. 95%, p = 0.95)...

- When configuring these conditional probabilities define the probability of the sensor observation (e.g motion detected) *given* the thing you are trying to estimate (e.g human-occupancy of the room).
+ When configuring these conditional probabilities, define the probability of the sensor observation (e.g. motion detected) *given* the thing you are trying to estimate (e.g. human-occupancy of the room).
🧰 Tools
🪛 LanguageTool

[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


[uncategorized] ~36-~36: Possible missing comma found.
Context: ...ve. When configuring these conditional probabilities define the probability of the sensor ob...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). {% inclu...

(E_G)


64-72: Refine and punctuate configuration descriptions
Simplify phrasing and add missing comma.

- At any point in time (ignoring all external influences) how likely is this event to be occurring?
+ At any point (ignoring all external influences) how likely is this event to be occurring?

- Note: If the threshold is higher than the `prior` then the default state will be `off`
+ Note: If the threshold is higher than the `prior`, then the default state will be `off`
🧰 Tools
🪛 LanguageTool

[style] ~64-~64: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


[typographical] ~72-~72: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


110-119: Clarify configuration descriptions
Use semicolon for independent clauses and fix missing prepositions.

- description: Defines the template to be used, should evaluate to `True` or `False`.
+ description: Defines the template to be used; should evaluate to `True` or `False`.

- description: Assuming the bayesian binary_sensor is `on`, the probability the entity state is occurring.
+ description: Assuming the bayesian binary_sensor is `on`, the probability of the entity state occurring.

- description: Assuming the bayesian binary_sensor is `off` the probability the entity state is occurring.
+ description: Assuming the bayesian binary_sensor is `off`, the probability of the entity state occurring.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~115-~115: Possible missing preposition found.
Context: ... binary_sensor is on, the probability the entity state is occurring. requir...

(AI_HYDRA_LEO_MISSING_OF)


133-133: Standardize 'vice versa' spelling
Replace hyphenated form with two-word standard.

- vice-versa
+ vice versa
🧰 Tools
🪛 LanguageTool

[grammar] ~133-~133: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between eae5093 and 487daf6.

📒 Files selected for processing (1)
  • source/_integrations/bayesian.markdown (3 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/bayesian.markdown

[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


[uncategorized] ~36-~36: Possible missing comma found.
Context: ...ve. When configuring these conditional probabilities define the probability of the sensor ob...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). {% inclu...

(E_G)


[style] ~64-~64: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


[typographical] ~72-~72: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


[uncategorized] ~115-~115: Possible missing preposition found.
Context: ... binary_sensor is on, the probability the entity state is occurring. requir...

(AI_HYDRA_LEO_MISSING_OF)


[grammar] ~133-~133: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - home-assistant-docs
  • GitHub Check: Header rules - home-assistant-docs
  • GitHub Check: Pages changed - home-assistant-docs
🔇 Additional comments (5)
source/_integrations/bayesian.markdown (5)

22-28: Clear and concise introduction
The updated overview effectively explains the Bayesian helper concept, its UI and YAML distinctions, and real-world use cases.


38-38: Config flow include validation
The {% include integrations/config_flow.md %} directive correctly injects the UI config snippet.


50-56: Enhanced YAML example clarity
The updated YAML snippet now pairs keys with inline comments, making intent and parameters transparent.


124-124: Added Estimating probabilities section
This new guidance offers actionable steps for users to estimate and validate their probability values.


227-227: Clarify numeric range behavior
The note on multiple ranges specifying 'below' semantics is now clear and correct.

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

🧹 Nitpick comments (8)
source/_integrations/bayesian.markdown (8)

50-56: Minor formatting: standardize YAML quoting
In the example, values like the platform and entity_id are quoted inconsistently. Align with Home Assistant style (e.g., use single quotes only when required) to improve readability.


64-65: Tighten description and remove redundancy
The phrase “At any point in time” can be shortened (e.g., “At any point”), and remove extra spacing before the parenthesis for consistency.

🧰 Tools
🪛 LanguageTool

[style] ~64-~64: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


[uncategorized] ~65-~65: This verb may not be in the correct tense. Consider changing the tense to fit the context better.
Context: ...influences) how likely is this event to be occurring? required: true type: float probabi...

(AI_EN_LECTOR_REPLACEMENT_VERB_TENSE)


72-72: Add missing comma in conditional note
Insert a comma after the leading clause:

- Note: If the threshold is higher than the `prior` then the default state will be `off`
+ Note: If the threshold is higher than the `prior`, then the default state will be `off`
🧰 Tools
🪛 LanguageTool

[typographical] ~72-~72: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


110-110: Clarify template description
Consider rephrasing to:

Defines the template to evaluate; must return True or False.
This aligns with other key descriptions.


115-115: Improve clarity of probability description
The phrasing “the probability the entity state is occurring” is ambiguous. Suggest:

- Assuming the bayesian binary_sensor is `on`, the probability the entity state is occurring.
+ Assuming the Bayesian sensor is `on`, the probability that the observation occurs.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~115-~115: Possible missing preposition found.
Context: ... binary_sensor is on, the probability the entity state is occurring. requir...

(AI_HYDRA_LEO_MISSING_OF)


119-119: Add missing comma after introductory clause
Add a comma after “off”:

- Assuming the bayesian binary_sensor is `off` the probability the entity state is occurring.
+ Assuming the bayesian binary_sensor is `off`, the probability the entity state is occurring.

126-133: Polish punctuation and spelling in bullet list
Apply these changes for clarity and consistency:

- 2. When using `0.99` and `0.001`. The number of `9`s and `0`s matters.
+ 2. When using `0.99` and `0.001`, note that the number of `9`s and `0`s matters.

- 5. Don't work backwards by tweaking `prob_given_true:` and `prob_given_false:` to give the results and behaviors you want, use #4 to try and get probabilities as close to the 'truth' as you can, if your behavior is not as expected consider adding more sensors or see #6.
+ 5. Don't work backwards by tweaking `prob_given_true:` and `prob_given_false:` to get the results you want. Use #4 to estimate probabilities as close to the truth as possible, and if your behavior is not as expected, consider adding more sensors or see #6.

- 6. If your Bayesian sensor ends up triggering `on` too easily, re-check that the probabilities set and estimated make sense, then consider increasing `probability_threshold:` and vice-versa.
+ 6. If your Bayesian sensor ends up triggering `on` too easily, re-check that the probabilities set and estimated make sense. Then consider increasing `probability_threshold`, and vice versa.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~132-~132: A comma might be missing here.
Context: ... as you can, if your behavior is not as expected consider adding more sensors or see #6....

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[grammar] ~133-~133: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)


227-227: Clarify “below” behavior note
Consider rephrasing for readability:

- When more than one range is specified for the same entity, if a value falls on `below`, it will be included with the range that lists it in `below`. `below` then means 'below or equal to'. This is not true when only a single range is specified, where both `above` and `below` do not include 'equal to'.
+ When multiple ranges are specified for the same entity, `below` includes the boundary (i.e., 'below or equal to'). When only a single range is specified, both `above` and `below` exclude the boundary.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 487daf6 and bb0b3a2.

📒 Files selected for processing (1)
  • source/_integrations/bayesian.markdown (3 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/bayesian.markdown

[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


[uncategorized] ~36-~36: A comma might be missing here.
Context: ...ve. When configuring these conditional probabilities define the probability of the sensor ob...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). {% inclu...

(E_G)


[style] ~64-~64: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


[uncategorized] ~65-~65: This verb may not be in the correct tense. Consider changing the tense to fit the context better.
Context: ...influences) how likely is this event to be occurring? required: true type: float probabi...

(AI_EN_LECTOR_REPLACEMENT_VERB_TENSE)


[typographical] ~72-~72: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


[uncategorized] ~115-~115: Possible missing preposition found.
Context: ... binary_sensor is on, the probability the entity state is occurring. requir...

(AI_HYDRA_LEO_MISSING_OF)


[uncategorized] ~132-~132: A comma might be missing here.
Context: ... as you can, if your behavior is not as expected consider adding more sensors or see #6....

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[grammar] ~133-~133: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)

🔇 Additional comments (3)
source/_integrations/bayesian.markdown (3)

22-28: Clear introduction of Bayesian helper
The new opening paragraphs succinctly explain the purpose and use of the bayesian helper as a virtual binary sensor.


32-38: Solid theory section and config flow inclusion
The distinction between conditional probabilities is well-stated and the inline config flow include ensures users can conveniently access the UI setup.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


[uncategorized] ~36-~36: A comma might be missing here.
Context: ...ve. When configuring these conditional probabilities define the probability of the sensor ob...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). {% inclu...

(E_G)


124-124: Useful “Estimating probabilities” section
The new guidance provides practical best practices for users estimating real-world probabilities.

Bayesian is a proper adjective (from Thomas Bayes), so it is capitalised in in all cases in the text. `bayesian` is not capitalised as it signifies the configuration values which are never capitalised.
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

🧹 Nitpick comments (6)
source/_integrations/bayesian.markdown (6)

32-36: Nit: punctuation & e.g. formatting in Theory section
Some sentences contain comma splices and inconsistent “e.g.” usage. Consider:

- Now consider the above but in a home that has cats. The probability [...]
+ Now consider the above, but in a home that has cats. The probability [...]

- However the probability that motion detected may be quite low (e.g 20%, p=0.2)
+ However, the probability that motion is detected may be quite low (e.g., 20%, p=0.2)

- When configuring these conditional probabilities define the probability [...]
+ When configuring these conditional probabilities, define the probability [...]
🧰 Tools
🪛 LanguageTool

[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


[uncategorized] ~36-~36: A comma might be missing here.
Context: ...ve. When configuring these conditional probabilities define the probability of the sensor ob...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). {% inclu...

(E_G)


64-65: Nit: simplify redundant phrase
The phrase “at any point in time” is verbose. You could simplify:

- The baseline probability of the event (0 to 1). At any point in time (ignoring all external influences) how likely is this event to be occurring?
+ The baseline probability of the event (0 to 1). At any given time (ignoring all external influences) how likely is this event to be occurring?
🧰 Tools
🪛 LanguageTool

[style] ~64-~64: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


[uncategorized] ~65-~65: This verb may not be in the correct tense. Consider changing the tense to fit the context better.
Context: ...influences) how likely is this event to be occurring? required: true type: float probabi...

(AI_EN_LECTOR_REPLACEMENT_VERB_TENSE)


72-72: Nit: add comma in Note
Add a comma for clarity and a period at the end:

- Note: If the threshold is higher than the `prior` then the default state will be `off`
+ Note: If the threshold is higher than the `prior`, then the default state will be `off`.
🧰 Tools
🪛 LanguageTool

[typographical] ~72-~72: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


115-119: Nit: clarify probability descriptions
Add “of” and commas for clarity:

- description: Assuming the Bayesian binary_sensor is `on`, the probability the entity state is occurring.
+ description: Assuming the Bayesian binary_sensor is `on`, the probability of the entity state occurring.

- description: Assuming the Bayesian binary_sensor is `off` the probability the entity state is occurring.
+ description: Assuming the Bayesian binary_sensor is `off`, the probability of the entity state occurring.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~115-~115: Possible missing preposition found.
Context: ... binary_sensor is on, the probability the entity state is occurring. requir...

(AI_HYDRA_LEO_MISSING_OF)


126-133: Nit: sharpen Estimating probabilities guidelines
Several lines could be clearer with proper punctuation and structure. For example:

- 1. Avoid `0` and `1`, these will mess with the odds and are rarely true - sensors fail.
+ 1. Avoid `0` and `1`; these will mess with the odds and are rarely true—sensors fail.

- 2. When using `0.99` and `0.001`. The number of `9`s and `0`s matters.
+ 2. When using `0.99` and `0.001`, the number of `9`s and `0`s matters.

- 5. Don't work backwards by tweaking `prob_given_true:` and `prob_given_false:` to give the results and behaviors you want, use #4 to try and get probabilities as close to the 'truth' as you can, if your behavior is not as expected consider adding more sensors or see #6.
+ 5. Don't work backwards by tweaking `prob_given_true:` and `prob_given_false:` to force desired outcomes; use guideline #4 to estimate probabilities as accurately as possible. If behavior still isn’t as expected, consider adding more sensors or see #6.

- 6. If your Bayesian sensor ends up triggering `on` too easily, re-check that the probabilities set and estimated make sense, then consider increasing `probability_threshold:` and vice-versa.
+ 6. If your Bayesian sensor ends up triggering `on` too easily, re-check that the probabilities make sense, then consider increasing `probability_threshold:` and vice versa.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~132-~132: A comma might be missing here.
Context: ... as you can, if your behavior is not as expected consider adding more sensors or see #6....

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[grammar] ~133-~133: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)


227-227: Optional: improve range inclusivity explanation
Consider rephrasing for clarity and consistency, e.g.:

- When more than one range is specified for the same entity, if a value falls on `below`, it will be included with the range that lists it in `below`. `below` then means 'below or equal to'. This is not true when only a single range is specified, where both `above` and `below` do not include 'equal to'.
+ When multiple ranges are defined for the same entity, `below` is inclusive (≤) for any range that specifies it. For a single range, `above` and `below` remain exclusive.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between bb0b3a2 and 8709695.

📒 Files selected for processing (1)
  • source/_integrations/bayesian.markdown (4 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/bayesian.markdown

[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


[uncategorized] ~36-~36: A comma might be missing here.
Context: ...ve. When configuring these conditional probabilities define the probability of the sensor ob...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). {% inclu...

(E_G)


[style] ~64-~64: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...

(MOMENT_IN_TIME)


[uncategorized] ~65-~65: This verb may not be in the correct tense. Consider changing the tense to fit the context better.
Context: ...influences) how likely is this event to be occurring? required: true type: float probabi...

(AI_EN_LECTOR_REPLACEMENT_VERB_TENSE)


[typographical] ~72-~72: Consider adding a comma.
Context: ...the threshold is higher than the prior then the default state will be off requi...

(IF_THEN_COMMA)


[uncategorized] ~115-~115: Possible missing preposition found.
Context: ... binary_sensor is on, the probability the entity state is occurring. requir...

(AI_HYDRA_LEO_MISSING_OF)


[uncategorized] ~132-~132: A comma might be missing here.
Context: ... as you can, if your behavior is not as expected consider adding more sensors or see #6....

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[grammar] ~133-~133: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold: and vice-versa. ## Full examples These are a number ...

(VICE_VERSA)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - home-assistant-docs
  • GitHub Check: Header rules - home-assistant-docs
  • GitHub Check: Pages changed - home-assistant-docs
🔇 Additional comments (5)
source/_integrations/bayesian.markdown (5)

22-28: Introductory text is clear
The new introduction effectively explains the Bayesian helper’s purpose and benefits. No changes needed.


38-38: Config flow include snippet
The {% include integrations/config_flow.md %} directive aligns with Home Assistant docs conventions.


50-56: YAML example snippet is accurate
The configuration example for binary_sensor with name, prior, and observation probabilities is clear and follows standards.


110-110: Value template description update looks good
Changing the boolean results to True/False matches templating conventions.


124-124: Estimating probabilities section
Adding a dedicated section on probability estimation is a great enhancement.

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

🧹 Nitpick comments (8)
source/_integrations/bayesian.markdown (8)

28-28: Consider splitting for clarity
This sentence is a bit long.
Suggestion:

-Both UI and YAML setups are supported, importantly YAML uses probabilities of `0` to `1` whereas the UI uses percentages, `0` to `100`.
+Both UI and YAML setups are supported. Importantly, YAML uses probabilities of `0` to `1`, whereas the UI uses percentages of `0` to `100`.

32-32: Consistent capitalization for ‘rule’
Use “Bayes’ rule” (lowercase “rule”) to match common style:

-A fundamental concept in Bayes' Rule is…
+A fundamental concept in Bayes' rule is…

34-34: Fix abbreviation punctuation
Add missing periods for “e.g.” (“for example”):

-… low (e.g 20%, p=0.2) …
+… low (e.g., 20%, p=0.2) …
🧰 Tools
🪛 LanguageTool

[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


36-36: Fix abbreviation punctuation
“e.g.” requires two periods:

-… probability of the sensor observation (e.g motion detected) …
+… probability of the sensor observation (e.g., motion detected) …
🧰 Tools
🪛 LanguageTool

[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). {% inclu...

(E_G)


64-65: Align block indentation
Indent block content under description: > by two spaces for consistency:

-     The baseline…
-     (if you knew nothing…
+   The baseline…
+   (if you knew nothing…

110-110: Grammar tweak for template description
Consider semicolon for readability:

-Defines the template to be used, should evaluate to `True` or `False`.
+Defines the template to be used; it should evaluate to `True` or `False`.

124-133: Indent nested list items
Sub-bullets under item 4 should be indented one additional level for proper rendering:

-4. Use your Home Assistant history…
-   - **Probability when Bayesian sensor `on`**…
-   - **Probability when Bayesian sensor `off`**…
+4. Use your Home Assistant history…
+   1. **Probability when Bayesian sensor `on`**…
+   2. **Probability when Bayesian sensor `off`**…

227-227: Clarify inclusive/exclusive note
Good note on range inclusivity. Optionally, you could explicitly state that above remains exclusive even under multiple ranges.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 8709695 and a1a7214.

📒 Files selected for processing (1)
  • source/_integrations/bayesian.markdown (4 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/bayesian.markdown

[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...

(E_G)


[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). {% inclu...

(E_G)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - home-assistant-docs
  • GitHub Check: Header rules - home-assistant-docs
  • GitHub Check: Pages changed - home-assistant-docs
🔇 Additional comments (8)
source/_integrations/bayesian.markdown (8)

22-22: Perfect introductory definition
Clear description of the Bayesian helper and its purpose; the use of code formatting for Bayesian and explanation as a virtual binary sensor is spot on.


24-24: Good context on use cases
Illustrates real-world applications and benefits; nicely highlights both complex and reliability scenarios.


26-26: Concise explanation of Bayes’ rule
The description of how the sensor calculates posterior probabilities is clear and accurate.


38-38: Config flow include is correct
Including integrations/config_flow.md enables the UI snippet; this matches other integrations.


50-56: YAML example looks good
The new snippet clarifies name, prior, probability_threshold, and observations. Quotes around strings ensure no parsing issues.


72-72: Threshold note is helpful
Clarifies behavior when threshold > prior; exactly as needed.


82-82: Unique ID description is precise
Clearly warns about duplicate IDs and exception behavior.


115-119: Config key descriptions are clear
prob_given_true and prob_given_false descriptions correctly explain their semantics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-parent This PR has a parent PR in a other repo next This PR goes into the next branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant