Skip to content

Configure the WizMote from Home Assistant (per-button selects + blueprint)#35

Merged
bharvey88 merged 15 commits into
betafrom
wizmote-customizable
Jun 22, 2026
Merged

Configure the WizMote from Home Assistant (per-button selects + blueprint)#35
bharvey88 merged 15 commits into
betafrom
wizmote-customizable

Conversation

@bharvey88

@bharvey88 bharvey88 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Version: 26.6.19.3

What does this implement/fix?

Adds full Home Assistant control over the WizMote, configurable two ways.

On the device — one select per button (WizMote On / Off / Night / Brightness Up / Brightness Down / Button 1 / Button 2 / Button 3 / Button 4), all entity_category: config, restore_value: true, each offering:

Nothing · Play · Pause · Play / Pause · Next Track · Previous Track ·
Volume Up · Volume Down · Toggle Light · Send HA Event

process_wizmote_button looks up the pressed button's select and runs a shared run_wizmote_action sub-script. Defaults match the previous fixed mapping (On=Play, Off=Pause, 1=Previous, 2=Next, 3/4=Send HA Event, Bright +/-=Volume, Night=Toggle Light), so behaviour is unchanged out of the box. Send HA Event fires esphome.cast1_wizmote_event with the pressed button in the payload ({ button: "3" }).

