jsiegenthaler / homebridge-samsungtvht

Homebridge plugin for Samsung TV (D5000 series) and Home Theater (D5500 series) from ca 2011.
MIT License
13 stars 1 forks source link

Input change works but not staying on the last input #23

Open nitaybz opened 3 months ago

nitaybz commented 3 months ago

Describe The Bug: I've added 3 inputs for the 3 HDMI ports and it works great. the only issue I'm facing is that after changing the input it goes back to the first input and not staying on the last input.

To Reproduce: open the TV accessory, change input to the second or third, see it change in the TV but goes back to the first in the Home app.

Expected behavior: I know it is not possible for you to read the current input selected. however, the expected behavior would be to remember that last input that was set by the home app and show it as the current one

Logs:

[21/07/2024, 14:55:58] [Samsung TV HT] Office TV: getPower returning 0 [OFF]
[21/07/2024, 14:55:58] [Samsung TV HT] Office TV: getInput returning input 999 [UNKNOWN]
[21/07/2024, 14:55:59] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:55:59] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:55:59] [Samsung TV HT] Office TV: Power changed from 0 OFF to 1 ON
[21/07/2024, 14:55:59] [Samsung TV HT] Office TV: Media state changed from 0 PLAY to 2 STOP
[21/07/2024, 14:56:02] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:02] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:04] [Samsung TV HT] Office TV: getInput returning input 999 [UNKNOWN]
[21/07/2024, 14:56:04] [Samsung TV HT] Office TV: getPower returning 1 [ON]
[21/07/2024, 14:56:05] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:05] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:08] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:08] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:11] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:11] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:14] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:14] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:17] [Samsung TV HT] Office TV: setInput input: 2 HDMI2 (Chromecast) KEY_AUTO_ARC_PIP_WIDE
[21/07/2024, 14:56:17] [Samsung TV HT] Office TV: sendKey: keySequence KEY_AUTO_ARC_PIP_WIDE
[21/07/2024, 14:56:17] [Samsung TV HT] Office TV: sendKey: send KEY_AUTO_ARC_PIP_WIDE
[21/07/2024, 14:56:17] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:17] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:20] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:20] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:23] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:23] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:26] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:26] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:29] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:29] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:30] [Samsung TV HT] Office TV: setInput input: 3 HDMI3 (AppleTV) KEY_AUTO_ARC_PIP_RIGHT_BOTTOM
[21/07/2024, 14:56:30] [Samsung TV HT] Office TV: sendKey: keySequence KEY_AUTO_ARC_PIP_RIGHT_BOTTOM
[21/07/2024, 14:56:30] [Samsung TV HT] Office TV: sendKey: send KEY_AUTO_ARC_PIP_RIGHT_BOTTOM
[21/07/2024, 14:56:32] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:32] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:35] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:35] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:38] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:38] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:41] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:41] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:44] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:44] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:47] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:47] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:50] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:50] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:53] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:53] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:56] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:56] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]
[21/07/2024, 14:56:59] [Samsung TV HT] Office TV: updateDeviceState: powerState 1, mediaState undefined, inputId undefined
[21/07/2024, 14:56:59] [Samsung TV HT] Office TV: updateDeviceState: currentPowerState 1, currentMediaState 2 [STOP], currentInputId 999 [undefined]

Plugin Config:

        {
            "name": "Samsung TV HT",
            "pingCommand": "ping -c 1 -w 20",
            "pingInterval": 3,
            "pingResponseOff": "received, 100% packet",
            "doublePressTime": 250,
            "triplePressTime": 450,
            "doublePressDelayTime": 300,
            "debugLevel": 3,
            "devices": [
                {
                    "name": "Office TV",
                    "ipAddress": "10.0.0.102",
                    "type": "television",
                    "manufacturer": "Samsung",
                    "powerOnCommand": "echo 'on 0' | cec-client -s -d 1",
                    "powerOffButton": "KEY_POWEROFF",
                    "viewTvSettingsCommand": "KEY_MENU",
                    "inputs": [
                        {
                            "inputName": "HDMI1 (RPI)",
                            "inputKeyCode": "KEY_EXT20",
                            "inputSourceType": "3",
                            "inputDeviceType": "1"
                        },
                        {
                            "inputName": "HDMI2 (Chromecast)",
                            "inputKeyCode": "KEY_AUTO_ARC_PIP_WIDE",
                            "inputSourceType": "3",
                            "inputDeviceType": "1"
                        },
                        {
                            "inputName": "HDMI3 (AppleTV)",
                            "inputKeyCode": "KEY_AUTO_ARC_PIP_RIGHT_BOTTOM",
                            "inputSourceType": "3",
                            "inputDeviceType": "1"
                        }
                    ],
                    "arrowUpButton": "KEY_UP",
                    "arrowUpButtonDoubleTap": "KEY_CHUP",
                    "arrowUpButtonTripleTap": "KEY_UP",
                    "arrowDownButton": "KEY_DOWN",
                    "arrowDownButtonDoubleTap": "KEY_CHDOWN",
                    "arrowDownButtonTripleTap": "KEY_DOWN",
                    "arrowLeftButton": "KEY_LEFT",
                    "arrowLeftButtonDoubleTap": "KEY_REWIND",
                    "arrowLeftButtonTripleTap": "KEY_LEFT",
                    "arrowRightButton": "KEY_RIGHT",
                    "arrowRightButtonDoubleTap": "KEY_FF",
                    "arrowRightButtonTripleTap": "KEY_RIGHT",
                    "selectButton": "KEY_ENTER",
                    "selectButtonDoubleTap": "KEY_SOURCE",
                    "selectButtonTripleTap": "KEY_HDMI",
                    "playPauseButton": "KEY_PLAY",
                    "playPauseButtonDoubleTap": "KEY_PAUSE",
                    "playPauseButtonTripleTap": "KEY_STOP",
                    "backButton": "KEY_RETURN",
                    "backButtonDoubleTap": "KEY_EXIT",
                    "backButtonTripleTap": "KEY_RETURN",
                    "infoButton": "KEY_MENU",
                    "infoButtonDoubleTap": "KEY_INFO",
                    "infoButtonTripleTap": "KEY_TOOLS",
                    "volupButton": "KEY_VOLUP",
                    "voldownButton": "KEY_VOLDOWN",
                    "voldownButtonTriplePress": "KEY_MUTE",
                    "muteButton": "KEY_MUTE"
                }
            ],
            "platform": "samsungtvht"
        }

Environment:

jsiegenthaler commented 2 months ago

Working on this, will be in the next beta release

jsiegenthaler commented 2 months ago

@nitaybz try version 1.1.0-beta.1