fix: don't wake screen on trackpad swipe
Swipe repeats DPAD every REPEAT_MS, so routing it through _wakeScreen fired turnOnScreen ~5x/sec for the whole gesture. _sendCommand takes a wake flag; the repeat path opts out. Pad taps, buttons, apps and volume still wake. Tradeoff: a swipe on an already-blanked panel no longer wakes it — tap first. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Vendored
+3
-3
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ha-tv-remote",
|
||||
"version": "1.5.1",
|
||||
"version": "1.5.2",
|
||||
"private": true,
|
||||
"description": "Mobile-friendly TV remote Lovelace card for Home Assistant",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const VERSION = "1.5.1";
|
||||
const VERSION = "1.5.2";
|
||||
|
||||
const POWER_POLL_THROTTLE_MS = 800;
|
||||
const POWER_POLL_POST_TOGGLE_DELAYS = [1500, 3500, 6000];
|
||||
@@ -332,8 +332,10 @@ class TvRemoteCard extends HTMLElement {
|
||||
}
|
||||
}
|
||||
|
||||
_sendCommand(cmd) {
|
||||
this._wakeScreen();
|
||||
// wake=false for the trackpad swipe: it repeats every REPEAT_MS, so waking
|
||||
// per tick would fire turnOnScreen ~5x/sec. Pad taps still wake.
|
||||
_sendCommand(cmd, wake = true) {
|
||||
if (wake) this._wakeScreen();
|
||||
this._hass.callService("remote", "send_command",
|
||||
{ command: cmd },
|
||||
{ entity_id: this._config.entities.remote });
|
||||
@@ -515,9 +517,9 @@ class TvRemoteCard extends HTMLElement {
|
||||
const startRepeat = (dir) => {
|
||||
clearRepeat();
|
||||
currentDir = dir;
|
||||
this._sendCommand(DIR_CMD[dir]);
|
||||
this._sendCommand(DIR_CMD[dir], false);
|
||||
repeatTimer = setInterval(() => {
|
||||
if (currentDir) this._sendCommand(DIR_CMD[currentDir]);
|
||||
if (currentDir) this._sendCommand(DIR_CMD[currentDir], false);
|
||||
}, REPEAT_MS);
|
||||
};
|
||||
const stopRepeat = () => { clearRepeat(); currentDir = null; };
|
||||
|
||||
Reference in New Issue
Block a user