Skip to main content

Async Python control helpers for Sony projectors

Project description

Sony Projector Protocol

Async Python helpers for discovering and controlling Sony projectors from local automation systems.

This package is intended to be wrapped by applications such as Home Assistant integrations. It handles Sony protocol framing, parsing, timeouts, and protocol-specific errors while leaving model selection and entity policy to the upstream application.

How It Works

Sony projectors can expose several local protocols:

  • SDAP is the discovery advertisement protocol. It reports metadata such as IP address, product name, serial number, power status, installation location, and SDCP community when the projector advertises it.
  • SDCP / PJ Talk is a control protocol used by many Sony projectors. SDCP commands include a 4-character community value. The default community is SONY, and callers can provide another one when needed.
  • ADCP is another Sony control protocol. Some projectors require password authentication before ADCP commands can be used.

Discovery does not decide which control protocol to use. An upstream application should choose protocol="sdcp" or protocol="adcp" from user configuration, a model database, or its own integration logic. This package does not probe ports or auto-detect ADCP versus SDCP.

Install

pip install sony-projector-protocol

Discover Projectors

discover() listens for SDAP advertisements and returns the metadata that was advertised.

from sony_projector_protocol import discover

devices = await discover()

for device in devices:
    print(device.ip, device.product_name, device.serial_number, device.community)

The discovered community is not a password or decryption key for SDAP. It is metadata that can be passed into SDCP commands if the projector uses a non-default community.

Control With SDCP

from sony_projector_protocol import Projector

projector = Projector(host="192.168.1.50", protocol="sdcp")

await projector.connect()
try:
    power = await projector.get_power()
    active_input = await projector.get_input()

    await projector.set_power(True)
    await projector.set_input("hdmi1")
finally:
    await projector.close()

To use a discovered or configured SDCP community:

projector = Projector(
    host=device.ip,
    protocol="sdcp",
    community=device.community,
)

If community is omitted or None, SDCP uses the default community SONY.

Control With ADCP

from sony_projector_protocol import Projector

projector = Projector(
    host="192.168.1.50",
    protocol="adcp",
    adcp_password="Projector"
)

await projector.connect()
try:
    power = await projector.get_power()
    signal = await projector.get_signal()

    await projector.set_power(False)
finally:
    await projector.close()

If the projector does not require ADCP authentication, omit adcp_password.

Identity

Both protocol clients expose identity helpers where the selected projector supports them:

identity = await projector.get_identity()

print(identity.model)
print(identity.serial)
print(identity.location)
print(identity.mac_address)

SDCP identity reads model name, serial number, installation location, and MAC address. ADCP identity reads model name, serial number, and MAC address; installation location is returned as None because the ADCP command set does not expose it.

Model Capability Helpers

The package includes static capability helpers for integrations that need setup-time option lists. Feature keys are protocol-specific because Sony ADCP and SDCP commands use different names, encodings, and support tables. ADCP option lists are model-aware and use Sony's model-to-series command-list mappings. SDCP currently exposes package-supported option lists through a generic SDCP fallback for any model returned by identity.

from sony_projector_protocol import (
    FEATURE_ADCP_PICTURE_MODE,
    FEATURE_SDCP_CALIBRATION_PRESET,
    PROTOCOL_ADCP,
    PROTOCOL_SDCP,
    get_adcp_picture_mode_options,
    get_feature_values,
)

identity = await projector.get_identity()
model = identity.model or ""

options = get_adcp_picture_mode_options(model)
# Equivalent:
options = get_feature_values(model, FEATURE_ADCP_PICTURE_MODE, protocol=PROTOCOL_ADCP)

if options is None:
    # Unknown model or unsupported feature. Do not create the select entity,
    # mark it unavailable, or use an integration-level override.
    return

print(options)

Use returned values as command values for methods such as set_picture_mode or set_calibration_preset. ADCP capability data is organized as model-to-series mappings and series-to-feature mappings, matching Sony's supported command lists. Unknown or unlisted ADCP models return None so integrations can omit the entity, disable it, or apply their own override policy. SDCP calibration preset lookup returns the package-supported values for any model string when the sdcp protocol is requested, but the projector may still reject the command at runtime.

See Home Assistant Integration Examples for select-entity usage rules and Developer Guide for adding new capability data.

Unsupported Commands

Projector features vary by model and protocol. Unsupported requests raise UnsupportedCommandError. Use the more specific subclasses when an integration needs to tell local request validation apart from a projector response:

  • PackageUnsupportedCommandError means this package or the selected protocol cannot issue the request, such as calling an SDCP-only method on an ADCP connection or passing a value this package does not encode.
  • ProjectorUnsupportedCommandError means the request was sent and the projector rejected it as unsupported or not available.

Projector response errors include troubleshooting metadata when available: protocol, command, response, response_text, and response_hex.

from sony_projector_protocol import ProjectorUnsupportedCommandError

try:
    lamp_timer = await projector.get_lamp_timer()
except ProjectorUnsupportedCommandError as err:
    print(err.protocol, err.command, err.response_text or err.response_hex)
    lamp_timer = None

This lets upstream applications create optional entities for advanced calls and mark them disabled or unavailable when the projector reports that it does not support them. Applications that do not need the distinction can catch UnsupportedCommandError.

Command Areas

Protocol-neutral methods include power, input, lamp control, aspect ratio, color space, HDR, HDMI dynamic range, identity, and MAC address where the selected protocol supports them.

ADCP-specific methods include signal, temperature, timer, picture mode, warning/error details, and version.

SDCP-specific methods include calibration preset, color temperature, contrast enhancer, advanced iris, gamma correction, picture muting, motionflow, 2D/3D controls, picture position, reality creation, input lag reduction, menu position, error status, installation location, and lamp timer.

See Command Matrix for the current method support table.

Development

Run the offline unit tests with:

pytest

More project docs:

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

sony_projector_protocol-0.3.5.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sony_projector_protocol-0.3.5-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file sony_projector_protocol-0.3.5.tar.gz.

File metadata

  • Download URL: sony_projector_protocol-0.3.5.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sony_projector_protocol-0.3.5.tar.gz
Algorithm Hash digest
SHA256 4229ed68252deb78cff79d480abd3a015e458c4a1432991350630bc1a10cfd43
MD5 66ce2b11729e6ba6f7ab2629fe9db14a
BLAKE2b-256 f07531c5bcc5296a1b398042dd47b7b54671f767864beba4caff5bae49b12006

See more details on using hashes here.

Provenance

The following attestation bundles were made for sony_projector_protocol-0.3.5.tar.gz:

Publisher: publish.yml on apaperclip/sony_projector_protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sony_projector_protocol-0.3.5-py3-none-any.whl.

File metadata

File hashes

Hashes for sony_projector_protocol-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cb7b9b5a1af981c95a09dbe6463c6cc5d04df8d9175552d8cbd462f045d64c08
MD5 85055fccb83c73794da70c3f0a184123
BLAKE2b-256 7de3441240ee3095ed1586d9e90ee3086b547e347b028a59c1051ead0d7d26ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for sony_projector_protocol-0.3.5-py3-none-any.whl:

Publisher: publish.yml on apaperclip/sony_projector_protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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