feat: mute the TV while the box listens, if the brain turns that on
check / check (push) Waiting to run
check / check (push) Waiting to run
whisper hears people better without the show behind them. The brain sets a mute code (and an unmute code, if not the same) with mute_while_listening on its ir capability, or turns it off; ir-server keeps the setting in its state directory. Mute is often a toggle, and the camera can't reliably tell whether the sound is off, so the box senses nothing: the setting is the brain's to turn on or off. The button service holds a connection to ir-server's conversation socket for each conversation: ir-server mutes when it opens and unmutes, with the same codes, when it closes. The socket's group is the button's alone, and the button still can't send any code. Generated-by: Claude Opus 5.5
This commit is contained in:
1 parent
5191ee9931
commit
f50c871521
10 files changed
+269
-22
No files matched your search
+1
-1
@@ -50,7 +50,7 @@ $(WORK)/.mcp.json: Makefile
|
||||
# Pre-approve the project's one MCP server and its tools; the trust and dev-channel prompts still want a person.
|
||||
$(WORK)/.claude/settings.local.json: Makefile
|
||||
install -d $(dir $@)
|
||||
echo '{"enabledMcpjsonServers":["box"],"permissions":{"allow":["mcp__box__reply","mcp__box__say","mcp__box__ir_listen","mcp__box__ir_send","mcp__box__report_problem","mcp__box__look","Bash(python3 -I *)"]}}' > $@
|
||||
echo '{"enabledMcpjsonServers":["box"],"permissions":{"allow":["mcp__box__reply","mcp__box__say","mcp__box__ir_listen","mcp__box__ir_send","mcp__box__mute_while_listening","mcp__box__report_problem","mcp__box__look","Bash(python3 -I *)"]}}' > $@
|
||||
|
||||
## the box's key to ask: 160 random bits; the box needs a copy, in /etc/pdtv26/ask-key
|
||||
$(CONF)/ask-key:
|
||||
|
||||
@@ -82,6 +82,14 @@ const IR_TOOLS = [
|
||||
required: ['code'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'mute_while_listening',
|
||||
description: 'Have the box mute the TV (or receiver, or sound bar) during every conversation, so it hears people over the show: it sends code when someone presses the button, and unmute_code (or code again, for a mute button that toggles) at goodbye. No code turns it off. The box cannot tell whether the TV is muted, so this is a setting, not a sensor: turn it on only with a mute code you have confirmed, and off if muting goes wrong (the TV left muted, or unmuted while listening). Changing the volume in a conversation can unmute some TVs, so that goodbye\'s toggle mutes them again: then use look, or ask, and fix it with ir_send.',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: { code: { type: 'string' }, unmute_code: { type: 'string' } },
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const LOOK_TOOL = {
|
||||
@@ -181,6 +189,11 @@ const main = async ({
|
||||
log(`ir_listen ${args.seconds}: ${JSON.stringify(heard)}`);
|
||||
return textResult(JSON.stringify(heard));
|
||||
}
|
||||
if (name === 'mute_while_listening') {
|
||||
const outcome = await callIr((ir) => ir.muteWhileListening(args.code || undefined, args.unmute_code || undefined));
|
||||
log(`mute_while_listening: ${outcome}`);
|
||||
return textResult(outcome);
|
||||
}
|
||||
const sent = await callIr((ir) => ir.send(String(args.code ?? ''), args.times ?? 1, args.gap_ms ?? 400));
|
||||
log(`ir_send: ${sent}`);
|
||||
return textResult(sent);
|
||||
|
||||
@@ -47,6 +47,7 @@ You can learn and send infrared codes for anything with an IR remote: the TV, th
|
||||
- NEC and Samsung codes come back as hex bytes. Samsung's carry the name ("samsung E0 E0 40 BF"); a Samsung TV ignores its code sent bare. Any other remote, Sony's for one, comes back raw, as pulse lengths ("raw 2400 600 1200 ...").
|
||||
- Send a code exactly as ir_listen reported it, every number. A raw code goes out as a short press.
|
||||
- Use times and gap_ms to step through an on-screen menu in one call: separate ir_send calls are too slow, and the menu closes.
|
||||
- mute_while_listening has the box mute whatever plays the sound (the TV, or a receiver) for each conversation, so you hear people over the show. The box can't tell whether it's muted; whether the setting is on is yours to decide. Turn it on only with a confirmed mute code; if it leaves the sound off, or mutes when it should unmute, turn it off and report it. Note the setting in your workspace.
|
||||
|
||||
### Codify what you learn
|
||||
|
||||
|
||||
Reference in new issue
Block a user