Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ATV has port, but no logical address, doesn't work with current implementation #4

Open
epheterson opened this issue Mar 23, 2018 · 17 comments
Labels
bug Something isn't working

Comments

@epheterson
Copy link

I'm not sure how to enter this, whenever I choose a random port number I see the app runaway wildly turning it on in a loop.

Command output:
{
"connection": true,
"icon": "meta:playbackdevice",
"label": "Apple TV",
"title": "Player 1",
"uri": "extInput:cec?type=player&port=1"
},

My config:
"cecs": [{
"label": "Apple TV",
"logaddr": 0,
"port": 1
}]

The result:
[2018-3-23 03:28:06] [Sony] Turning on the TV...
[2018-3-23 03:28:07] [Sony] Turning on the TV...
[2018-3-23 03:28:07] [Sony] Turning on the TV...
[2018-3-23 03:28:07] [Sony] Turning on the TV...
[2018-3-23 03:28:08] [Sony] Turning on the TV...
[2018-3-23 03:28:08] [Sony] Turning on the TV...
[2018-3-23 03:28:09] [Sony] Turning on the TV...
[2018-3-23 03:28:09] [Sony] Turning on the TV...
[2018-3-23 03:28:09] [Sony] Turning on the TV...
[2018-3-23 03:28:10] [Sony] Turning on the TV...
[2018-3-23 03:28:10] [Sony] Turning on the TV...
[2018-3-23 03:28:10] [Sony] Turning on the TV...
[2018-3-23 03:28:10] [Sony] Turning on the TV...
[2018-3-23 03:28:10] [Sony] Turning on the TV...
[2018-3-23 03:28:10] [Sony] Turning on the TV...
[2018-3-23 03:28:11] [Sony] Turning on the TV...
[2018-3-23 03:28:11] [Sony] Turning on the TV...
[2018-3-23 03:28:11] [Sony] Turning on the TV...
[2018-3-23 03:28:11] [Sony] Turning on the TV...
[2018-3-23 03:28:11] [Sony] Turning on the TV...
[2018-3-23 03:28:12] [Sony] Turning on the TV...
[2018-3-23 03:28:12] [Sony] Turning on the TV...
[2018-3-23 03:28:12] [Sony] Turning on the TV...
[2018-3-23 03:28:12] [Sony] Turning on the TV...
[2018-3-23 03:28:12] [Sony] Turning on the TV...
[2018-3-23 03:28:13] [Sony] Turning on the TV...
[2018-3-23 03:28:13] [Sony] Turning on the TV...
[2018-3-23 03:28:13] [Sony] Turning on the TV...
[2018-3-23 03:28:13] [Sony] Turning on the TV...

@seydx
Copy link
Owner

seydx commented Mar 23, 2018

Hm can you try activate Apple TV with Bravia sync and try again getting the logical address

It must be detected as meta:cec and Not meta:playback

@epheterson
Copy link
Author

Yeah I tried that, and it says: meta:playbackdevice

@seydx
Copy link
Owner

seydx commented Mar 23, 2018

Hmm, i will look later, maybe there is a workaround to Start a cec device

@seydx seydx added the bug Something isn't working label Mar 23, 2018
@seydx
Copy link
Owner

seydx commented Mar 23, 2018

So it is not possible to start a cec device without logical adress, its only possible to change the hdmi input. Do you have checked the cec settings from apple tv? Normally all devices that support cec must be shown as cec in the output, otherwise it is not possible to start it

i will change the code to prevent getting error without logical adress

@seydx
Copy link
Owner

seydx commented Mar 23, 2018

i checked the icon tag of my cec devices and "meta:playback" is correct, so just forgot what i have said above with "meta:cec" ^^

@epheterson
Copy link
Author

Yeah it shows the Apple TV in the CEC settings as enabled. Very strange! I'm guessing different models have different implementations of the protocol, which is kinda mad.

@epheterson
Copy link
Author