From a blueprint — a Home Assistant automation blueprint that turns the buttons into a single config surface lives in the Blueprints repo: ApolloAutomation/Blueprints → CAST-1/CAST-1-WizMote.yaml (ApolloAutomation/Blueprints#16). Each button gets an Action dropdown (the same 10 options) plus a custom action; on HA start and on save the blueprint writes the picks down to the device's selects, so users never need to open the device page. This PR is the firmware side only (per-button selects + cast1_wizmote_event); the blueprint ships separately in that repo.

Validated with esphome config on both variants on esphome 2026.6.1.

Types of changes

  • Bugfix (fixed change that fixes an issue)
  • New feature (thanks!)
  • Breaking change (repair/feature that breaks existing functionality)
  • Dependency Update - Does not publish
  • Other - Does not publish
  • Website of github readme file update - Does not publish
  • Github workflows - Does not publish

Checklist / Checklijst:

  • The code change has been tested and works locally
  • The code change has not yet been tested

If user-visible functionality or configuration variables are added/modified:

  • Added/updated documentation for the web page

🤖 Generated with Claude Code

Add a select per WizMote button (On, Off, Night, Brightness Up/Down,
Button 1-4) so the action is chosen in HA, no YAML editing. Options:
Nothing / Play / Pause / Play-Pause / Next / Previous / Volume Up/Down /
Toggle Light / Send HA Event. Defaults match the previous fixed mapping.

process_wizmote_button now looks up the pressed button's select and runs
a shared run_wizmote_action sub-script. "Send HA Event" fires
esphome.cast1_wizmote_event with the button label in the payload, so any
button can be wired to a playlist/scene/etc. in a HA automation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Replaces the fixed WizMote button-to-action mapping in wizmote.yaml with nine per-button ESPHome select entities and a new run_wizmote_action script. A new Home Assistant automation blueprint (cast-1-wizmote.yaml) syncs those select states on startup and executes custom per-button HA actions on esphome.cast1_wizmote_event. The ESPHome core version is bumped to 26.6.19.3.

Changes

WizMote Configurable Button Actions

Layer / File(s) Summary
ESPHome per-button selects and action dispatcher
Integrations/ESPHome/Core.yaml, Integrations/ESPHome/wizmote.yaml
Adds nine template select entities (one per WizMote button) sharing a common options list. Introduces run_wizmote_action script dispatching an action string to media controls, volume, RGB toggle, or a unified esphome.cast1_wizmote_event. Reworks process_wizmote_button to read the active select state and delegate to run_wizmote_action, replacing all hardcoded per-button behavior. Core version bumped to 26.6.19.3.
Blueprint metadata and per-button inputs
Blueprints/cast-1-wizmote.yaml
Declares the automation blueprint with a CAST-1 device selector filtered by integration/manufacturer/model. Defines nine per-button input groups each with an Action dropdown and a Custom action field. Sets mode: queued, max: 10, and binds the device to a variable.
Blueprint triggers and runtime action execution
Blueprints/cast-1-wizmote.yaml
Adds homeassistant start and automation_reloaded sync triggers plus nine esphome.cast1_wizmote_event button triggers. A choose block handles sync by iterating all buttons and calling select.set_option on the device, and handles button events by executing the matching per-button custom !input action.

Sequence Diagram

sequenceDiagram
  participant HA as Home Assistant
  participant Blueprint as cast-1-wizmote Blueprint
  participant Device as CAST-1 ESPHome Device
  participant WizMote as WizMote Remote

  rect rgba(100, 149, 237, 0.5)
    note over HA,Device: Sync on startup/reload
    HA->>Blueprint: homeassistant start / automation_reloaded
    Blueprint->>Device: select.set_option (9 buttons)
    Device-->>Blueprint: options updated
  end

  rect rgba(144, 238, 144, 0.5)
    note over WizMote,HA: Runtime button press
    WizMote->>Device: ESP-NOW button press
    Device->>Device: process_wizmote_button → run_wizmote_action
    Device->>HA: fire esphome.cast1_wizmote_event(button label)
    HA->>Blueprint: trigger on cast1_wizmote_event
    Blueprint->>HA: execute custom per-button action input
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • ApolloAutomation/CAST-1#1: Also modifies Integrations/ESPHome/Core.yaml to change the substitutions.version value.
  • ApolloAutomation/CAST-1#32: Implements the initial fixed process_wizmote_button dispatch and HA event mapping that this PR directly reworks into the selection-driven system.

Poem

🐇 Hop hop, a button pressed with flair,
Nine selects now hang in the air,
The WizMote blinks, the blueprint runs,
No hardcoded maps — configurable fun!
Each press dispatched with careful care. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The PR title clearly and concisely summarizes the main changes: adding per-button configurable selects and a Home Assistant blueprint for managing WizMote remote buttons from Home Assistant.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wizmote-customizable

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the new-feature New feature or request label Jun 19, 2026
Lets users wire any "Send HA Event" button to an HA action (playlist,
scene, script) without editing automations by hand. One action selector
per button; triggers on esphome.cast1_wizmote_event.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
YAML parsed the bare On/Off input names as booleans, so HA rejected the
import. Quote all names. Also relocate the blueprint to a top-level
Blueprints/ directory and point source_url at the new path.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
So testers can confirm they flashed this build.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
The event delivers the button as a number, so the string comparisons in
the choose never matched and no action ran. Cast it with | string.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
HA's template engine coerces the numeric button "3" to the int 3 when it
stores the pressed variable, so a variable-level | string is undone and
3 == '3' stayed false. Move | string into each comparison where the cast
survives, so the numeric buttons match.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Replace the template choose with one event trigger per button (event_data
filter + trigger id) and condition: trigger. HA matches the raw event
value instead of a Jinja-coerced variable, so the numeric buttons can't
break, it validates at load instead of failing silently, and quoting the
button values avoids the on/off YAML-boolean trap.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Each button now has its own Action dropdown (same 10 options as the
device) plus a custom action, grouped in collapsible sections. On HA
start and on save, the blueprint pushes each pick down to the matching
WizMote select on the CAST-1 via select.select_option, so the device
page no longer needs touching - the blueprint is the source of truth.
Local media actions still run on-device; "Send HA Event" runs the
button's custom action. Needs a CAST-1 device picker; no firmware change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Base automatically changed from add-wizmote-control to beta June 19, 2026 16:30
Match the BTN-1 blueprint pattern: filter by manufacturer ApolloAutomation
and the CAST-1-W / CAST-1-ETH models so the picker only lists CAST-1s
instead of every ESPHome device.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Adds a "Default: <action>" hint to every button so the shipped behavior
is visible even after someone changes the dropdown.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Blueprints/cast-1-wizmote.yaml`:
- Around line 223-257: The blueprint triggers matching on event_type
esphome.cast1_wizmote_event only filter by the button field in event_data,
causing all CAST-1 instances to respond to any remote press in multi-device
setups. First, modify the ESPHome WizMote integration
(Integrations/ESPHome/wizmote.yaml around line 309) to include a device or
source identifier in the event payload. Then, update all the trigger definitions
in this blueprint that specify event_data with button values to also include a
filter condition on the source/device identifier field to scope the triggers to
the selected device only.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9e873747-bebe-47b1-82a5-d60117a20173

📥 Commits

Reviewing files that changed from the base of the PR and between 1f691c3 and d4e7e2e.

📒 Files selected for processing (3)
  • Blueprints/cast-1-wizmote.yaml
  • Integrations/ESPHome/Core.yaml
  • Integrations/ESPHome/wizmote.yaml

Comment thread Blueprints/CAST-1-WizMote.yaml Outdated
Comment on lines +223 to +257
event_type: esphome.cast1_wizmote_event
event_data: { button: "on" }
id: "on"
- trigger: event
event_type: esphome.cast1_wizmote_event
event_data: { button: "off" }
id: "off"
- trigger: event
event_type: esphome.cast1_wizmote_event
event_data: { button: "night" }
id: "night"
- trigger: event
event_type: esphome.cast1_wizmote_event
event_data: { button: "brightness_up" }
id: "brightness_up"
- trigger: event
event_type: esphome.cast1_wizmote_event
event_data: { button: "brightness_down" }
id: "brightness_down"
- trigger: event
event_type: esphome.cast1_wizmote_event
event_data: { button: "1" }
id: "button_1"
- trigger: event
event_type: esphome.cast1_wizmote_event
event_data: { button: "2" }
id: "button_2"
- trigger: event
event_type: esphome.cast1_wizmote_event
event_data: { button: "3" }
id: "button_3"
- trigger: event
event_type: esphome.cast1_wizmote_event
event_data: { button: "4" }
id: "button_4"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Blueprint WizMote event triggers (button-only matching):"
rg -n -C2 'event_type:\s*esphome\.cast1_wizmote_event|event_data:\s*\{ button:' Blueprints/cast-1-wizmote.yaml

echo
echo "ESPHome WizMote event payload fields:"
rg -n -C3 'homeassistant\.event|event:\s*esphome\.cast1_wizmote_event|data:|button:' Integrations/ESPHome/wizmote.yaml

Repository: ApolloAutomation/CAST-1

Length of output: 4878


Scope WizMote event handling to the selected device.

Blueprint triggers (lines 232–266) match only the button field in event_data. The ESPHome WizMote integration (Integrations/ESPHome/wizmote.yaml, line 309) emits events with only button in the payload and no device/source identifier. In multi-device setups, multiple CAST-1 blueprint instances will all react to a single remote press. Add a device/source identifier to the event payload and gate these triggers by that source field.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Blueprints/cast-1-wizmote.yaml` around lines 223 - 257, The blueprint
triggers matching on event_type esphome.cast1_wizmote_event only filter by the
button field in event_data, causing all CAST-1 instances to respond to any
remote press in multi-device setups. First, modify the ESPHome WizMote
integration (Integrations/ESPHome/wizmote.yaml around line 309) to include a
device or source identifier in the event payload. Then, update all the trigger
definitions in this blueprint that specify event_data with button values to also
include a filter condition on the source/device identifier field to scope the
triggers to the selected device only.

Rename the file (source_url updated to match) and replace the description
blob with scannable emoji-labeled lines.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Lead line, a Features list, and a plain-language explainer of "Send HA
Event" with examples (Music Assistant playlist, toggle a room's lights,
run a scene). Emojis only on the bullets, not the section headers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Clearer phrasing: defaults you can override to suit your needs, override
from the dropdown, and "Send HA Event" to set up a custom action.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Merge the "ships with a default" and "override from the dropdown" bullets
into one, since they said the same thing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@bharvey88 bharvey88 changed the title Make WizMote buttons remappable from Home Assistant Configure the WizMote from Home Assistant (per-button selects + blueprint) Jun 19, 2026
@bharvey88

Copy link
Copy Markdown
Contributor Author

this has been tested and is ready to merge to beta @TrevorSchirmer

Lives in ApolloAutomation/Blueprints (CAST-1/CAST-1-WizMote.yaml, PR #16);
this PR is now firmware-only.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@bharvey88

Copy link
Copy Markdown
Contributor Author

works great merging to beta!

@bharvey88 bharvey88 merged commit 4f88b5c into beta Jun 22, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant