-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Allow base64_encode filter to accept bytes as input #39097
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
base: next
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for home-assistant-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe templating documentation was updated to include information and example usage for a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TemplateEngine
User->>TemplateEngine: Provide template with 'base64_encode' filter
TemplateEngine->>TemplateEngine: Encode input using base64
TemplateEngine-->>User: Return base64-encoded string
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure 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:
SupportNeed 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)
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
🧹 Nitpick comments (2)
source/_docs/configuration/templating.markdown (2)
1177-1181
: Refine filter description for clarity and consistency
The new entry correctly states thatbase64_encode
accepts strings and bytes. To align with the style of other filter descriptions (using past participles and “Base64” capitalized), consider rephrasing:
- From:
- Filter `value | base64_encode` Encodes a string or bytes to a base 64 string.
- To:
- Filter `value | base64_encode` Encodes a string or bytes to a Base64-encoded string.
1186-1189
: Illustrate bytes support and satisfy Markdown-lint
- Add an example showing direct bytes input (e.g. via the
fromhex
filter) to demonstrate the new capability:{% raw %} - `{{ '0F010003' | fromhex | base64_encode }}` – renders as `<calculated-base64-value>` {% endraw %}- Ensure the existing bullet list is surrounded by blank lines to satisfy MD032 (lists should be preceded and followed by a blank line).
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
1186-1186: Lists should be surrounded by blank lines
null(MD032, blanks-around-lists)
📜 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
📒 Files selected for processing (1)
source/_docs/configuration/templating.markdown
(2 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
source/_docs/configuration/templating.markdown
1186-1186: Lists should be surrounded by blank lines
null
(MD032, blanks-around-lists)
Proposed change
Allow base64_encode to support bytes. Currently there is a gap in HA when converting HEX strings (common) to base64. This is typically need for remotes like broadlink and other aspects of HA that require base64 strings.
If a user attempts to convert a hex string to base64, they have to know quite a bit about encoding. Which isn't easy.
This PR is phase1 of a 2 updates. This update specifically just allows base64_encode to accept bytes as an input.
Phase 2 -> home-assistant/core#145229
This proposal changes this template:
To this:
Which will easily work with hex strings.
Type of change
current
branch).current
branch).next
branch).next
branch).Additional information
Checklist
current
branch.next
branch.Summary by CodeRabbit