Skip to main content

Automated JSON API based communication with Samsung SyncThru Web Service

Project description

PySyncThru - a very basic python SyncThru bridge

Build Status Coverage Status Package Version Python Versions

A package that connects to a Samsung printer in the local network that makes use of the SyncThru web service and provides data that is provided via the JSON API of the device. It is able to read the system, toner and tray status and provides method wrappers to access them.

The package supports the following data provided by the printers:

  • Device / System status
  • Drum / Toner status
  • Model name
  • Tray status

Sadly it seems like there is no official API, so fixes are welcome and likely needed!

If your printer's language is not English, the functions might not work.

Usage

import aiohttp
import asyncio
from pysyncthru import SyncThru

IP_PRINTER = '192.168.0.25'

async def main():
    async with aiohttp.ClientSession() as session:
        printer = SyncThru(IP_PRINTER, session)
        await printer.update()

        # Is printer online?
        print("Printer online?:", printer.is_online())
        # Show the printer status
        print("Printer status:", printer.device_status())
        if printer.is_online():
            # Show details about the printer
            print("Printer model:", printer.model())
            # Get the details of a cartridge
            print("Toner Cyan details:", printer.toner_status()['cyan'])
            # Get the details about a tray
            print("Tray 1 Capacity:", printer.input_tray_status()[1]['capa'])
        # Print all available details from the printer
        print("All data:\n", printer.raw())
        
loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Troubleshooting

If the general state of your printer stays at 'Unknown', it might be the case that the language of your printer is not supported.

Even though officially your language is supported it might be that some states are not exactly matching the expected states stored in the library. For this case, have a look at the language support issue template for a detailed how-to on adding support for your printer or open a general issue.

Current supported languages are: English, Russian, German, French, Italian

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PySyncThru-0.7.0.tar.gz (9.0 kB view details)

Uploaded Source

File details

Details for the file PySyncThru-0.7.0.tar.gz.

File metadata

  • Download URL: PySyncThru-0.7.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.1

File hashes

Hashes for PySyncThru-0.7.0.tar.gz
Algorithm Hash digest
SHA256 d96d4d123786f21a52cf4a395df1c302394b66040ad5916ce76d7c97c07197f4
MD5 7c12d2826187b021b4ccbd5e2ae6a886
BLAKE2b-256 097aa47b83c17a82f6bdab43141bfb221df0c548e6571a790ddab6a8dafc56be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page