PrivateButts / PrusaCameraConnect

3 stars 0 forks source link

Exception: Failed to upload snapshot: 422 Unprocessable Entity #2

Open jupe opened 3 weeks ago

jupe commented 3 weeks ago

I think I've all configurations in place and started app with pdm, but got this when it tries to upload image.

│   25 │   │   │   │   data=snapshot,                                                              │
│   26 │   │   │   ) as resp:                                                                      │
│   27 │   │   │   │   if resp.status != 204:                                                      │
│ ❱ 28 │   │   │   │   │   raise Exception(f"Failed to upload snapshot: {resp.status} {resp.rea    │
│   29 │   │   │   │   await log.adebug("Uploaded snapshot", fingerprint=fingerprint)              │
│   30                                                                                             │
│   31                                                                                             │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ fingerprint = 'aow83ukljhsdag'                                                               │ │
│ │        resp = <ClientResponse(https://connect.prusa3d.com/c/snapshot) [422 Unprocessable     │ │
│ │               Entity]>                                                                       │ │
│ │               <CIMultiDictProxy('Date': 'Mon, 26 Aug 2024 15:06:51 GMT', 'Content-Type':     │ │
│ │               'application/json', 'Content-Length': '229', 'Connection': 'keep-alive',       │ │
│ │               'Strict-Transport-Security': 'max-age=31536000; includeSubDomains')>           │ │
│ │        self = <PrusaAPI.PrusaConnectAPI object at 0x70927e2fd410>                            │ │
│ │     session = <aiohttp.client.ClientSession object at 0x70927e205b90>                        │ │
│ │    snapshot = b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xd… │ │
│ │               $.\' ",#\x1c\x1c(7),01444\x1f\''+75253                                         │ │
│ │       token = '***'                                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
PrivateButts commented 3 weeks ago

Probably the Prusa API isn't liking whatever image it tried to upload. Can you share your config (scrubbing any secrets, of course)? What type of camera are you using?

jupe commented 3 weeks ago

I'm using motion as camera source. config:

global_config:
  connect_endpoint: "https://connect.prusa3d.com" # URL of Prusa Connect service

cameras:                                          # List of cameras to relay snapshots from
  - name: "cam"                             # Name of the camera
    fingerprint: "abc"                               # Unique identifier of the camera, generated by you
    token: "**"                                     # Token of the camera, from Prusa Connect
    interval: 30                                  # Interval between snapshots, in seconds
    handler: "Camera.ImageUrl.ImageUrlHandler"    # Handler to use for this camera
    handler_config:                               # Configuration for the handler
      url: "http://127.0.0.1:8081/0/current"         # URL of the image to capture
    printer_link:                                 # Optional, if you want to limit snapshots to certain printer states
      url: "**"                    # URL of the printer on the local network
      username: "**"                           # Username for the printer
      password: "**"             # Password for the printer
      snapshot_states:                            # You can remove items from this list to prevent snapshots from being taken in certain printer states
        - IDLE
        - BUSY
        - READY
        - PRINTING
        - PAUSED
        - FINISHED
        - STOPPED
        - ERROR
        - ATTENTION