seydx / homebridge-bravia-tvos

Homebridge plugin for Sony Bravia Android TVs
MIT License
347 stars 32 forks source link

Plugin gives an error with my Sony Bravia X7400H #150

Closed gauravkej closed 2 years ago

gauravkej commented 3 years ago

First of all, I must say what an amazing piece of work. I just entered the Homebridge ecosystem (last weekend) and I loved all the plugins that you have developed so far. Thank you for all the hard work!

I get the following 2 types of Errors when trying to use the plugin with my Sony Bravia X74H series (or X7400H).

Error Log from Homebridge: During Bootup

[20/07/2021, 12:14:11] [BraviaTVOS] BraviaTVW: An error occured during getting television state! [20/07/2021, 12:14:11] [BraviaTVOS] Error: getPlayingContentInfo at exports.request (/usr/local/lib/node_modules/homebridge-bravia-tvos/node_modules/@seydx/bravia/lib/request.js:80:21) at processTicksAndRejections (internal/process/task_queues.js:95:5) at ServiceProtocol.invoke (/usr/local/lib/node_modules/homebridge-bravia-tvos/node_modules/@seydx/bravia/lib/service.js:89:12) at Handler.getTelevisionState (/usr/local/lib/node_modules/homebridge-bravia-tvos/src/accessories/accessory.handler.js:16:24) at Handler.poll (/usr/local/lib/node_modules/homebridge-bravia-tvos/src/accessories/accessory.handler.js:458:7) { title: 'Invalid Response', code: 12, soap: {}, url: 'http://192.168.1.53/sony/avContent' }

During Runtime

[20/07/2021, 12:14:21] [BraviaTVOS] [DEBUG] BraviaTVW: Polling API... [20/07/2021, 12:14:21] [BraviaTVOS] BraviaTVW: An error occured during getting television state! [20/07/2021, 12:14:21] [BraviaTVOS] Error: getPlayingContentInfo at exports.request (/usr/local/lib/node_modules/homebridge-bravia-tvos/node_modules/@seydx/bravia/lib/request.js:80:21) at processTicksAndRejections (internal/process/task_queues.js:95:5) at ServiceProtocol.invoke (/usr/local/lib/node_modules/homebridge-bravia-tvos/node_modules/@seydx/bravia/lib/service.js:89:12) at Handler.getTelevisionState (/usr/local/lib/node_modules/homebridge-bravia-tvos/src/accessories/accessory.handler.js:16:24) at Handler.poll (/usr/local/lib/node_modules/homebridge-bravia-tvos/src/accessories/accessory.handler.js:458:7) { title: 'Invalid Response', code: 12, soap: {}, url: 'http://192.168.1.53/sony/avContent' }

For Debugging, I tried manually checking what all APIs are supported by the model that I have using the "getSupportedApiInfo()" for the avContent service and here's the result:

{

"method": "getSupportedApiInfo",
"id": 5,
"params": [{"services": [
    "system",
    "avContent",
    "appControl"
]}],
"version": "1.0"

}

And I got the following response.

