xchwarze/samsung-tv-ws-api

stuck at upload()

Opened this issue · 11 comments

Hi Thanks for the Frame Support!

I'm testing the upload function on an Rpi. When uploading a png, it seems just stuck from there.
I have logging on info, but no output so far.

Anything I can do / test to get more info on progress etc?

After some investigation and logging on debug I see the upload command results in error -1. Anyone has some info on this?

DEBUG:samsungtvws.connection:SamsungTVWS websocket command: {"method": "ms.channel.emit", "params": {"event": "art_app_request", "to": "host", "data": "{"request": "send_image", "file_type": "png", "conn_info": {"d2d_mode": "socket", "connection_id": 2825700145, "id": "3d99854f-a8cf-4971-afd6-058b7151da16"}, "image_date": "2022:04:06 08:52:23", "matte_id": "modern_apricot", "file_size": 16123877, "id": "3d99854f-a8cf-4971-afd6-058b7151da16"}"}}
DEBUG:samsungtvws.helper:Processing API response: {"data":"{"id":"3d99854f-a8cf-4971-afd6-058b7151da16","event":"error","request_data":"{\"request\": \"send_image\", \"file_type\": \"png\", \"conn_info\": {\"d2d_mode\": \"socket\", \"connection_id\": 2825700145, \"id\": \"3d99854f-a8cf-4971-afd6-058b7151da16\"}, \"image_date\": \"2022:04:06 08:52:23\", \"matte_id\": \"modern_apricot\", \"file_size\": 16123877, \"id\": \"3d99854f-a8cf-4971-afd6-058b7151da16\"}","error_code":"-1","target_client_id":"ada14710-7e2e-47bb-885b-1715512a2d40"}","event":"d2d_service_message","from":"83a74979-99b1-41c6-96b4-a463bcfc2bdd"}

DEBUG:samsungtvws.connection:SamsungTVWS websocket event: {'data': '{"id":"3d99854f-a8cf-4971-afd6-058b7151da16","event":"error","request_data":"{\"request\": \"send_image\", \"file_type\": \"png\", \"conn_info\": {\"d2d_mode\": \"socket\", \"connection_id\": 2825700145, \"id\": \"3d99854f-a8cf-4971-afd6-058b7151da16\"}, \"image_date\": \"2022:04:06 08:52:23\", \"matte_id\": \"modern_apricot\", \"file_size\": 16123877, \"id\": \"3d99854f-a8cf-4971-afd6-058b7151da16\"}","error_code":"-1","target_client_id":"ada14710-7e2e-47bb-885b-1715512a2d40"}', 'event': 'd2d_service_message', 'from': '83a74979-99b1-41c6-96b4-a463bcfc2bdd'}
DEBUG:samsungtvws.helper:Processing API response: {"data":{"attributes":{"name":"U2Ftc3VuZ1R2UmVtb3Rl"},"connectTime":1649231541956,"deviceName":"U2Ftc3VuZ1R2UmVtb3Rl","id":"af6db873-dd46-4cf0-b6be-f145fd606caf","isHost":false},"event":"ms.channel.clientDisconnect"}

After some investigation and logging on debug I see the upload command results in error -1. Anyone has some info on this?
Got exactly the same error.
Model : QE55LS03RAUXXC
So excited ! And after hours...😞

Can't get any light from TCP dump.
Infinite websocket ping/pong...
2022-05-31_23h20_35

Got the same from rpi, Windows, WSL2... maybe a configuration on the TV... but which one ? I've tried many options...

Hi @vandenbrakel, have you managed this mess ?

same here. got here by way of a couple other projects using this as a dep.

nat38 commented

Hi.
I have the same issue. Anyone able to overcome this?

My code works perfectly on a newer Frame running firmware version 2401, however, I have the same issue as above on a Frame 65" 2019 model running firmware 1401, the latest version for this model.

This is a snippet of code, I'm going to unsplash then downloading a new photo each day and uploading to the Frame and deleting the previous.

response = requests.get(image)

img=Image.open(BytesIO(response.content))
img.thumbnail((3840,2160))
img.save('bg.jpg')

# Normal constructor
tv = SamsungTVWS("<REPLACE WITH THE IP>")

# Get current image
current_img = tv.art().get_current()

# Upload new image 
file = open('bg.jpg', 'rb')
data = file.read()
uploadedID = tv.art().upload(data, file_type="JPEG", matte='none')
tv.art().select_image(uploadedID)

# Delete old image
tv.art().delete(current_img['content_id'])

I created a quick PR to not remain stuck forever on the error and exit eagerly

#120

Screenshot 2023-05-02 at 10 24 59

I have the suspect that d2d socket connection is not supported on 14xx firmwares.
Attached a successful send_image command picture.

I've had the same issue with a hang-up on uploading an image, and it failed both using xchwarze's as well as thypon's forks. However, it did work fine with the fork I took from https://github.com/NickWaterton/samsung-tv-ws-api. My Frame's FW version is 1640.9.