AntonioMeireles / homebridge-vieramatic

Homebridge plugin for Panasonic™ Viera™ TVs (includes support for 2018 and later models)
Apache License 2.0
43 stars 9 forks source link

Can control TV on/off but not input switching. #103

Closed jat80 closed 2 months ago

jat80 commented 2 years ago

Hi there,

I can control the TV on off function but the HDMI inputs won't switch for some reason. Using the iOS Panasonic remote app works fine for all functions including input switching.

I've enabled HDMI inputs 1,2 and three. Even named the first one Apple TV which shows in home app but still won't switch the input when controlled in home app.

Any suggestions?

Panasonic TV model is TH-65HX700Z.
Connected to network via Ethernet cable. Installed using Homebridge config UI on MacOS

jat80 commented 2 years ago

My log ERROR - could be same issue as #97

[6/20/2022, 10:00:49 PM] [PanasonicVieraTV] setInput 1 HTTPError: Response code 500 (Internal Server Error)
    at Request.<anonymous> (file:///usr/local/lib/node_modules/homebridge-vieramatic/node_modules/got/dist/source/as-promise/index.js:86:42)
    at Object.onceWrapper (node:events:510:26)
    at Request.emit (node:events:402:35)
    at Request._onResponseBase (file:///usr/local/lib/node_modules/homebridge-vieramatic/node_modules/got/dist/source/core/index.js:697:22)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Request._onResponse (file:///usr/local/lib/node_modules/homebridge-vieramatic/node_modules/got/dist/source/core/index.js:736:13) {
  input: undefined,
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1655719249236,
    socket: 1655719249236,
    lookup: 1655719249237,
    connect: 1655719249237,
    secureConnect: undefined,
    upload: 1655719249237,
    response: 1655719249241,
    end: 1655719249242,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 0,
      dns: 1,
      tcp: 0,
      tls: undefined,
      request: 0,
      firstByte: 4,
      download: 1,
      total: 6
    }
  },
  options: {
    request: undefined,
    agent: { http: undefined, https: undefined, http2: undefined },
    h2session: undefined,
    decompress: true,
    timeout: {
      connect: undefined,
      lookup: undefined,
      read: undefined,
      request: 1500,
      response: undefined,
      secureConnect: undefined,
      send: undefined,
      socket: undefined
    },
    prefixUrl: '',
    body: '<?xml version="1.0" encoding="utf-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:X_EncryptedCommand xmlns:u="urn:panasonic-com:service:p00NetworkControl:1"><X_ApplicationId>AXpTgGhbNYruGA==</X_ApplicationId><X_EncInfo>M6KFtb1rmKcHL8wJjx8D+cbXCKH8kW08kuSexV77e7N/cEcOwkRFf9Hf+nqnGgDmbWjXpiKnfuaroumedFDN+bO32exPSPS8Gdgy/0BRQll7IfFNCR2kJ7Jdaiip9EPUFpo3WRgb1FX6NMtX640GjOzEhAO+pgywGX/KWtNyGGPx6iQhYmMr1stZwJVB9ym6AN8pNhhvtkdZpRgOo8mABd4zXB4sCUVoDrN2UeLul0YwhJfQV3UR9i5RuE8qbRxow3r1JaeBdpheHFROqBTIs38GFPP3lE+YEVaVdENiOrCTvW7C16JEJXrdfShgIrghl9Xm8HHt0r5Z3BBS0FGkPFkAocsBVDhp2nupOOvTE0Js1ZBefu6hOoKgDQoZBr0X</X_EncInfo></u:X_EncryptedCommand></s:Body></s:Envelope>',
    form: undefined,
    json: undefined,
    cookieJar: undefined,
    ignoreInvalidCookies: false,
    searchParams: undefined,
    dnsLookup: undefined,
    dnsCache: undefined,
    context: {},
    hooks: {
      init: [],
      beforeRequest: [],
      beforeError: [],
      beforeRedirect: [],
      beforeRetry: [],
      afterResponse: []
    },
    followRedirect: true,
    maxRedirects: 10,
    cache: undefined,
    throwHttpErrors: true,
    username: '',
    password: '',
    http2: false,
    allowGetBody: false,
    headers: {
      'user-agent': 'got (https://github.com/sindresorhus/got)',
      accept: 'application/xml',
      'cache-control': 'no-cache',
      'content-type': 'application/xml; charset="utf-8"',
      host: '192.168.1.3:55000',
      pragma: 'no-cache',
      soapaction: '"urn:panasonic-com:service:p00NetworkControl:1#X_EncryptedCommand"',
      'content-length': '751',
      'accept-encoding': 'gzip, deflate, br'
    },
    methodRewriting: false,
    dnsLookupIpVersion: undefined,
    parseJson: [Function: parse],
    stringifyJson: [Function: stringify],
    retry: {
      limit: 0,
      methods: [ 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ],
      statusCodes: [
        408, 413, 429, 500,
        502, 503, 504, 521,
        522, 524
      ],
      errorCodes: [
        'ETIMEDOUT',
        'ECONNRESET',
        'EADDRINUSE',
        'ECONNREFUSED',
        'EPIPE',
        'ENOTFOUND',
        'ENETUNREACH',
        'EAI_AGAIN'
      ],
      maxRetryAfter: undefined,
      calculateDelay: [Function: calculateDelay],
      backoffLimit: Infinity,
      noise: 100
    },
    localAddress: undefined,
    method: 'POST',
    createConnection: undefined,
    cacheOptions: {
      shared: undefined,
      cacheHeuristic: undefined,
      immutableMinTimeToLive: undefined,
      ignoreCargoCult: undefined
    },
    https: {
      alpnProtocols: undefined,
      rejectUnauthorized: undefined,
      checkServerIdentity: undefined,
      certificateAuthority: undefined,
      key: undefined,
      certificate: undefined,
      passphrase: undefined,
      pfx: undefined,
      ciphers: undefined,
      honorCipherOrder: undefined,
      minVersion: undefined,
      maxVersion: undefined,
      signatureAlgorithms: undefined,
      tlsSessionLifetime: undefined,
      dhparam: undefined,
      ecdhCurve: undefined,
      certificateRevocationLists: undefined
    },
    encoding: undefined,
    resolveBodyOnly: false,
    isStream: false,
    responseType: 'text',
    url: URL {
      href: 'http://192.168.1.3:55000/nrc/control_0',
      origin: 'http://192.168.1.3:55000',
      protocol: 'http:',
      username: '',
      password: '',
      host: '192.168.1.3:55000',
      hostname: '192.168.1.3',
      port: '55000',
      pathname: '/nrc/control_0',
      search: '',
      searchParams: URLSearchParams {},
      hash: ''
    },
    pagination: {
      transform: [Function: transform],
      paginate: [Function: paginate],
      filter: [Function: filter],
      shouldContinue: [Function: shouldContinue],
      countLimit: Infinity,
      backoff: 0,
      requestLimit: 10000,
      stackAllItems: false
    },
    setHost: true,
    maxHeaderSize: undefined
  }
}
jat80 commented 2 years ago

