eslavnov / pylips

Control Philips TVs (2015+) and Ambilight (+ Hue) through their reverse-engineered API (+ MQTT support!)
MIT License
342 stars 60 forks source link

[BUG] #34

Closed pingloss closed 5 years ago

pingloss commented 5 years ago

Hi,

Initial communication has completed and has populated settings.ini however attempting to issue a command fails returning back a message that ‘The request requires authentication’.

I’ve also tried issuing the command while also adding the user and pass variables but with the same response back.

python3 ./pylips.py --command volume Sending GET request to https://192.168.1.71:1926/6/audio/volume Request sent!

Status page

Unauthorized

The request requires user authentication

You can get technical details here.
Please continue your visit at our home page.

eslavnov commented 5 years ago

Hi, That's weird, could you please share with me your settings.ini so I can try to replicate it? I am on a beach right now with no technology whatsoever (sending this message by a postal pigeon), so I'll take a look at this issue next week once I am back. Thanks!

pingloss commented 5 years ago

Hi there,

Here’s the contents of the settings.ini file

[DEFAULT] verbose = True mqtt_listen = False mqtt_update = False num_retries = 3 [DEFAULT] update_interval = 3

[TV] host = 192.168.1.71 port = 1926 apiv = 6 user = jvLMtCJZU1Vsvi3T pass = 9b83ccb41173a44d8741d5e207ff19272bdefd5762fff11b41b1a259009b172a protocol = https://

[MQTT] host = port = user = pass = tls = False cert_path = topic_pylips = topic_status =

Thanks, Simon

eslavnov commented 5 years ago

Hey Simon,

I've just checked using the same settings and it works fine for me. The only thing that I've noticed is that you have [DEFAULT] specified twice for some reason in your settings.ini, but it should be there only once in the very beginning of the file. Maybe try replacing your settings.ini with the original one and try pairing again?

Darkensen commented 5 years ago

Hello, I have the same problem. Here my settings.ini : [DEFAULT] verbose = True mqtt_listen = False mqtt_update = False num_retries = 3 update_interval = 3

[TV] host = 192.168.1.66 port = 1926 apiv = 6 user = BqjadVW74Mfa43KR pass = 67e05d9b3dbd09ba90dc3efe0223fb473842e6f052aac3593d73e2fe8aa46ad1 protocol = https://

[MQTT] host = port = user = pass = tls = False cert_path = topic_pylips = topic_status =

And i get the same problem when running manualy :

python3 pylips.py --user BqjadVW74Mfa43KR --pass 67e05d9b3dbd09ba90dc3efe0223fb473842e6f052aac3593d73e2fe8aa46ad1 --host 192.168.1.66 --command powerstate Sending GET request to https://192.168.1.66:1926/6/powerstate Request sent!

Status page

Unauthorized

The request requires user authentication

You can get technical details here.
Please continue your visit at our home page.

i tried to remove the user/pass in settings and repair, but same problem. I also tried with a web browser and get the same problem, the user/pass doesn't work I Tried the old script (v0.4) and it works

PS : Thanks for this great work ! I work with Jeedom to control my TV

eslavnov commented 5 years ago

@Darkensen Thank you for reporting this! I am a bit lost since I can not replicate this issue, so I will need your help troubleshooting it.

First of all, can you please try calling an endpoint with cURL using the username and password that the pylips generated for you? The general syntax is: curl -X GET --digest --insecure -u %username%:%password% https://%ip_address%:1926/6/%endpoint%

(curl should be pre-installed in *NIX systems, but you'll have to install it manually for Windows, if I remember everything correctly)

Darkensen commented 5 years ago

Same

curl -X GET --digest --insecure -u Q1EoRgPF09zfKhnC:adf3d99f45cc1c247e201c1732681b5f6e677cb298d6c4df82dfefb44505b00 https://192.168.1.66:1926/6/powerstate `

Status page

Unauthorized

The request requires user authentication

You can get technical details here.
Please continue your visit at our home page.

`

Unfortunatly i'm not at home, but my girlfriend don't yell, there musn't be any warning on the TV :)

eslavnov commented 5 years ago

Thanks for the quick reply! Looks like the credentials are wrong for some reason... I remember indeed changing the pairing part a bit some time ago and, perhaps, I broke something in the process... Still weird, because I've repaired my TV with the new versions and they work fine for me. I guess, we are hitting some kind of an edge case...

You've mentioned that v0.4 work for you - did you test it recently or in the past?

Darkensen commented 5 years ago

Just test now, still works

it's strange that the curl doesn't work, what was the curl request in 0.4 ?

eslavnov commented 5 years ago

Does v0.4 work with the new credentials or only with the ones you get by pairing using v0.4?

Darkensen commented 5 years ago

Hello, The 0.4 work with both

eslavnov commented 5 years ago

Wow, that does not make any sense... Just to make sure I understand you correctly: 1) you pair using the latest version 2) using these credentials you get 'unauthorized' error in pylips (latest version) and curl 3) using these credentials in v0.4 you get a correct response

Or did I misunderstood something?

Darkensen commented 5 years ago

I find my mistake, I don't know why but the password I used was shrinked when I do the copy/past to the settings file. Everything works now ... Sorry for your time ...

Regards

eslavnov commented 5 years ago

No problem, glad to hear that it works!