normen / homebridge-bravia

Homebridge plugin for Sony Bravia TVs (AndroidTV based ones and possibly others)
139 stars 26 forks source link

Volume doesn't appear to work on both the Sony TVs I've tried it on #17

Closed cstromme closed 7 years ago

cstromme commented 7 years ago

Tried it on a 2 year old Sony KD-65X9005B, and on another 3 year old Sony TV, both updated with the latest firmware. Neither of them seem to react at all when I try to adjust volume, and it's not getting the correct volume back. Power on/off works, and mute works (but doesn't appear to be able to get mute state back when first starting the TV).

What can I do to help debug this?

EDIT: Both of these are pre-Android.

normen commented 7 years ago

Hey.

Heres a curl command to check the API of the TV along with various URLs and the respective returned method lists from my TV.

You can check which methods are used in the code of this plugin and if your TV uses the same or returns anything at all. If it doesn't support http API access you're out of luck or maybe it still does and it just needs to be enabled somewhere. If the commands of your TV are different you could adapt them in the plugin. Thats what you could do to solve your problem afaics.

To actually help you'd only need to do something in the last case, namely post the same info I posted below.

Thats all the info I can give you, I won't be able to hold your hand through it though so gl :)

curl -v -XPOST http://192.168.2.103/sony/system -d '{"method":"getMethodTypes","params":[""],"id":1,"version":"1.0"}'

http://192.168.2.103/sony/appControl

{"results":[["getApplicationList",[],["{\"title\":\"string\", \"uri\":\"string\", \"icon\":\"string\", \"data\":\"string\"}*"],"1.0"],["getApplicationStatusList",[],["{\"name\":\"string\", \"status\":\"string\"}*"],"1.0"],["getWebAppStatus",[],["{\"active\":\"bool\", \"url\":\"string\"}"],"1.0"],["setActiveApp",["{\"uri\":\"string\", \"data\":\"string\"}"],[],"1.0"],["setTextForm",["string"],["int"],"1.0"],["terminateApps",[],[],"1.0"],["getMethodTypes",["string"],["string","string*","string*","string"],"1.0"],["getVersions",[],["string*"],"1.0"]],"id":1}

http://192.168.2.103/sony/audio

{"results":[["getSpeakerSettings",["{\"target\":\"string\"}"],["{\"target\":\"string\", \"currentValue\":\"string\", \"deviceUIInfo\":\"string\", \"title\":\"string\", \"titleTextID\":\"string\", \"type\":\"string\", \"isAvailable\":\"bool\", \"candidate\":\"SpeakerSettingsCandidate[]\"}*"],"1.0"],["getVolumeInformation",[],["{\"target\":\"string\", \"volume\":\"int\", \"mute\":\"bool\", \"maxVolume\":\"int\", \"minVolume\":\"int\"}*"],"1.0"],["setAudioMute",["{\"status\":\"bool\"}"],["int"],"1.0"],["setAudioVolume",["{\"target\":\"string\", \"volume\":\"string\"}"],["int"],"1.0"],["setSpeakerSettings",["{\"settings\":\"SpeakerSettings[]\"}"],[],"1.0"],["getMethodTypes",["string"],["string","string*","string*","string"],"1.0"],["getVersions",[],["string*"],"1.0"]],"id":1}

http://192.168.2.103/sony/avContent

{"results":[["deleteContent",["{\"uri\":\"string\"}"],[],"1.0"],["getContentCount",["{\"source\":\"string\", \"type\":\"string\"}"],["{\"count\":\"int\"}"],"1.0"],["getContentList",["{\"source\":\"string\", \"stIdx\":\"int\", \"cnt\":\"int\", \"type\":\"string\"}"],["{\"uri\":\"string\", \"title\":\"string\", \"index\":\"int\", \"dispNum\":\"string\", \"originalDispNum\":\"string\", \"tripletStr\":\"string\", \"programNum\":\"int\", \"programMediaType\":\"string\", \"directRemoteNum\":\"int\", \"startDateTime\":\"string\", \"durationSec\":\"int\", \"channelName\":\"string\", \"fileSizeByte\":\"int\", \"isProtected\":\"bool\", \"isAlreadyPlayed\":\"bool\"}*"],"1.0"],["getCurrentExternalInputsStatus",[],["{\"uri\":\"string\", \"title\":\"string\", \"connection\":\"bool\", \"label\":\"string\", \"icon\":\"string\"}*"],"1.0"],["getParentalRatingSettings",[],["{\"ratingTypeAge\":\"int\", \"ratingTypeSony\":\"string\", \"ratingCountry\":\"string\", \"ratingCustomTypeTV\":\"string*\", \"ratingCustomTypeMpaa\":\"string\", \"ratingCustomTypeCaEnglish\":\"string\", \"ratingCustomTypeCaFrench\":\"string\", \"unratedLock\":\"bool\"}"],"1.0"],["getPlayingContentInfo",[],["{\"uri\":\"string\", \"source\":\"string\", \"title\":\"string\", \"dispNum\":\"string\", \"originalDispNum\":\"string\", \"tripletStr\":\"string\", \"programNum\":\"int\", \"programTitle\":\"string\", \"startDateTime\":\"string\", \"durationSec\":\"int\", \"mediaType\":\"string\", \"playSpeed\":\"string\", \"bivl_serviceId\":\"string\", \"bivl_assetId\":\"string\", \"bivl_provider\":\"string\"}"],"1.0"],["getSchemeList",[],["{\"scheme\":\"string\"}*"],"1.0"],["getSourceList",["{\"scheme\":\"string\"}"],["{\"source\":\"string\"}*"],"1.0"],["setDeleteProtection",["{\"uri\":\"string\", \"isProtected\":\"bool\"}"],[],"1.0"],["setFavoriteContentList",["{\"favSource\":\"string\", \"contents\":\"string*\"}"],[],"1.0"],["setPlayContent",["{\"uri\":\"string\"}"],[],"1.0"],["setPlayTvContent",["{\"channel\":\"string\"}"],[],"1.0"],["setTvContentVisibility",["{\"uri\":\"string\", \"epgVisibility\":\"string\", \"channelSurfingVisibility\":\"string\", \"visibility\":\"string\"}*"],[],"1.0"],["getMethodTypes",["string"],["string","string*","string*","string"],"1.0"],["getVersions",[],["string*"],"1.0"]],"id":1}