Also can't turn it off:

[6/20/2022, 10:25:28 PM] [PanasonicVieraTV] (setPowerStatus)/-> into STANDBY - unable to power cycle TV - unpowered ?

AntonioMeireles commented 2 years ago

Hi!

odd; some quick questions:

All the best and thanks for your patience!

jat80 commented 2 years ago

Hi!

odd; some quick questions:

  • does this worked before ?
  • is TV paired ? i.e. did you add to hb config the encryption key tuple ? (attach here plz your homebridge's config.json ...)
  • is everything quoted here enabled on your TV ?
  • ~are you connecting via wired or wirelessly ? (if wirelessly - can you try via cable ?)~
  • is your TV's IP address static and not randonly assinable via DHCP? (hint: HAS to be static...)

All the best and thanks for your patience!

I thought the on and off worked initially but the inputs haven't ever worked from what I recall. Now I think it was the HT sound bar that was using CEC to turn it on and off and I can't get it to work now.

My config: (removed actuall id and key as I'm not sure if this was sensitive information)

{ "platform": "PanasonicVieraTV", "tvs": [ { "appId": "removed for post but I have an id here", "customVolumeSlider": true, "encKey": "removed for post but has I have a key here", "friendlyName": "Lounge TV", "hdmiInputs": [ { "id": "1", "name": "Apple TV" }, { "id": "2", "name": "HDMI 2" }, { "id": "3", "name": "HDMI 3" } ], "ipAddress": "192.168.1.3" } ] }

Everything is enabled as per the wiki on the tv setup side. I can take photo if needed and post here.

TV IP is static.

Thanks for your time looking into this.

jat80 commented 4 months ago

I've fixed this by clearing all tv pairing connections on the Panasonic tv. Then following instructions from #118 to get plugin working 100%.

jat80 commented 3 months ago

Actually this is still an issue so re-opening it. Works fine for a day or two then stops responding to home app actions to turn on or off the tv or change any inputs. Have to restart child bridge for it to start working again.

here is my config:

{ "platform": "PanasonicVieraTV", "name": "PanasonicVieraTV", "tvs": [ { "friendlyName": "TV", "ipAddress": "192.168.1.3", "mac": "my Mac address for tv here", "appId": "hidden for privacy", "encKey": "hidden for privacy", "customVolumeSlider": false, "hdmiInputs": [ { "id": "1", "name": "Apple TV" }, { "id": "2", "name": "HDMI 2" }, { "id": "3", "name": "HDMI 3" } ] } ], "_bridge": { "username": "0E:8B:19:D7:75:54", "port": 31455 } }

Error in logs:

[06/05/2024, 12:26:09] [PanasonicVieraTV] setInput 3 HTTPError: Response code 500 (Internal Server Error) at Request. (file:///var/lib/homebridge/node_modules/homebridge-vieramatic/node_modules/got/dist/source/as-promise/index.js:86:42) at Object.onceWrapper (node:events:632:26) at Request.emit (node:events:529:35) at Request._onResponseBase (file:///var/lib/homebridge/node_modules/homebridge-vieramatic/node_modules/got/dist/source/core/index.js:726:22) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Request._onResponse (file:///var/lib/homebridge/node_modules/homebridge-vieramatic/node_modules/got/dist/source/core/index.js:765:13) { input: undefined, code: 'ERR_NON_2XX_3XX_RESPONSE', timings: { start: 1714955169754, socket: 1714955169754, lookup: 1714955169755, connect: 1714955169755, secureConnect: undefined, upload: 1714955169755, response: 1714955169760, end: 1714955169761, error: undefined, abort: undefined, phases: { wait: 0, dns: 1, tcp: 0, tls: undefined, request: 0, firstByte: 5, download: 1, total: 7 } }, options: { request: undefined, agent: { http: undefined, https: undefined, http2: undefined }, h2session: undefined, decompress: true, timeout: { connect: undefined, lookup: undefined, read: undefined, request: 1500, response: undefined, secureConnect: undefined, send: undefined, socket: undefined }, prefixUrl: '', body: '<?xml version="1.0" encoding="utf-8"?>AU0cSbgn6+yYoA==HDDhGghHdDUPNX0wMHJyMLqugeKa8MHzJLta3mDVOEL6VX+AzJ/HKOuwqE70Lnkd3Q/uVFNjWWmc/114IRfrdkrlcXrwbo+7wbHzBHEQaRmPf+z+dEasOd5b3AFT78kJCE5J4nKCsidFsFAAP98wEVxRBGtsQx4T0e0YvMlSmw28xJ7TBM/WnJnqfZalEAK04KHfxbJuirzUvrBDv0xXpBTt04AidDnEL6H4lNdAtUuD33zVaxHa+b2a5vM1dMvoReFdYl/YPu9402et50+pQVY5hQQNECOqwNNwu7F44HmB1ojbz4yhMd0i/jZMH+Udtssx9lQwyKcQLy3eryF/drZsVLYIV0pqLRwBAKBVWInlI8v7JcY7n0SlK+QcTZZN</u:X_EncryptedCommand></s:Body></s:Envelope>', form: undefined, json: undefined, cookieJar: undefined, ignoreInvalidCookies: false, searchParams: undefined, dnsLookup: undefined, dnsCache: undefined, context: {}, hooks: { init: [], beforeRequest: [], beforeError: [], beforeRedirect: [], beforeRetry: [], afterResponse: [] }, followRedirect: true, maxRedirects: 10, cache: undefined, throwHttpErrors: true, username: '', password: '', http2: false, allowGetBody: false, headers: { 'user-agent': 'got (https://github.com/sindresorhus/got)', accept: 'application/xml', 'cache-control': 'no-cache', 'content-type': 'application/xml; charset="utf-8"', host: '192.168.1.3:55000', pragma: 'no-cache', soapaction: '"urn:panasonic-com:service:p00NetworkControl:1#X_EncryptedCommand"', 'content-length': '751', 'accept-encoding': 'gzip, deflate, br' }, methodRewriting: false, dnsLookupIpVersion: undefined, parseJson: [Function: parse], stringifyJson: [Function: stringify], retry: { limit: 0, methods: [ 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ], statusCodes: [ 408, 413, 429, 500, 502, 503, 504, 521, 522, 524 ], errorCodes: [ 'ETIMEDOUT', 'ECONNRESET', 'EADDRINUSE', 'ECONNREFUSED', 'EPIPE', 'ENOTFOUND', 'ENETUNREACH', 'EAI_AGAIN' ], maxRetryAfter: undefined, calculateDelay: [Function: calculateDelay], backoffLimit: Infinity, noise: 100 }, localAddress: undefined, method: 'POST', createConnection: undefined, cacheOptions: { shared: undefined, cacheHeuristic: undefined, immutableMinTimeToLive: undefined, ignoreCargoCult: undefined }, https: { alpnProtocols: undefined, rejectUnauthorized: undefined, checkServerIdentity: undefined, certificateAuthority: undefined, key: undefined, certificate: undefined, passphrase: undefined, pfx: undefined, ciphers: undefined, honorCipherOrder: undefined, minVersion: undefined, maxVersion: undefined, signatureAlgorithms: undefined, tlsSessionLifetime: undefined, dhparam: undefined, ecdhCurve: undefined, certificateRevocationLists: undefined }, encoding: undefined, resolveBodyOnly: false, isStream: false, responseType: 'text', url: URL { href: 'http://192.168.1.3:55000/nrc/control_0', origin: 'http://192.168.1.3:55000', protocol: 'http:', username: '', password: '', host: '192.168.1.3:55000', hostname: '192.168.1.3', port: '55000', pathname: '/nrc/control_0', search: '', searchParams: URLSearchParams {}, hash: '' }, pagination: { transform: [Function: transform], paginate: [Function: paginate], filter: [Function: filter], shouldContinue: [Function: shouldContinue], countLimit: Infinity, backoff: 0, requestLimit: 10000, stackAllItems: false }, setHost: true, maxHeaderSize: undefined, signal: undefined, enableUnixSockets: true } }

Log when restarting child bridge - Note port numbers change but not sure if its because of the child bridge?

[06/05/2024, 12:41:23] [PanasonicVieraTV] Restarting child bridge... [06/05/2024, 12:41:23] Got SIGTERM, shutting down child bridge process... [06/05/2024, 12:41:28] [PanasonicVieraTV] Child bridge process ended [06/05/2024, 12:41:28] [PanasonicVieraTV] Process Ended. Code: 143, Signal: null [06/05/2024, 12:41:35] [PanasonicVieraTV] Restarting Process... [06/05/2024, 12:41:38] [PanasonicVieraTV] Launched child bridge with PID 1549791 [06/05/2024, 12:41:39] Registering platform 'homebridge-vieramatic.PanasonicVieraTV' [06/05/2024, 12:41:39] [PanasonicVieraTV] Loaded homebridge-vieramatic v4.0.51 child bridge successfully [06/05/2024, 12:41:39] Loaded 0 cached accessories from cachedAccessories.0E8B19D77554. [06/05/2024, 12:41:39] [PanasonicVieraTV] handling '192.168.1.3' from config.json [06/05/2024, 12:41:39] Homebridge v1.7.0 (HAP v0.11.1) (PanasonicVieraTV) is running on port 31455. [06/05/2024, 12:41:40] [PanasonicVieraTV] found a 'Panasonic VIErA' TV (TH-65HX700Z) at '192.168.1.3' (requires crypto for communication).

[06/05/2024, 12:41:40] [PanasonicVieraTV] successfully loaded TV [06/05/2024, 12:41:40] TV 7714 is running on port 42373. [06/05/2024, 12:41:40] Please add [TV 7714] manually in Home app. Setup Code: 031-45-156

Picture of my TV network settings for WOL etc:

IMG_3516

TV software version: 4.409 (latest as of time of comment)

I know @AntonioMeireles has been busy but I think this plugin is due for an update with the amount of errors etc happening.

One thing to note is for some reason now, the tv remote app from the iOS App Store doesn't work. It won't recognise my tv on the network when previously it has so think it maybe a Panasonic issue? Update on this - I deleted the app and re-installed it and it now works fine on my iPhone.

jat80 commented 2 months ago

Managed to sort this - see issue #118 and #123