seydx / homebridge-sonybravia-platform

Sony Android TV Platform for Homebridge
MIT License
22 stars 0 forks source link

Volume controller #7

Closed ryanxu36 closed 6 years ago

ryanxu36 commented 6 years ago

Hello, Just installed the latest version and updated the config.json, volume controller still does not work. the config.json:

{
    "bridge": {
        "name": "Homebridge",
        "username": "02:42:81:B2:65:96",
        "port": 51826,
        "pin": "031-45-154"
    },

    "description": "This is an example configuration file. You can use this as a template for creating your own configuration file containing devices you actually own.",

    "accessories": [],

    "platforms": [
        {
        "platform": "HomeAssistant",
        "name": "HomeAssistant",
        "host": "http://127.0.0.1:8123",
        "password": "",
        "supported_types": ["automation", "binary_sensor", "climate", "cover", "device_tracker", "fan", "group", "input_boolean", "light", "lock", "media_player", "remote", "scene", "script", "sensor", "switch", "vacuum"],
        "default_visibility": "hidden",
        "logging": true,
        "verify_ssl": false
        },
        {
            "platform": "config",
            "name": "Config",
            "port": 8080,
            "sudo": false
        },
        {
        "platform":"SonyBravia", 
        "name":"Sony",
        "ipadress":"192.168.2.180",
        "psk":"1234",
        "interval": 5,
        "maxVolume":60,
        "extraInputs":false,
        "volumeEnabled": true,
        "appsEnabled": false,
        "channelsEnabled":false,
        "homeapp":"com.sony.dtv.com.wasu.wasutvcs.com.wasu.wasutvcs.activity.AuthActivity",
        "cecs":
        [
            {
                "label":"PlayStation 4",
                "logaddr":8,
                "port":1
            }
        ]
        }
    ]
}

When adjust the volume in homekit log shows:

[2018-3-23 14:03:12] [Sony] Volume: 27
[2018-3-23 14:03:12] [Sony] Volume: 19
[2018-3-23 14:03:20] [HomeAssistant] Received event: ping
[2018-3-23 14:03:23] [Sony] Volume: 31

but TV volume does not change.

seydx commented 6 years ago

Hm can you Post the Output from following Command pls:

curl -s -X POST -d "{\"id\":3,\"method\":\"getVolumeInformation\",\"version\":\"1.0\",\"params\":["1.0"]}" "http://TVIPHERE/sony/audio" -H "X-Auth-PSK: YOURPSK"

And can you Check if this Command changes the volume, and can you Post the Output from this Command too

curl -s -H "X-Auth-PSK: YOURPSKHERE" -d "{\"id\":2,\"method\":\"setAudioVolume\",\"version\":\"1.0\",\"params\": [{\"target\":\"speaker\",\"volume\":\"2\"}]}" "http://TVIPHERE/sony/audio"

ryanxu36 commented 6 years ago

Thanks for your reply.

I was failed to intsall "jq" because the plugin is running on a docker image oznu/docker-homebridge which cannot run the command “sudo apt-get install jq”. do you know any other way to install that? then I can post what you asked.

Thanks so much

seydx commented 6 years ago

@ryanxu36

You dont need jq for the command

ryanxu36 commented 6 years ago

Both command return "curl: not found"

seydx commented 6 years ago

What kind of device you are using? Raspberry?

Outlook für iOShttps://aka.ms/o0ukef beziehen


From: Ryanxu notifications@github.com Sent: Saturday, March 24, 2018 4:51:44 PM To: SeydX/homebridge-sonybravia-platform Cc: Seyd; Comment Subject: Re: [SeydX/homebridge-sonybravia-platform] Volume controller (#7)

Both command return "curl: not found"

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/SeydX/homebridge-sonybravia-platform/issues/7#issuecomment-375900829, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AgkhOeWBluD6ZzSkv3I1lnnY1ZkVZ05Uks5thmuQgaJpZM4S4xmD.

seydx commented 6 years ago

I dont use docker, but maybe you can use curl with this?

https://hub.docker.com/r/byrnedo/alpine-curl/

ryanxu36 commented 6 years ago

I have added a curl to my homebridge, both your command returns {"error":[5,"Illegal JSON"]}

seydx commented 6 years ago

@ryanxu36

hmm... can you upgrade to latest version and post the output here please

ryanxu36 commented 6 years ago

I have just upgraded to version 2.3 and the config is also up to date but the command returns same thing {"error":[5,"Illegal JSON"]}

For your information, I am using a Synology NAS docker to run homebridge with your plugin, and I can get correct list of apps installed on my TV with your home app command curl -XPOST http://192.168.2.180/sony/appControl -d '{"id":2,"method":"getApplicationList","version":"1.0","params":["1.0"]}' -H 'X-Auth-PSK: 1234' | jq -r '.result[]'

I am thinking if it is a device or platform matter?

seydx commented 6 years ago

Hmm the command for apps is working but not that for volume? Maybe above is a typo, can you try with this command. Its working with my TV.

(Note: change ip adress and psk with your own data)

curl -XPOST http://192.168.1.2/sony/audio -d '{"id":2,"method":"getVolumeInformation","version":"1.0","params":["1.0"]}' -H 'X-Auth-PSK: abc123'

And here again for set new value for volume:

curl -XPOST http://192.168.1.2/sony/audio -d '{"id":2,"method":"setAudioVolume","version":"1.0","params":[{"target":"speaker","volume":"10"}]}' -H 'X-Auth-PSK: abc123'

ryanxu36 commented 6 years ago

First command returns:

{"result":[[{"target":"speaker","volume":23,"mute":false,"maxVolume":100,"minVolum e":0},{"target":"headphone","volume":15,"mute":false,"maxVolume":100,"minVolume":0 }]],"id":2}

Second command returns:

{"result":[0],"id":2}

seydx commented 6 years ago

The Second Command should Change the volume on the TV to 10. Can you Change manually the volume to 20 and Run the Second Command again to See it on the TV if the Command changes it really or Not pls

ryanxu36 commented 6 years ago

It dose not change the volume. I set manually the volume to 20 and run the first command, the result is not "20" but "23". The second command makes the volume bar pop-up on TV but not change the volume actually.

seydx commented 6 years ago

Hmm that makes no Sense, because its asking the TV for the volume state and i dont know why it is saying "23" and not the real value "20"

Which model do you have?

ryanxu36 commented 6 years ago

My TV is a 2015 model KD-65X9000C

ryanxu36 commented 6 years ago

Oh, I realized that I have a Sony HT-ST9 soundbar connected to my TV, when I change the volume of TV the soundbar volume will also be changed automatically, they are linked. For example, the volume of TV is 20 and the volume of soundbar will be 10 (volume of TV=volume of sounbar*2), AND I can change the volume of TV only by step of "2", like 20->22->24... and the soundbar will be 10->11->12... So maybe thats the problem, I will remove the soundbar and try the command later and put the result here. Thank you so much..

seydx commented 6 years ago

Haha :D yes that would be the problem, i think it will work when you remove it, im waiting for the output, thanks for response

ryanxu36 commented 6 years ago

It works when I remove the soundbar, maybe HDMI ARC cause the problem, it makes linkage between TV and soundbar and I am using soundbar as a common speaker, so your plugin cannot get the correct information of volume. Other features work great for me! Thanks for your great job!

seydx commented 6 years ago

Ah i understand, yeah the volume bulb can only control directly the tv and Not plugged in external accessory if they are Not listed in the api

Good to hear that everything Else Works fine, im closing the issue then