epheterson commented Mar 24, 2018

I'm able to wake my Apple TV with this command:

curl -H "Content-Type: application/json" \
  -H "X-Auth-PSK: xxx" \
  -X POST \
  -d '{"id": 20, "method": "setPlayContent", "version": "1.0", "params": [{"uri":"extInput:cec?type=player&port=1"}]}' \
  http://192.168.0.18/sony/avContent

Unfortunately, this only works after first powering on the TV, waiting a finite period of time, then sending the command. Perhaps we can add these types of macros as switches? Or, again dynamically determine if the TV is on and power on only if needed?

While it was off, I got:

{"error":[404,"Not Found"]}

I used this kind of as reference, but I don't think even that is identical to mine. The plugin may need to dynamically figure out what's supported before using it, to properly support different Bravia TV's. :-/
https://aydbe.com/assets/uploads/2014/11/json.txt

@seydx
Copy link
Owner

seydx commented Mar 24, 2018

There is already a function to check the tv state first before turning on the cec device. If there is an "error" in response, it tries to turn on the tv, if there is "result" in response it tries to turn on the cec device.

Here is the problem. It always tries turning on with port AND logical adress, and if there is no logical adress you got an "error" in response and the plugin thinks the tv is off and try everything again

To solve this, we must check the given parameter in the config file. If there is only port given, so we need an uri without the logical adress, if both is given, we need an uri with port and logical adress

I will check this and publish a new version later

@epheterson
Copy link
Author

Why not just change it to taking the uri directly? Then it should work in all cases. Glad to hear you handle the power off case!

@seydx
Copy link
Owner

seydx commented Mar 24, 2018

Because the uri which is working for you doesnt work for me :/ so i need to check the given Parameter and Change dynamically the uri

@seydx
Copy link
Owner

seydx commented Mar 24, 2018

taking it directly were a good Solution ^^

@seydx
Copy link
Owner

seydx commented Mar 26, 2018

should be fixed with v2.3
can you try and give some feedback pls

@epheterson
Copy link
Author

I like the auto-config in the new one!

It works while the TV is on, but when it's off, it turns the TV on then crashes with this error:

[2018-3-25 21:58:06] [Sony] Turning on the TV...
/Users/elp/.nvm/versions/node/v7.6.0/lib/node_modules/homebridge-sonybravia-platform/accessories/Inputs.js:185
                                        this.SourceSwitch.getCharacteristic(Characteristic.On).setValue(self.state);
                                                         ^

TypeError: Cannot read property 'getCharacteristic' of undefined
    at Timeout._onTimeout (/Users/elp/.nvm/versions/node/v7.6.0/lib/node_modules/homebridge-sonybravia-platform/accessories/Inputs.js:185:58)
    at ontimeout (timers.js:469:11)
    at tryOnTimeout (timers.js:304:5)
    at Timer.listOnTimeout (timers.js:264:5)

@seydx
Copy link
Owner

seydx commented Mar 26, 2018

Should be fixed with 3d142c6

new Version is on the way

@seydx
Copy link
Owner

seydx commented Mar 26, 2018

can you try the latest version and give some feedback pls

@epheterson
Copy link
Author

It's working great, turns the TV on then turns the ATV on exactly as expected, thanks!

@epheterson
Copy link
Author

epheterson commented May 25, 2018

Hey this stopped working exactly as it was – when I have the definition set to HDMI4, it still maps to HDMI1. I'm not sure when this changed, exactly.

I'm using this:

			"cecDevices": [{
				"title": "Player 1",
				"hdmiport": 4
			}]
		}

With that, I see in the Home App HDMI2, HDMI3, HDMI4 and "Sony Player 1" which maps to HDMI1. When I turn on the TV with HDMI4 selected (where the Apple TV is), the HDMI4 tile is lit, and not "Sony Player 1".

Any ideas?

@epheterson epheterson reopened this May 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants