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

2 different replies when TV is off #4

Closed carlosveny closed 2 years ago

carlosveny commented 2 years ago

Describe The Bug: The TV has 2 different types of replies to the ping when it's off so the plugin keeps sending logs indicating that it can't determine the state of the TV. The 2 replies are the following: 5 packets transmitted, 0 received, 100% packet loss, time 4047ms Destination Host Unreachable

To Reproduce: Turn ON or OFF the TV and wait for the logs to appear.

Expected behavior: I want to get rid of those annoying logs. The plugin works but my homebridge console is full of this warning logs. Probably the best way to solve this is to set 2 different commands for the OFF state. I don't know if this is possible.

Logs:

powerStateMonitor: WARNING Samsung TV cannot determine power state from ping result! stdout: PING X.X.X.X (X.X.X.X) 56(84) bytes of data.

--- X.X.X.X ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4047ms

Plugin Config:

{
            "name": "Samsung TV HT",
            "pingCommand": "ping -c 1 -w 5",
            "pingInterval": 2,
            "pingResponseOn": "received, 0% packet",
            "pingResponseOff": "Destination Host Unreachable",
            "doublePressTime": 250,
            "triplePressTime": 450,
            "doublePressDelayTime": 300,
            "devices": [
                {
                    "name": "Samsung TV",
                    "ipAddress": "192.168.2.218",
                    "type": "television",
                    "manufacturer": "Samsung",
                    "powerOnCommand": "echo 'on 0' | cec-client -s -d 1",
                    "powerOffButton": "KEY_POWEROFF",
                    "viewTvSettingsCommand": "KEY_MENU",
                    "inputs": [
                        {
                            "inputName": "TV",
                            "inputKeyCode": "KEY_TV",
                            "inputSourceType": "2",
                            "inputDeviceType": "1"
                        },
                        {
                            "inputName": "HDMI",
                            "inputKeyCode": "KEY_HDMI",
                            "inputSourceType": "3",
                            "inputDeviceType": "1"
                        },
                        {
                            "inputName": "Source",
                            "inputKeyCode": "KEY_SOURCE",
                            "inputSourceType": "0",
                            "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"
        }

Screenshots:

Environment:

jsiegenthaler commented 2 years ago

Interesting. It's not the TV replying as the TV cannot reply when it is off. It is the ping tool your are using that is returning the response.

You can test your ping response by using the command line and pinging a non-existing IP address on your network.

From your log above you should be able to set pingResponseOff to "100% packet loss" and it should be reliable.

carlosveny commented 2 years ago

Thanks for your reply. It actually works with "100% packet loss" and I don't get any log message. It's still weird the "Destination Host Unreachable" thing but anyways, thank you.

Also, is there any way to customize the icons of the Remote app?. I see the play/pause, back and information buttons but I would like to add the Source button. I know I can change the Source with the Input configuration tab of the plugin, but it's kinda weird changing the Source from the Homekit app and then having to go to the Remote app to change volume, channel, etc.

Anyways, thanks for your fast response and the reliability of your plugin, it works really well.

jsiegenthaler commented 2 years ago

Hi. the Remote Control layout is determined by Apple and can only be changed by Apple. I also wish they would make a better layout. Or allow a layout similar to the Apple TV layout.

The only thing possible to me was to enable single tap and double tap options on the buttons. So you can configure a double-tap to be a remote key (or key sequence) of your choice.

jsiegenthaler commented 2 years ago

All fixed. User needed to adapt his config