seydx / homebridge-bravia-tvos

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

[BETA] Version 3 - Bugfix Thread #32

Closed seydx closed 4 years ago

seydx commented 5 years ago

Hey everyone,

as some of you may know, I am currently working on the v3 of my Bravia plugin. Most of it is already done. Currently I'm looking for beta testers to wipe out the remaining bugs and / or incorporate new requests.

Here you can read how to install the plugin and how to set it:

https://github.com/SeydX/homebridge-bravia-tvos/tree/beta https://github.com/SeydX/homebridge-bravia-tvos/blob/beta/example-config.json

Note: Before you install the new plugin, I recommend you to delete the old plugin and remove it from HomeKit! And also delete the accessories and persist folders.

Then download the new plugin, install it, enter it in config.json, restart Homebridge and there you go!

seydx commented 5 years ago

@hmook

Open 2 terminals

On 1:

avahi-browse --verbose _hap._tcp

(Let this opened)

On 2. reset plugin/homebridge instance Re add to HomeKit

After 2. Post the output from 1. (need also the name of the homebridge instance

hmook commented 5 years ago

Hi @SeydX

Hereby the output:

Server version: avahi 0.6.32; Host name: raspberrypi.local
E Ifce Prot Name                                          Type                 Domain
+   eth0 IPv6 Netatmo Presence                              _hap._tcp            local
+   eth0 IPv6 Lyric-F0402F                                  _hap._tcp            local
+   eth0 IPv6 Aqara Hub-1019                                _hap._tcp            local
+   eth0 IPv6 Philips hue - 23FC46                          _hap._tcp            local
+   eth0 IPv4 Homebridge-67B8                               _hap._tcp            local
+   eth0 IPv4 Netatmo Presence                              _hap._tcp            local
+   eth0 IPv4 Lyric-F0402F                                  _hap._tcp            local
+   eth0 IPv4 Aqara Hub-1019                                _hap._tcp            local
+   eth0 IPv4 Philips hue - 23FC46                          _hap._tcp            local
+   eth0 IPv4 Sonoff Switch-320A6E                          _hap._tcp            local
+   eth0 IPv4 Sonoff Switch-585052                          _hap._tcp            local
+   eth0 IPv4 Homebridge-1061                               _hap._tcp            local
: Cache exhausted
: All for now
+   eth0 IPv4 Homebridge-122D                               _hap._tcp            local
-   eth0 IPv4 Homebridge-67B8                               _hap._tcp            local
seydx commented 5 years ago

+eth0 IPv4 Homebridge-67B8

+eth0 IPv4 Homebridge-122D -eth0 IPv4 Homebridge-67B8

Here is the issue, homebridge connects to homekit (Homebridge-67B8) after few minutes it creates a new connection (Homebridge-122D) and removes the first one which you have added to Apple Home (Homebridge-67B8)

But why...

hmook commented 5 years ago

@SeydX I do use two different RaspberryPi's running homebridge. The first one is running stable especially to manage my lights. The other one is for testing the beta plugin.

seydx commented 5 years ago

@hmook

Can you remove the plugin AND remove also the homebridge instance where the plugin was running

Than, install it again and create a new homebridge instance, set a new config.json with only base prameter

        {
          "name": "Sony",
          "ip": "192.168.178.3",
          "port": 80,
          "psk": "test123"
        }

after this, start homebridge in debug mode (-D), add the accessory to Apple Home and wait till accessory got ‚no response‘

Post the output

hmook commented 5 years ago

So I've took an clean SD-card did a complete new installation of docker-homebridge by oznu.

After the installation I have enabled debug mode (-D) and installed the Bravia Beta plugin. After that I've edited my config file and did a restart of the docker container and homebridge. Then I added the homebridge installation to my Apple Home. The following log showed:

[4/10/2019, 2:39:49 PM] [homebridge-config-ui-x] Homebridge restart request received
[4/10/2019, 2:39:49 PM] [homebridge-config-ui-x] Executing restart command: killall -9 homebridge && killall -9 homebridge-config-ui-x
[4/10/2019, 2:39:53 PM] [homebridge-config-ui-x] Using Form Authentication
[4/10/2019, 2:39:53 PM] [homebridge-config-ui-x] Console v3.11.0 is listening on port 8080.
[4/10/2019, 2:39:54 PM] Loaded config.json with 0 accessories and 1 platforms.
[4/10/2019, 2:39:54 PM] ---
[4/10/2019, 2:39:54 PM] Loaded plugin: homebridge-dummy
[4/10/2019, 2:39:54 PM] Registering accessory 'homebridge-dummy.DummySwitch'
[4/10/2019, 2:39:54 PM] ---
[4/10/2019, 2:39:54 PM] Plugin /usr/local/lib/node_modules/homebridge-bravia-tvos requires Node version of ^8.9.1 which does not satisfy the current Node version of v10.15.3. You may need to upgrade your installation of Node.
[4/10/2019, 2:39:54 PM] Loaded plugin: homebridge-bravia-tvos
[4/10/2019, 2:39:54 PM] Registering platform 'homebridge-bravia-tvos.BraviaOSPlatform'
[4/10/2019, 2:39:54 PM] ---
[4/10/2019, 2:39:54 PM] Loaded plugin: homebridge-config-ui-x
[4/10/2019, 2:39:54 PM] Registering platform 'homebridge-config-ui-x.config'
[4/10/2019, 2:39:54 PM] ---
[4/10/2019, 2:39:54 PM] Loading 1 platforms...
[4/10/2019, 2:39:54 PM] [BraviaOSPlatform] Initializing BraviaOSPlatform platform...
[4/10/2019, 2:39:54 PM] [BraviaOSPlatform] **************************************************************
[4/10/2019, 2:39:54 PM] [BraviaOSPlatform] BraviaOSPlatform v3.0.0 by SeydX
[4/10/2019, 2:39:54 PM] [BraviaOSPlatform] GitHub: https://github.com/SeydX/homebridge-bravia-tvos
[4/10/2019, 2:39:54 PM] [BraviaOSPlatform] Email: seyd55@outlook.de
[4/10/2019, 2:39:54 PM] [BraviaOSPlatform] **************************************************************
[4/10/2019, 2:39:54 PM] [BraviaOSPlatform] start success...
[4/10/2019, 2:39:54 PM] Loading 0 accessories...
[4/10/2019, 2:39:54 PM] [BraviaOSPlatform] [INFO] Configuring accessory Woonkamer Televisie
Setup Payload:
X-HM://00251LYE6PM23
Scan this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
     │ HOMEKIT CODE                   |
    └────────────┘     

Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
     │ HOMEKIT CODE                   |
    └────────────┘     

[4/10/2019, 2:39:55 PM] Homebridge is running on port 51826.
[4/10/2019, 2:40:55 PM] [BraviaOSPlatform] [INFO] Woonkamer Televisie: Hi!

Had avahi-browse --verbose _hap._tcp running in the back as well (on my stable homebridge raspberrypi) gave me this:

Server version: avahi 0.6.32; Host name: homebridge.local
E Ifce Prot Name                                          Type                 Domain
+   eth0 IPv6 Netatmo Presence                              _hap._tcp            local
+   eth0 IPv6 Lyric-F0402F                                  _hap._tcp            local
+   eth0 IPv6 Philips hue - 23FC46                          _hap._tcp            local
+   eth0 IPv6 Aqara Hub-1019                                _hap._tcp            local
+   eth0 IPv4 Homebridge-1061                               _hap._tcp            local
+   eth0 IPv4 Netatmo Presence                              _hap._tcp            local
+   eth0 IPv4 Lyric-F0402F                                  _hap._tcp            local
+   eth0 IPv4 Sonoff Switch-320A6E                          _hap._tcp            local
+   eth0 IPv4 Philips hue - 23FC46                          _hap._tcp            local
+   eth0 IPv4 Sonoff Switch-585052                          _hap._tcp            local
+   eth0 IPv4 Aqara Hub-1019                                _hap._tcp            local
: Cache exhausted
: All for now
+   eth0 IPv4 Homebridge-CAD8                               _hap._tcp            local
+   eth0 IPv4 Homebridge-ACD0                               _hap._tcp            local
-   eth0 IPv4 Homebridge-CAD8                               _hap._tcp            local

Homebridge-CAD8 is the initial Homebridge install with standard homekitcode. After Homebridge reset it was changed in Homebridge-ACD0. So there for CAD8 is removed and ACD0 is added I guess.

seydx commented 5 years ago

@hmook

After init homebridge install and start CAD8 appeared and after restarting for plugin it was removed and replaced by ACD0 ?

seydx commented 5 years ago

Or is ACD0 appeared after adding to Apple Home?

seydx commented 5 years ago

Btw the log you posted is not from debug mode, the post you did earlier with

EventedHTTPServer Server listening on port 37095 +0ms
[4/5/2019, 12:46:06 PM] Homebridge is running on port 37095.
  EventedHTTPServer [::ffff:10.0.1.84] New connection from client +21s
  EventedHTTPServer [::ffff:10.0.1.84] HTTP server listening on port 37091 +6ms
  EventedHTTPServer [fe80::83e:c310:ceae:42e] New connection from client +24ms

This is the debug mode, i need a log like this

seydx commented 5 years ago

@hmool

which router u have? FritzBox?

hmook commented 5 years ago

@SeydX no i have a few AirPorts running all wired.

seydx commented 5 years ago

@hmook

Can you turn off igmp snooping and try again with debug mode pls

hmook commented 5 years ago

@SeydX igmp snooping was never on in my case.

fugazzy commented 5 years ago

Today I did a clean new install in a separate instance for testing. Now i Get: (node:2597) UnhandledPromiseRejectionWarning: TypeError: input.getCharacteristic is not a function at inputs.map.input (/usr/local/lib/node_modules/homebridge-bravia-tvos/src/accessory.js:220:13) at Array.map (<anonymous>) at TelevisionAccessory.getService (/usr/local/lib/node_modules/homebridge-bravia-tvos/src/accessory.js:218:17) at TelevisionAccessory.handleAccessory (/usr/local/lib/node_modules/homebridge-bravia-tvos/src/accessory.js:104:12) (node:2597) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:2597) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js proc ess with a non-zero exit code. Switching the TV on/off still works but I do not get any inputs anymore

