-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add example section for APCUPSD #38813
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
Conversation
✅ Deploy Preview for home-assistant-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
📝 WalkthroughWalkthroughA new example automation snippet was added to the documentation for the APC UPS Daemon integration. This example demonstrates how to set up a Home Assistant automation that sends a push notification when the UPS load exceeds 80%. The YAML code is provided within raw tags to ensure proper formatting in the documentation. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant HomeAssistant
participant UPS Sensor
participant Notification Service
UPS Sensor->>HomeAssistant: Report load percentage
HomeAssistant->>HomeAssistant: Trigger automation if load > 80%
HomeAssistant->>Notification Service: Send push notification with load value
Notification Service->>User: Deliver notification
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
source/_integrations/apcupsd.markdown (2)
151-153
: Remove redundant description field.
There are twodescription
entries—one with text and an empty one immediately following. The empty field is unnecessary and should be removed.Apply this diff:
@@ -152,2 +152,0 - description: ""
160-160
: Use singularcondition
key.
For consistency with the rest of the documentation, renameconditions:
tocondition:
.@@ -160 +160 -conditions: [] +condition: []
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/apcupsd.markdown
(1 hunks)
🔇 Additional comments (2)
source/_integrations/apcupsd.markdown (2)
144-146
: Examples section addition looks good.
Adding an “## Examples” section with a concrete use case provides valuable guidance to end users.
148-149
: Raw tags usage is appropriate.
Wrapping the YAML snippet in{% raw %}
/{% endraw %}
ensures correct rendering without Hugo processing.
triggers: | ||
- trigger: numeric_state | ||
entity_id: | ||
- sensor.gogoups_load | ||
above: 80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix YAML trigger configuration.
The keys triggers:
and inner trigger:
syntax do not match Home Assistant’s official automation schema. Use a singular trigger
key with platform
rather than trigger:
.
Suggested diff:
@@ -155,5 +155,5
- triggers:
- - trigger: numeric_state
- entity_id:
- - sensor.gogoups_load
- above: 80
+trigger:
+ - platform: numeric_state
+ entity_id: sensor.apcupsd_loadpct
+ above: 80
📝 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.
triggers: | |
- trigger: numeric_state | |
entity_id: | |
- sensor.gogoups_load | |
above: 80 | |
trigger: | |
- platform: numeric_state | |
entity_id: sensor.apcupsd_loadpct | |
above: 80 |
actions: | ||
- action: notify.notify | ||
data: | ||
message: "APC UPS load is high: {{ states('sensor.apc_ups_load') }}%" | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct action syntax and entity naming.
The snippet uses actions:
+ action:
instead of the expected singular action:
key with a service:
field. Also update the template to reference the corrected entity (sensor.apcupsd_loadpct
).
Proposed diff:
@@ -161,6 +161,6
- actions:
- - action: notify.notify
- data:
- message: "APC UPS load is high: {{ states('sensor.apc_ups_load') }}%"
+action:
+ - service: notify.notify
+ data:
+ message: "APC UPS load is high: {{ states('sensor.apcupsd_loadpct') }}%"
📝 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.
actions: | |
- action: notify.notify | |
data: | |
message: "APC UPS load is high: {{ states('sensor.apc_ups_load') }}%" | |
``` | |
action: | |
- service: notify.notify | |
data: | |
message: "APC UPS load is high: {{ states('sensor.apcupsd_loadpct') }}%" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @yuxincs 👍
Proposed change
This PR adds an Example section to list an example automation that might be useful for end users.
Type of change
current
branch).current
branch).next
branch).next
branch).Additional information
Checklist
current
branch.next
branch.Summary by CodeRabbit