{

"result": [
    [
        {
            "service": "system",
            "protocols": [
                "xhrpost:jsonizer"
            ],
            "apis": [
                {
                    "name": "getMethodTypes",
                    "versions": [
                        {
                            "version": "1.0"
                        }
                    ]
                },
                {
                    "name": "getVersions",
                    "versions": [
                        {
                            "version": "1.0"
                        }
                    ]
                },
                {
                    "name": "requestReboot",
                    "versions": [
                        {
                            "version": "1.0",
                            "authLevel": "generic"
                        }
                    ]
                },
                {
                    "name": "setPowerStatus",
                    "versions": [
                        {
                            "version": "1.0",
                            "authLevel": "generic"
                        }
                    ]
                },
                {
                    "name": "getInterfaceInformation",
                    "versions": [
                        {
                            "version": "1.0"
                        }
                    ]
                },
                {
                    "name": "getNetworkSettings",
                    "versions": [
                        {
                            "version": "1.0",
                            "authLevel": "generic"
                        }
                    ]
                },
                {
                    "name": "getPowerStatus",
                    "versions": [
                        {
                            "version": "1.0"
                        }
                    ]
                },
                {
                    "name": "getCurrentTime",
                    "versions": [
                        {
                            "version": "1.0"
                        },
                        {
                            "version": "1.1"
                        }
                    ]
                },
                {
                    "name": "getSystemInformation",
                    "versions": [
                        {
                            "version": "1.0",
                            "authLevel": "private"
                        }
                    ]
                },
                {
                    "name": "getRemoteControllerInfo",
                    "versions": [
                        {
                            "version": "1.0"
                        }
                    ]
                }
            ]
        },
        {
            "service": "appControl",
            "protocols": [
                "xhrpost:jsonizer"
            ],
            "apis": [
                {
                    "name": "getMethodTypes",
                    "versions": [
                        {
                            "version": "1.0"
                        }
                    ]
                },
                {
                    "name": "getVersions",
                    "versions": [
                        {
                            "version": "1.0"
                        }
                    ]
                },
                {
                    "name": "setActiveApp",
                    "versions": [
                        {
                            "version": "1.0",
                            "authLevel": "generic"
                        }
                    ]
                },
                {
                    "name": "getApplicationList",
                    "versions": [
                        {
                            "version": "1.0",
                            "authLevel": "private"
                        }
                    ]
                }
            ]
        },
        {
            "service": "avContent",
            "protocols": [
                "xhrpost:jsonizer"
            ],
            "apis": [
                {
                    "name": "getMethodTypes",
                    "versions": [
                        {
                            "version": "1.0"
                        }
                    ]
                },
                {
                    "name": "getVersions",
                    "versions": [
                        {
                            "version": "1.0"
                        }
                    ]
                },
                {
                    "name": "getContentList",
                    "versions": [
                        {
                            "version": "1.0",
                            "authLevel": "private"
                        }
                    ]
                },
                {
                    "name": "getSchemeList",
                    "versions": [
                        {
                            "version": "1.0"
                        }
                    ]
                },
                {
                    "name": "getSourceList",
                    "versions": [
                        {
                            "version": "1.0"
                        }
                    ]
                },
                {
                    "name": "setPlayContent",
                    "versions": [
                        {
                            "version": "1.0",
                            "authLevel": "generic"
                        }
                    ]
                },
                {
                    "name": "getContentCount",
                    "versions": [
                        {
                            "version": "1.0",
                            "authLevel": "private"
                        }
                    ]
                },
                {
                    "name": "getCurrentExternalInputsStatus",
                    "versions": [
                        {
                            "version": "1.0"
                        }
                    ]
                }
            ]
        }
    ]
],
"id": 5

}

My thoughts so far: It appears that my TV model doesn't support "getPlayingContentInfo()" and hence the plugin fails to recognize the capabilities. If we can disable or bypass the getPlayingCintentinfo section then we should be able to still control and use the TV for all the other functionalities.

It'll be really helpful if you can please look into this and implement a fix for this. I'll be happy to provide whatever logs or info that is required for debugging this.

Paden commented 3 years ago

Great plugin, guys! Same issue with the x750H. I cannot get Applications/Custom Commands to work as well. I am guessing it has to do with this erroring out.

seydx commented 2 years ago

Added/Fixed in v5.0.6 (beta)

sudo npm i -g homebridge-bravia-tvos@beta

Paden commented 2 years ago

Thanks, @SeydX! Looking forwarded to this being released

seydx commented 2 years ago

@Paden

can you test it pls, maybe i need to fix some more stuff before release it

Paden commented 2 years ago

The error has gone away but I am still unable to switch Applications via HomeKit. Looking at the logs I get a "Polling API..." message followed by a "Unknown Service Method" message. Those two messages show up over and over again.

seydx commented 2 years ago

Yeah they are only visible if you enabled debug.

What kind of input you try to activate? App? Channel? Command?

Paden commented 2 years ago

App

seydx commented 2 years ago

@Paden

it seems your tv also doesnt support the required service method „setActiveApp“ to controll Applications.

can u try to debug your tv like the OP

"method": "getSupportedApiInfo",
"id": 5,
"params": [{"services": [
    "system",
    "avContent",
    "appControl"
]}],
"version": "1.0"

and can u try to activate a channel or input source (like hdmi) instead of an Application pls

Paden commented 2 years ago

image Looks like it doesn't even support getSupportedApiInfo -- I'll try the input source a bit later

seydx commented 2 years ago

There is a much simpler method

Install my bravia module globally with:

sudo npm i -g @seydx/bravia@beta

and enter following in your terminal

bravia methods TVIP

(eg bravia methods 192.123.123.12)

it should list all available services and methods

Paden commented 2 years ago

That was helpful! Oddly enough it does show setActiveApp