http://192.168.2.103/sony/system

{"results":[["getCurrentTime",[],["string"],"1.0"],["getDeviceMode",["{\"value\":\"string\"}"],["{\"isOn\":\"bool\"}"],"1.0"],["getInterfaceInformation",[],["{\"productCategory\":\"string\", \"productName\":\"string\", \"modelName\":\"string\", \"serverName\":\"string\", \"interfaceVersion\":\"string\"}"],"1.0"],["getLEDIndicatorStatus",[],["{\"mode\":\"string\", \"status\":\"string\"}"],"1.0"],["getNetworkSettings",["{\"netif\":\"string\"}"],["{\"netif\":\"string\", \"hwAddr\":\"string\", \"ipAddrV4\":\"string\", \"ipAddrV6\":\"string\", \"netmask\":\"string\", \"gateway\":\"string\", \"dns\":\"string*\"}*"],"1.0"],["getPowerSavingMode",[],["{\"mode\":\"string\"}"],"1.0"],["getPowerStatus",[],["{\"status\":\"string\"}"],"1.0"],["getRemoteControllerInfo",[],["{\"bundled\":\"bool\", \"type\":\"string\"}","{\"name\":\"string\", \"value\":\"string\"}*"],"1.0"],["getRemoteDeviceSettings",["{\"target\":\"string\"}"],["{\"target\":\"string\", \"currentValue\":\"string\", \"deviceUIInfo\":\"string\", \"title\":\"string\", \"titleTextID\":\"string\", \"type\":\"string\", \"isAvailable\":\"bool\", \"candidate\":\"RemoteDeviceSettingsCandidate[]\"}*"],"1.0"],["getSystemInformation",[],["{\"product\":\"string\", \"region\":\"string\", \"language\":\"string\", \"model\":\"string\", \"serial\":\"string\", \"macAddr\":\"string\", \"name\":\"string\", \"generation\":\"string\", \"area\":\"string\", \"cid\":\"string\"}"],"1.0"],["getSystemSupportedFunction",[],["{\"option\":\"string\", \"value\":\"string\"}*"],"1.0"],["getWolMode",[],["{\"enabled\":\"bool\"}"],"1.0"],["requestReboot",[],[],"1.0"],["setDeviceMode",["{\"value\":\"string\", \"isOn\":\"bool\"}"],[],"1.0"],["setLanguage",["{\"language\":\"string\"}"],[],"1.0"],["setPowerSavingMode",["{\"mode\":\"string\"}"],[],"1.0"],["setPowerStatus",["{\"status\":\"bool\"}"],[],"1.0"],["setWolMode",["{\"enabled\":\"bool\"}"],[],"1.0"],["getMethodTypes",["string"],["string","string*","string*","string"],"1.0"],["getVersions",[],["string*"],"1.0"]],"id":1}
cstromme commented 7 years ago

So here's what I'm getting back from sony/audio.

{"id":1,"results":[["getMethodTypes",["string"],["string","string*","string*","string"],"1.0"],["getVersions",[],["string*"],"1.0"],["getVolumeInformation",[],["{\"target\":\"string\",\"volume\":\"int\",\"mute\":\"bool\",\"maxVolume\":\"int\",\"minVolume\":\"int\"}*"],"1.0"],["setAudioMute",["{\"status\":\"bool\"}"],["int"],"1.0"],["setAudioVolume",["{\"target\":\"string\",\"volume\":\"string\"}"],["int"],"1.0"]]

So setAudioVolume seems to be available. Very strange that it's not working then, or am I missing something else obvious from the getMethodTypes return?

EDIT: Oh wait. I figured out why it wasn't working. Both TVs are connected to an amp (or an amp and a soundbar). If I turn those off I can set the volume on the TV. Is there any way to specify a different target perhaps? Right now the config help says speakers or headphones, but perhaps there's another string that can be used to target the audio system instead?

EDIT: After some searching I found this thread. Seems like others are struggling with the same thing. Volume up and down seem to work using the IRCC path though. Does HomeKit speakers support increasing and decreasing volume, or just setting it to a specific volume?

normen commented 7 years ago

Not really, non-latching buttons aren't really an option in HomeKit apart from the "identify" command. You could add a switch that automatically turns itself off after half a second or so but that'd mean you could only press the "Volume +" button every half second (and generally isn't very clean).

It rather sounds like you should look into controlling whatever your TV is connected to. If I get your right the TV routes out its audio via HDMI to some amplifier/receiver, so how about you look into controlling that instead.

cstromme commented 7 years ago

Excellent suggestion! Looking into http control of the amp in my home theater right now. The one connected to the living room TV is a Sony soundbar, and I don't think it's networkable.