seydx commented 5 years ago

Hmmm, tried restarting homebridge? @fugazzy

fugazzy commented 5 years ago

Yes, but for now I went back to an earlier version npm i --save SeydX/homebridge-bravia-tvos#beb7dd91bdaf751bf5b9bf4f59c27b336d0b5296  that works fine for now. Adding commands ChannelUp and ChannelDown lets me switch from eg. HDMI2 to TV (DVBC) - very nice :-) Adding Channels does not seem to work. I do get another tile in Apple Home, but without any function.

seydx commented 5 years ago

@ all

Rewritten great part of the code to support older models without PSK functionality! For these without PSK (or for these they want a secure login without using PSK), just remove the psk parameter from config.json and restart homebridge! Follow the instructions in the LOG to pair your TV with the plugin!

fugazzy commented 5 years ago

Tried again a separate clean new install: ` [37m[4/13/2019, 11:27:55 AM] [BraviaOSPlatform] [INFO] Adding new accessory: Sony TV

[4/13/2019, 11:27:55 AM] [BraviaOSPlatform] [INFO] Sony TV: Initalizing Bravia API with PSK

[4/13/2019, 11:27:55 AM] [BraviaOSPlatform] [INFO] Sony TV: Cheking authentication...

[4/13/2019, 11:27:55 AM] Homebridge is running on port 51829.

[4/13/2019, 11:27:55 AM] [BraviaOSPlatform] [INFO] Sony TV: Authenticated!

[4/13/2019, 11:27:55 AM] [BraviaOSPlatform] [ERROR] Sony TV: Error while getting new inputs!

[4/13/2019, 11:27:55 AM] [BraviaOSPlatform] [ERROR] Sony TV: Please fix the issue and restart homebridge!

[4/13/2019, 11:27:55 AM] [BraviaOSPlatform] [ERROR] TypeError: Cannot set property 'X-Auth-PSK' of undefined

` { "bridge" : { "name" : "Homebridge-test", "username" : "CC:22:3D:E3:CE:33", "port" : 51829, "pin" : "031-45-154" }, "description": "This is an sample-config for selective load from det",

"accessories" : [

],

 "platforms" : [
    {
    "platform": "BraviaOSPlatform",
        "tvs": [
            {
                "name": "Sony TV",
                "ip": "192.168.108.24",
                "psk": "xxx",
                "channelInputs": ["DVBC"], 
                "channels": [
                    {
                        "channel":101,
                        "source":"DVBC"
                    },
                    {
                        "channel":102,
                        "source":"DVBC"
                    }
                ],
                "commands": [
                      "AAAAAQAAAAEAAAAQAw==",
                      "AAAAAQAAAAEAAAARAw==",
                      "AAAAAQAAAAEAAABgAw==",
                      "AAAAAgAAAJcAAAAjAw==",
                      "AAAAAgAAAJcAAAA2Aw==",
                      "AAAAAQAAAAEAAAA6Aw=="
                ],
                "wol": false
                }
            ],
            "interval": 10
        }

]

} `

donavanbecker commented 5 years ago

This is what I am getting. When I use the plugin homebridge-bravia, that plugin works fine but I want the functionality of your plugin since you have more features then that one.

Apr 13 09:05:20 HomeBridge homebridge[398]: 2019-04-13T14:05:20.796Z BraviaPlatformApi [Bravia Debug]: api request 2: post /sony/avContent - getCurrentExternalInputsStatus
Apr 13 09:05:20 HomeBridge homebridge[398]: 2019-04-13T14:05:20.803Z follow-redirects options { maxRedirects: 21,
Apr 13 09:05:20 HomeBridge homebridge[398]:   maxBodyLength: 10485760,
Apr 13 09:05:20 HomeBridge homebridge[398]:   protocol: 'http:',
Apr 13 09:05:20 HomeBridge homebridge[398]:   path: '/sony/avContent',
Apr 13 09:05:20 HomeBridge homebridge[398]:   method: 'post',
Apr 13 09:05:20 HomeBridge homebridge[398]:   headers:
Apr 13 09:05:20 HomeBridge homebridge[398]:    { Accept: 'application/json, text/plain, */*',
Apr 13 09:05:20 HomeBridge homebridge[398]:      'Content-Type': 'application/json',
Apr 13 09:05:20 HomeBridge homebridge[398]:      Cookie: 'auth=DE75612F2889DF05804BF6BDD2A924ACE1A5831C',
Apr 13 09:05:20 HomeBridge homebridge[398]:      'User-Agent': 'axios/0.18.0',
Apr 13 09:05:20 HomeBridge homebridge[398]:      'Content-Length': 78 },
Apr 13 09:05:20 HomeBridge homebridge[398]:   agent: undefined,
Apr 13 09:05:20 HomeBridge homebridge[398]:   auth: undefined,
Apr 13 09:05:20 HomeBridge homebridge[398]:   hostname: '192.168.7.11',
Apr 13 09:05:20 HomeBridge homebridge[398]:   port: '80',
Apr 13 09:05:20 HomeBridge homebridge[398]:   nativeProtocols:
Apr 13 09:05:20 HomeBridge homebridge[398]:    { 'http:':
Apr 13 09:05:20 HomeBridge homebridge[398]:       { _connectionListener: [Function: connectionListener],
Apr 13 09:05:20 HomeBridge homebridge[398]:         METHODS: [Array],
Apr 13 09:05:20 HomeBridge homebridge[398]:         STATUS_CODES: [Object],
Apr 13 09:05:20 HomeBridge homebridge[398]:         Agent: [Function],
Apr 13 09:05:20 HomeBridge homebridge[398]:         ClientRequest: [Function],
Apr 13 09:05:20 HomeBridge homebridge[398]:         globalAgent: [Agent],
Apr 13 09:05:20 HomeBridge homebridge[398]:         IncomingMessage: [Function],
Apr 13 09:05:20 HomeBridge homebridge[398]:         OutgoingMessage: [Function],
Apr 13 09:05:20 HomeBridge homebridge[398]:         Server: [Function],
Apr 13 09:05:20 HomeBridge homebridge[398]:         ServerResponse: [Function],
Apr 13 09:05:20 HomeBridge homebridge[398]:         createServer: [Function: createServer],
Apr 13 09:05:20 HomeBridge homebridge[398]:         get: [Function: get],
Apr 13 09:05:20 HomeBridge homebridge[398]:         request: [Function: request] },
Apr 13 09:05:20 HomeBridge homebridge[398]:      'https:':
Apr 13 09:05:20 HomeBridge homebridge[398]:       { Agent: [Function],
Apr 13 09:05:20 HomeBridge homebridge[398]:         globalAgent: [Agent],
Apr 13 09:05:20 HomeBridge homebridge[398]:         Server: [Function],
Apr 13 09:05:20 HomeBridge homebridge[398]:         createServer: [Function: createServer],
Apr 13 09:05:20 HomeBridge homebridge[398]:         get: [Function: get],
Apr 13 09:05:20 HomeBridge homebridge[398]:         request: [Function: request] } } }
Apr 13 09:05:21 HomeBridge homebridge[398]: 2019-04-13T14:05:21.060Z BraviaPlatformApi [Bravia Debug]: api request 2: Uknown - {"config":{"transformRequest":{},"transformResponse":{},"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json","Cookie":"auth=DE75612F2889DF05804BF6BDD2A924ACE1A5831C","User-Agent":"axios/0.18.0","Content-Length":78},"method":"post","url":"http://192.168.7.11:80/sony/avContent","data":"{\"id\":1,\"method\":\"getCurrentExternalInputsStatus\",\"version\":\"1.0\",\"params\":[]}"}}
Apr 13 09:05:21 HomeBridge homebridge[398]: [2019-4-13 09:05:21] [Sony TV] [ERROR] Sony TV: Error while getting new inputs!
Apr 13 09:05:21 HomeBridge homebridge[398]: [2019-4-13 09:05:21] [Sony TV] [ERROR] Sony TV: Please fix the issue and restart homebridge!
Apr 13 09:05:21 HomeBridge homebridge[398]: [2019-4-13 09:05:21] [Sony TV] [ERROR] [object Object]
seydx commented 5 years ago

@fugazzy @d0n4v4nb3ck3r

Can you reinstall the plugin and restart homebridge pls. After restart we should be able to see the error

fugazzy commented 5 years ago

here is what I get now: [4/13/2019, 2:28:01 PM] [BraviaOSPlatform] [INFO] Adding new accessory: Sony TV [4/13/2019, 2:28:01 PM] [BraviaOSPlatform] [INFO] Sony TV: Initalizing Bravia API with PSK [4/13/2019, 2:28:01 PM] [BraviaOSPlatform] [INFO] Sony TV: Cheking authentication... [4/13/2019, 2:28:01 PM] Homebridge is running on port 51829. [4/13/2019, 2:28:01 PM] [BraviaOSPlatform] [INFO] Sony TV: Authenticated! [4/13/2019, 2:28:03 PM] [BraviaOSPlatform] [ERROR] Sony TV: Error while getting new inputs! [4/13/2019, 2:28:03 PM] [BraviaOSPlatform] [ERROR] Sony TV: Please fix the issue and restart homebridge! TypeError: Cannot set property 'X-Auth-PSK' of undefined at Promise (/homebridge/node_modules/homebridge-bravia-tvos/lib/Bravia.js:399:36) at new Promise (<anonymous>) at Bravia._refreshToken (/homebridge/node_modules/homebridge-bravia-tvos/lib/Bravia.js:395:12) at Promise (/homebridge/node_modules/homebridge-bravia-tvos/lib/Bravia.js:474:14) at new Promise (<anonymous>) at Bravia.apiCall (/homebridge/node_modules/homebridge-bravia-tvos/lib/Bravia.js:471:12) at process._tickCallback (internal/process/next_tick.js:68:7)

seydx commented 5 years ago

@fugazzy

Updated! Can u reinstall and try again pls

fugazzy commented 5 years ago

now: 37m[4/13/2019, 2:47:44 PM] [BraviaOSPlatform] [INFO] Adding new accessory: Sony TV [4/13/2019, 2:47:44 PM] [BraviaOSPlatform] [INFO] Sony TV: Initalizing Bravia API with PSK [4/13/2019, 2:47:44 PM] [BraviaOSPlatform] [INFO] Sony TV: Cheking authentication... [4/13/2019, 2:47:44 PM] Homebridge is running on port 51829. [4/13/2019, 2:47:44 PM] [BraviaOSPlatform] [INFO] Sony TV: Authenticated! [4/13/2019, 2:47:45 PM] [BraviaOSPlatform] [ERROR] Sony TV: Error while getting new inputs! [4/13/2019, 2:47:45 PM] [BraviaOSPlatform] [ERROR] Sony TV: Please fix the issue and restart homebridge! { status: undefined, message: undefined, config: { adapter: [Function: httpAdapter], transformRequest: { '0': [Function: transformRequest] }, transformResponse: { '0': [Function: transformResponse] }, timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: [Function: validateStatus], headers: { Accept: 'application/json, text/plain, */*', 'Content-Type': 'application/json', 'X-Auth-PSK': 'Max@W67', 'User-Agent': 'axios/0.18.0', 'Content-Length': 78 }, method: 'post', url: 'http://192.168.108.24:undefined/sony/avContent', data: '{"id":1,"method":"getCurrentExternalInputsStatus","version":"1.0","params":[]}' }, data: undefined }

seydx commented 5 years ago

@fugazzy

Pushed a new update. Can u try again pls

fugazzy commented 5 years ago

now this, at first the TV was OFF, then I switch it ON: (connection established) [37m[4/13/2019, 3:16:10 PM] [BraviaOSPlatform] [INFO] Adding new accessory: Sony TV [4/13/2019, 3:16:10 PM] [BraviaOSPlatform] [INFO] Sony TV: Initalizing Bravia API with PSK [4/13/2019, 3:16:10 PM] [BraviaOSPlatform] [INFO] Sony TV: Cheking authentication... [4/13/2019, 3:16:10 PM] Homebridge is running on port 51829. [4/13/2019, 3:16:10 PM] [BraviaOSPlatform] [INFO] Sony TV: Authenticated! [4/13/2019, 3:16:13 PM] [BraviaOSPlatform] [WARN] Sony TV: TV currently offline, trying to connect (this can take up to 5 minutes) ... [4/13/2019, 3:16:25 PM] [BraviaOSPlatform] [INFO] Sony TV: Connection established! [4/13/2019, 3:16:26 PM] [BraviaOSPlatform] [INFO] Registring platform accessory: Sony TV (node:344) UnhandledPromiseRejectionWarning: TypeError: input.getCharacteristic is not a function at inputs.map.input (/homebridge/node_modules/homebridge-bravia-tvos/src/accessory.js:236:13) at Array.map (<anonymous>) at TelevisionAccessory.getService (/homebridge/node_modules/homebridge-bravia-tvos/src/accessory.js:234:17) at TelevisionAccessory.handleAccessory (/homebridge/node_modules/homebridge-bravia-tvos/src/accessory.js:111:14) (node:344) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:344) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

seydx commented 5 years ago

@fugazzy

New update again ^^ can u try again pös

fugazzy commented 5 years ago

this is it now: [37m[4/13/2019, 10:18:14 PM] [BraviaOSPlatform] [INFO] Adding new accessory: Sony TV [4/13/2019, 10:18:14 PM] [BraviaOSPlatform] [INFO] Sony TV: Initalizing Bravia API with PSK [4/13/2019, 10:18:14 PM] [BraviaOSPlatform] [INFO] Sony TV: Cheking authentication... [4/13/2019, 10:18:14 PM] Homebridge is running on port 51829. [4/13/2019, 10:18:14 PM] [BraviaOSPlatform] [INFO] Sony TV: Authenticated! [4/13/2019, 10:18:16 PM] [BraviaOSPlatform] [INFO] Registring platform accessory: Sony TV (node:343) UnhandledPromiseRejectionWarning: TypeError: input.getCharacteristic is not a function at inputs.map.input (/homebridge/node_modules/homebridge-bravia-tvos/src/accessory.js:236:25) at Array.map (<anonymous>) at TelevisionAccessory.getService (/homebridge/node_modules/homebridge-bravia-tvos/src/accessory.js:234:17) at TelevisionAccessory.handleAccessory (/homebridge/node_modules/homebridge-bravia-tvos/src/accessory.js:111:14) (node:343) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:343) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

seydx commented 5 years ago

@fugazzy

Hmmm, can you try the new update and post the output pls, need to debug more

donavanbecker commented 5 years ago

@Seydx

It is working now, only thing I’m seeing that I’m having issues with, is that it is showing extra inputs as extra accessories in the home app

fugazzy commented 5 years ago

here is my output, at first the TV was OFF, then I switch it ON: (connection established) [4/14/2019, 8:02:23 AM] [BraviaOSPlatform] [INFO] Adding new accessory: Sony TV [4/14/2019, 8:02:23 AM] [BraviaOSPlatform] [INFO] Sony TV: Initalizing Bravia API with PSK [4/14/2019, 8:02:23 AM] [BraviaOSPlatform] [INFO] Sony TV: Cheking authentication... [4/14/2019, 8:02:23 AM] Homebridge is running on port 51829. [4/14/2019, 8:02:23 AM] [BraviaOSPlatform] [INFO] Sony TV: Authenticated! [4/14/2019, 8:02:28 AM] [BraviaOSPlatform] [WARN] Sony TV: TV currently offline, trying to connect (this can take up to 5 minutes) ... [4/14/2019, 8:03:37 AM] [BraviaOSPlatform] [INFO] Sony TV: Connection established! [4/14/2019, 8:03:38 AM] [BraviaOSPlatform] [INFO] Registring platform accessory: Sony TV 3 (node:344) UnhandledPromiseRejectionWarning: TypeError: input.getCharacteristic is not a function at inputs.map.input (/homebridge/node_modules/homebridge-bravia-tvos/src/accessory.js:238:25) at Array.map (<anonymous>) at TelevisionAccessory.getService (/homebridge/node_modules/homebridge-bravia-tvos/src/accessory.js:234:17) at TelevisionAccessory.handleAccessory (/homebridge/node_modules/homebridge-bravia-tvos/src/accessory.js:111:14) (node:344) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:344) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

seydx commented 5 years ago

@d0n4v4nb3ck3r

After force quitting the home app the ‚extra‘ switches should disappear, home app have sometimes syncing issues or it takes a lot time to sync, but after force quitting and restarting the home app, they disappear and listed as inputs correctly

donavanbecker commented 5 years ago

@Seydx

So all is working good except when I add the apps as an input, then all the inputs appear as extra switches that you can’t do anything g with and quitting and restarting the home app doesn’t help.

seydx commented 5 years ago

@d0n4v4nb3ck3r

they disappear after HomeKit finishs syncing the accessories

seydx commented 5 years ago

@fugazzy

You turn the TV manually on? Can the plugin not start the TV itself? Tried with WOL?

fugazzy commented 5 years ago

@fugazzy

You turn the TV manually on? Can the plugin not start the TV itself? Tried with WOL?

Yes in this case for testing, because the LOG says no connection. Normally I switch the TV on with this plugin. (or by Remote)

Switching ON/OFF with this plugin works, but I do not see any inputs with the current version

fugazzy commented 5 years ago

something interesting: I changed my config to use DVBT (what I do not have, but what v2 of your plugin discovered automatically) "channelInputs": ["DVBC","DVBT"], "channels": [ { "channel":101, "source":"DVBT" }, { "channel":102, "source":"DVBT" } ], now I get a very log LOG, so I attach it here homebridge.log

seydx commented 5 years ago

@fugazzy

It seems there was the problem... the plugin got a problem discovering the given channel at given source (dvbc) . At this point it gives back an empty input back and the plugin tried to get the characteristics from them.

Can you also try following curl command on terminal and post the output here pls

curl http://IPHERE/sony/avContent -H 'x-auth-psk: PSKHERE' -d '{"id":3,"method":"getSourceList","version":"1.0","params":[{"scheme":"tv"}]}'

fugazzy commented 5 years ago

OK, I get this: {"result":[[{"source":"tv:dvbt"}]],"id":3}/homebridge

BTW: By using DVBT it seems to work fine, except there is an offset of 1 with the Channels: I configured 1 and 2 (ARD an ZDF) and Home and TV show me 2 and 3 (ZDF and WDR). By restarting the homebridge I get all inputs as individual tiles, by force quitting and restarting the Home App I get it right in the Home App.

seydx commented 5 years ago

The new update should now control the given channel types in config.json and only expose it to HomeKit if it founda in the TV settings, otherwise it will skip it!

Will now check the channel nr @fugazzy

seydx commented 5 years ago

@fugazzy

new update online, now the channels should work as intended. Have fun

fugazzy commented 5 years ago

Thank you very much for your work!!! It seems to work well now, but my channels in Home App are now 3 and 4 (WDR and SAT1) Maybe a correction in the wrong direction?

donavanbecker commented 5 years ago

Apr 15 10:39:51 HomeBridge homebridge[400]: 2019-04-15T15:39:51.123Z BraviaPlatform Sony TV: Adding Television Service Apr 15 10:39:51 HomeBridge homebridge[400]: 2019-04-15T15:39:51.127Z BraviaPlatform Sony TV: Adding Television Speaker Service Apr 15 10:39:51 HomeBridge homebridge[400]: 2019-04-15T15:39:51.258Z BraviaPlatformApi [Bravia Debug]: api request 1: post /sony/avContent - getCurrentExternalInputsStatus Apr 15 10:39:51 HomeBridge homebridge[400]: 2019-04-15T15:39:51.702Z BraviaPlatformApi [Bravia Debug]: api request 1: Uknown - {"status":500,"message":"Internal Server Error","config":{"transformRequest":{},"transformResponse":{},"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"headers":{"Accept":"application/json, text/plain, /","Content-Type":"application/json","X-Auth-PSK":"**","User-Agent":"axios/0.18.0","Content-Length":78},"method":"post","url":"http://192.168.7.11:80/sony/avContent","data":"{\"id\":1,\"method\":\"getCurrentExternalInputsStatus\",\"version\":\"1.0\",\"params\":[]}"},"data":{"error":[500,"Internal Server Error"],"id":1}} Apr 15 10:39:51 HomeBridge homebridge[400]: [2019-4-15 10:39:51] [Sony TV] [ERROR] Sony TV: Error while getting new inputs! Apr 15 10:39:51 HomeBridge homebridge[400]: [2019-4-15 10:39:51] [Sony TV] [ERROR] Sony TV: Please fix the issue and restart homebridge! Apr 15 10:39:51 HomeBridge homebridge[400]: { status: 500, Apr 15 10:39:51 HomeBridge homebridge[400]: message: 'Internal Server Error', Apr 15 10:39:51 HomeBridge homebridge[400]: config: Apr 15 10:39:51 HomeBridge homebridge[400]: { adapter: [Function: httpAdapter], Apr 15 10:39:51 HomeBridge homebridge[400]: transformRequest: { '0': [Function: transformRequest] }, Apr 15 10:39:51 HomeBridge homebridge[400]: transformResponse: { '0': [Function: transformResponse] }, Apr 15 10:39:51 HomeBridge homebridge[400]: timeout: 0, Apr 15 10:39:51 HomeBridge homebridge[400]: xsrfCookieName: 'XSRF-TOKEN', Apr 15 10:39:51 HomeBridge homebridge[400]: xsrfHeaderName: 'X-XSRF-TOKEN', Apr 15 10:39:51 HomeBridge homebridge[400]: maxContentLength: -1, Apr 15 10:39:51 HomeBridge homebridge[400]: validateStatus: [Function: validateStatus], Apr 15 10:39:51 HomeBridge homebridge[400]: headers: Apr 15 10:39:51 HomeBridge homebridge[400]: { Accept: 'application/json, text/plain, /*', Apr 15 10:39:51 HomeBridge homebridge[400]: 'Content-Type': 'application/json', Apr 15 10:39:51 HomeBridge homebridge[400]: 'X-Auth-PSK': '984032', Apr 15 10:39:51 HomeBridge homebridge[400]: 'User-Agent': 'axios/0.18.0', Apr 15 10:39:51 HomeBridge homebridge[400]: 'Content-Length': 78 }, Apr 15 10:39:51 HomeBridge homebridge[400]: method: 'post', Apr 15 10:39:51 HomeBridge homebridge[400]: url: 'http://192.168.7.11:80/sony/avContent', Apr 15 10:39:51 HomeBridge homebridge[400]: data: '{"id":1,"method":"getCurrentExternalInputsStatus","version":"1.0","params":[]}' }, Apr 15 10:39:51 HomeBridge homebridge[400]: data: { error: [ 500, 'Internal Server Error' ], id: 1 } }

donavanbecker commented 5 years ago

@Seydx

Anyway to fix this?

fugazzy commented 5 years ago

Is the remote part of the plugin supposed to work? It shows up but does not seem to have any function?

What about the issue with the wrong channel numbering?

twocolors commented 5 years ago

@SeydX wakeonlan not work again ...

[4/16/2019, 9:05:36 PM] [BraviaOSPlatform] [WARN] TV: Can not change power state, TV currently off!
[4/16/2019, 9:05:42 PM] [BraviaOSPlatform] [WARN] TV: Can not change power state, TV currently off!
[4/16/2019, 9:05:58 PM] [Raspberry Pi] Raspberry Temperatur: 37.932
[4/16/2019, 9:06:16 PM] [BraviaOSPlatform] [WARN] TV: Can not change power state, TV currently off!
[4/16/2019, 9:06:19 PM] [BraviaOSPlatform] [WARN] TV: Can not change power state, TV currently off!
[4/16/2019, 9:06:58 PM] [Raspberry Pi] Raspberry Temperatur: 37.394
[4/16/2019, 9:07:35 PM] [BraviaOSPlatform] [WARN] TV: Can not change power state, TV currently off!
[4/16/2019, 9:07:43 PM] [BraviaOSPlatform] [WARN] TV: Can not change power state, TV currently off!
seydx commented 5 years ago

@d0n4v4nb3ck3r

can u try following command pls and post the output:

curl http://YOURIPHERE/sony/avContent --header 'x-auth-psk: YOURPSKHERE' --data '{"id":3,"method":"getCurrentExternalInputsStatus","version":"1.0","params":[]}'

@fugazzy

what you mean with the remote part of the plugin?? this one? What does not work? Will check the channels again..

@twocolors

will check this, thx

donavanbecker commented 5 years ago

@SeydX

This is what shows up on my RaspberryPi {"error":[500,"Internal Server Error"],"id":3}

seydx commented 5 years ago

@d0n4v4nb3ck3r

Can u try this one

curl http://YOURIPHERE/sony/avContent --header 'x-auth-psk: YOURPSKHERE' --data '{"id":3,"method":"getCurrentExternalInputsStatus","version":"1.0","params":["1.0"]}'

donavanbecker commented 5 years ago

@SeydX

it just sits there and outputs this

>

This is what shows up with the first code on my Mac {"result":[[{"uri":"extInput:hdmi?port=1","title":"HDMI 1","connection":true,"label":"AppleTV","icon":"meta:hdmi"},{"uri":"extInput:hdmi?port=2","title":"HDMI 2\/MHL","connection":true,"label":"Blu-ray","icon":"meta:hdmi"},{"uri":"extInput:hdmi?port=3","title":"HDMI 3","connection":false,"label":"HomeBri","icon":"meta:hdmi"},{"uri":"extInput:hdmi?port=4","title":"HDMI 4\/ARC","connection":true,"label":"Sound","icon":"meta:hdmi"},{"uri":"extInput:composite?port=1","title":"Video 1","connection":false,"label":"","icon":"meta:composite"},{"uri":"extInput:component?port=1","title":"Video 2\/Component","connection":false,"label":"","icon":"meta:component"},{"uri":"extInput:widi?port=1","title":"Screen mirroring","connection":true,"label":"","icon":"meta:wifidisplay"}]],"id":3}

seydx commented 5 years ago

@d0n4v4nb3ck3r

Your raspberry can not resolve the link but your mac can?