-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add publish Action for Nextion components #4360
Conversation
✅ Deploy Preview for esphome ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
WalkthroughThe changes introduce new documentation sections for the Nextion components, specifically for binary sensors, sensors, switches, and text sensors. Each section details a new action, Changes
Suggested labels
Suggested reviewers
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? 🪧 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: 0
🧹 Outside diff range and nitpick comments (6)
components/text_sensor/nextion.rst (2)
66-89
: LGTM: Comprehensive example configurationThe example configuration is well-structured and demonstrates both basic and templated usage of the
text_sensor.nextion.publish
action. It covers all parameters and provides context for when the action might be used.Consider adding a brief comment above the templated example to explain when a user might choose this approach over the basic example. This could help users understand the benefits of using templates in this context.
98-106
: LGTM: Helpful lambda calls exampleThe lambda calls example is well-presented and provides clear guidance for users who need to use this action in C++ code. The different variations of the
set_state
method are particularly useful.Consider adding a brief explanation of the parameters in the
set_state
method calls. For example:// Set state with default publish and send_to_nextion (both true) id(nextion_text).set_state("Hello World"); // Set state with custom publish value, default send_to_nextion id(nextion_text).set_state("Hello World", true); // Set state with custom publish and send_to_nextion values id(nextion_text).set_state("Hello World", true, true);This would help users understand the purpose of each parameter more clearly.
components/switch/nextion.rst (1)
62-111
: LGTM! Consider adding a brief introductory sentence.The new section on the
switch.nextion.publish
action is well-structured, accurate, and provides valuable information for users. The example configuration, explanation of parameters, and notes on lambda usage are clear and comprehensive.Consider adding a brief introductory sentence at the beginning of the section to provide context. For example:
``switch.nextion.publish`` Action --------------------------------------- +The `switch.nextion.publish` action allows you to update the state of a Nextion switch programmatically from your ESPHome configuration. + You can also publish a state to a Nextion switch from elsewhere in your YAML file with the ``switch.nextion.publish`` action.This addition would help users quickly understand the purpose of the action before diving into the details.
components/sensor/nextion.rst (2)
106-129
: LGTM: Comprehensive examples providedThe examples effectively demonstrate both standard and templated usage of the
sensor.nextion.publish
action, including optional parameters.Consider adding a brief comment above the templated example to explain when a user might prefer this approach over the standard one.
138-146
: LGTM: Helpful lambda usage examplesThe inclusion of lambda examples is valuable for advanced users, demonstrating different ways to use the
set_state
method.Consider adding a brief explanation of the differences between the three
set_state
examples to clarify the purpose of each parameter.components/binary_sensor/nextion.rst (1)
90-139
: LGTM! New section onbinary_sensor.nextion.publish
action is well-documented.The new section is clear, well-structured, and consistent with the existing documentation style. It provides comprehensive information about the new action, including YAML examples, configuration options, and lambda usage.
Consider adding a brief introductory sentence explaining the purpose of this action, such as:
"This action allows you to programmatically update the state of a Nextion binary sensor from within your ESPHome configuration."
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
- components/binary_sensor/nextion.rst (1 hunks)
- components/sensor/nextion.rst (1 hunks)
- components/switch/nextion.rst (1 hunks)
- components/text_sensor/nextion.rst (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
components/binary_sensor/nextion.rst (1)
Pattern
**
: - Do not generate or add any sequence diagramscomponents/sensor/nextion.rst (1)
Pattern
**
: - Do not generate or add any sequence diagramscomponents/switch/nextion.rst (1)
Pattern
**
: - Do not generate or add any sequence diagramscomponents/text_sensor/nextion.rst (1)
Pattern
**
: - Do not generate or add any sequence diagrams
🔇 Additional comments (6)
components/text_sensor/nextion.rst (3)
58-64
: LGTM: Clear introduction of the new actionThe introduction for the
text_sensor.nextion.publish
action is well-written and informative. It clearly states the purpose of the action and its context within the Nextion text sensor component.
91-96
: LGTM: Well-documented configuration optionsThe configuration options for the
text_sensor.nextion.publish
action are clearly presented. Each parameter is properly described with its requirements, type, and default values where applicable. The formatting is consistent with ESPHome documentation standards.
58-106
: Summary: Excellent addition of thetext_sensor.nextion.publish
action documentationThe new section introducing the
text_sensor.nextion.publish
action is a valuable addition to the Nextion text sensor component documentation. It provides clear instructions, well-structured examples, and comprehensive configuration options. The content is consistent with ESPHome documentation standards and aligns well with the PR objectives.This addition will greatly benefit users by enabling them to publish states to Nextion text sensors from other parts of their YAML configuration, enhancing the flexibility and functionality of Nextion components in ESPHome projects.
components/sensor/nextion.rst (3)
98-104
: LGTM: Clear introduction of the new actionThe introduction effectively explains the purpose of the new
sensor.nextion.publish
action, aligning with the PR objectives.
131-136
: LGTM: Well-documented configuration optionsThe configuration options are clearly explained, with required and optional parameters properly identified. The inclusion of default values and templatable options is particularly helpful for users.
98-146
: LGTM: Excellent addition to the Nextion sensor documentationThe new section on the
sensor.nextion.publish
action is a valuable addition to the documentation. It provides clear explanations, comprehensive examples, and detailed configuration options. The inclusion of both YAML and lambda usage examples caters to users with different levels of expertise.The changes align well with the PR objectives and enhance the functionality of the Nextion sensor component by allowing for more dynamic state management.
components/binary_sensor/nextion.rst
Outdated
|
||
- **id** (**Required**, :ref:`config-id`): The ID of the Nextion switch. | ||
- **state** (**Required**, string, :ref:`templatable <config-templatable>`): The boolean state to publish. | ||
- **publish_state** (**Optional**, bool, :ref:`templatable <config-templatable>`): Publish new state to HASS. Default is true. |
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.
I wouldn't use "HASS". I think "Publish new state to Home Assistant." makes it more clear.
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.
Agreed. I copied this line from existing documentation - lambda call section.
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.
What if one uses publish_state: false
and send_to_nextion: false
? Will this function do anything?
Is there really a need for an optional send_to_nextion
? Why not make it mandatory (always publish to Nextion) if this component is all about the Nextion?
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.
You are right, that call will be nonsense. But I tried to keep same functionality as lambda calls offers. You can check API: https://esphome.io/api/classesphome_1_1nextion_1_1_nextion_component_base
I can image someone needs to publish value into sensor (that triggers filters and on_value actions) and not yet update Nextion...
Yeah, it sounds overcomplicated but as I said I just tried to keep all options possible in lambdas in YAML actions.
* Tabs label CSS night mode fix * Update _static/custom.css Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * removed border attribute * Update custom.css --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
240d04b
to
8e65295
Compare
…docs into nextion_actions
Description:
Related issue (if applicable): fixes
Pull request in esphome with YAML changes (if applicable): esphome/esphome#7646
Checklist:
I am merging into
next
because this is new documentation that has a matching pull-request in esphome as linked above.or
I am merging into
current
because this is a fix, change and/or adjustment in the current documentation and is not for a new component or feature.Link added in
/index.rst
when creating new documents for new components or cookbook.