vgavro / samsung-mdc

BSD 3-Clause "New" or "Revised" License
69 stars 11 forks source link

Add Network AP Config #14

Closed Anti-T97 closed 2 months ago

Anti-T97 commented 2 months ago

Hi Victor,

I have another request i try to add code for add SSID and password image

I add this code :

class NETWORK_AP_CONFIG(Command):
    CMD = 0x1B
    SUBCMD = 0x8A
    GET, SET = False, True

    DATA = [Str('SSID'), Str('PASSWORD_SSID')]

It not realy work fine...

Possible to help me to add it ?

Thank

vgavro commented 2 months ago

Yeah, this field types are not supported at current version. I created separate branch https://github.com/vgavro/samsung-mdc/tree/feature/field-dynamic-length to support and added NETWORK_AP_CONFIG command there. I can't test it as i don't have samsung TV at this time, and this is pretty core change that can break much without testing...

you can install it using:

git clone -b feature/field-dynamic-length https://github.com/vgavro/samsung-mdc
cd ./samsung-mdc
python3 -m venv venv
./venv/bin/pip3 install -e ./
./venv/bin/samsung-mdc --help
# ./venv/Scripts instead ./venv/bin if you're on Windows

if IT IS WORKING - plz test other commands (it's preferrable if you can test commands with all different field types), if it's not - plz report... Also - there was some strange code related Datetime field parsing - plz make sure if it's working.

It would help a lot to understand if this can be released. Thank you.

Anti-T97 commented 2 months ago

OK Thank you i try it today

Anti-T97 commented 2 months ago

% ./venv/bin/samsung-mdc 0@192.168.1.14 network_ap_config "SSIDTEST" "PASSWORD" 0@192.168.1.14 MDCReadTimeoutError: [Errno Response header read timeout] b''

If the SSID and Password is good and the Screen connect on it after the cmd it work, but i have this message fail or not 0@192.168.1.14 MDCReadTimeoutError: [Errno Response header read timeout] b''

vgavro commented 2 months ago

Can you try to increase timeout? To some excessive number like 30s? All mdc commands I've seen before always sending acknowledge. So - either this command does not. Either it tries to validate before sending acknowledge.

Also. What about other commands. Especially current time.

Anti-T97 commented 2 months ago

you have right

It not possible to respond because it change of network, i m not on the same after the command send..

vgavro commented 2 months ago

Can you plz explicitly confirm that on this version (from branch above):

  1. command status is working (get only) (if not - full error and was it working on previous version)

  2. command clock_s is working (get only) (if not - full error and was it working on previous version)

  3. command panel_on_time is working (get only) (if not - full error and was it working on previous version)

  4. command rgb is working (get only) (if not - full error and was it working on previous version)

  5. command model_name is working (get only) (if not - full error and was it working on previous version)

  6. do I understand correctly that EACH time NETWORK_AP_CONFIG command is applied with SUCCESS (proper params), device is changing network? IF so - maybe this should be added to command readme?

7.1. if 6. is true - what about applying same SSID,PASSWORD? it shouldn't change network if it's already on this network, right? so it should return expected result?

7.2. If you meant YOUR (client) network is changed (for some reason) - could you avoid this and confirm command is working properly when your network doesn't change?

  1. in any case - applying wrong credentials shouldn't change device device network? so what is returned then - error or success? if error - plz provide full error.
Anti-T97 commented 2 months ago
  1. Status OK : 0@192.168.1.66 0 0 0
  2. Clock_s OK : 0@192.168.1.66 2024-07-22T14:45:37
  3. Panel_on_time Error : 0@192.168.1.66 MDCResponseError: ('Unparsed data left', b'y')
  4. RGB OK : 0@192.168.1.66 70 45 100 0 255 255 255
  5. Model_name OK : 0@192.168.1.66 QM55B-T
  6. Exact, when it change network the PC sent the command it on another after command success

7.1. When set the same SSID and PASS on the same network the timeout is to short for get the response. 0@192.168.1.66 MDCResponseError: ('Empty response', b'')

7.2. I need to change SSID on screen for change Network not juste for change SSID on the same Network.

  1. Wrong Credential disconnect to the current SSID or Cable Network, need to manually reconnect with the remote control
vgavro commented 2 months ago

thanks for your tests! Looks like everything is working as expected.

I added note to NETWORK_AP_CONFIG about network change, in protocol they explicitly state that there should be response, so let's consider this behaviour as device-specific (not protocol-specific) and leave it on "notes" level in command doc.

About panel_on_time error - I added unit tests, and it looks like command is working properly (regarding protocol), i believe you have newer device which behaves undocumented... If you have time - plz run command with --verbose option to see actual response, i believe if you compare it to protocol - response contains more data then it should. Plz create new ticket on this (with --verbose output, and also with actual panel_on_time if this info is available on your device UI), i'm closing this ticket, merging changes to master and creating 1.14.0 release. Thanks for help!