[
  {
    "service": "accessControl",
    "methods": []
  },
  {
    "service": "appControl",
    "methods": [
      [
        {
          "method": "getApplicationList",
          "version": "1.0"
        },
        {
          "method": "setActiveApp",
          "version": "1.0"
        },
        {
          "method": "getMethodTypes",
          "version": "1.0"
        },
        {
          "method": "getVersions",
          "version": "1.0"
        }
      ]
    ]
  },
  {
    "service": "audio",
    "methods": [
      {
        "method": "getVolumeInformation",
        "version": "1.0"
      },
      {
        "method": "setAudioMute",
        "version": "1.0"
      },
      {
        "method": "setAudioVolume",
        "version": "1.0"
      },
      {
        "method": "getMethodTypes",
        "version": "1.0"
      },
      {
        "method": "getVersions",
        "version": "1.0"
      },
      {
        "method": "setAudioVolume",
        "version": "1.2"
      }
    ]
  },
  {
    "service": "avContent",
    "methods": [
      [
        {
          "method": "getContentCount",
          "version": "1.0"
        },
        {
          "method": "getContentList",
          "version": "1.0"
        },
        {
          "method": "getCurrentExternalInputsStatus",
          "version": "1.0"
        },
        {
          "method": "getSchemeList",
          "version": "1.0"
        },
        {
          "method": "getSourceList",
          "version": "1.0"
        },
        {
          "method": "setPlayContent",
          "version": "1.0"
        },
        {
          "method": "getMethodTypes",
          "version": "1.0"
        },
        {
          "method": "getVersions",
          "version": "1.0"
        }
      ]
    ]
  },
  {
    "service": "browser",
    "methods": []
  },
  {
    "service": "cec",
    "methods": []
  },
  {
    "service": "contentshare",
    "methods": []
  },
  {
    "service": "encryption",
    "methods": []
  },
  {
    "service": "guide",
    "methods": [
      [
        {
          "method": "getServiceProtocols",
          "version": "1.0"
        },
        {
          "method": "getSupportedApiInfo",
          "version": "1.0"
        },
        {
          "method": "getMethodTypes",
          "version": "1.0"
        },
        {
          "method": "getVersions",
          "version": "1.0"
        }
      ]
    ]
  },
  {
    "service": "recording",
    "methods": []
  },
  {
    "service": "system",
    "methods": [
      {
        "method": "getCurrentTime",
        "version": "1.0"
      },
      {
        "method": "getInterfaceInformation",
        "version": "1.0"
      },
      {
        "method": "getNetworkSettings",
        "version": "1.0"
      },
      {
        "method": "getPowerStatus",
        "version": "1.0"
      },
      {
        "method": "getRemoteControllerInfo",
        "version": "1.0"
      },
      {
        "method": "getSystemInformation",
        "version": "1.0"
      },
      {
        "method": "requestReboot",
        "version": "1.0"
      },
      {
        "method": "setPowerStatus",
        "version": "1.0"
      },
      {
        "method": "getMethodTypes",
        "version": "1.0"
      },
      {
        "method": "getVersions",
        "version": "1.0"
      },
      {
        "method": "getCurrentTime",
        "version": "1.1"
      }
    ]
  },
  {
    "service": "video",
    "methods": []
  },
  {
    "service": "videoScreen",
    "methods": []
  }
]
seydx commented 2 years ago

I will check it thx

seydx commented 2 years ago

@Paden

can u try latest Beta pls v5.0.6-beta.5

sudo npm i -g homebridge-bravia-tvos@beta

Paden commented 2 years ago

Same problem image

seydx commented 2 years ago

Yeah thats because your tv does not support getPlayingContentInfo

that was expected and can be muted if you disable debug

But how about changing inputs/apps ?

seydx commented 2 years ago

v5.0.6-beta.6 is online

it should show which service method exactly fails

sudo npm i -g homebridge-bravia-tvos@beta

Paden commented 2 years ago

Yes, now I see Service Methods "getPlayingContentInfo" not known! happen over and over now.

seydx commented 2 years ago

@Paden

is the TV turned on during the action?

Paden commented 2 years ago

Yes, it is. The power on/off, Back, and Volume control all still work via HomeKit.

seydx commented 2 years ago

v5.0.6-beta.7 is online

sudo npm i -g homebridge-bravia-tvos@beta

Paden commented 2 years ago

Hey check that out! Apps and Inputs both work now! Well done!

seydx commented 2 years ago

Puhh, very nice 😄