python-snap7

Getting Started

  • Introduction
  • Installation
  • PLC Support Matrix

User Guide

  • Connecting to PLCs
  • Reading & Writing Data
  • Multi-Variable Read
  • Advanced PLC Operations
  • S7-200 Serial PPI
  • Server Setup for Testing
  • Command-Line Interface
  • TIA Portal Configuration

Troubleshooting

  • Error Message Reference
  • Connection Issues
  • Thread Safety
  • Protocol Limitations and FAQ

Development

  • Development

API Reference

  • Client
  • Server
  • Partner
  • Logo
    • Logo
      • Logo.__init__()
      • Logo.connect()
      • Logo.read()
      • Logo.write()
  • PPI
  • Util
  • Tags
  • Optimizer
  • Rate Limiter
  • Logging
  • SZL Parsers
  • Discovery
  • Demo Server
  • Types
  • Errors

Internals

  • Connection
  • Shared Client Internals
  • S7 Protocol
  • Data Types
python-snap7
  • Logo
  • View page source

Logo

class snap7.logo.Logo(*, auto_reconnect: bool = False, max_retries: int = 3, retry_delay: float = 1.0, backoff_factor: float = 2.0, max_delay: float = 30.0, heartbeat_interval: float = 0, max_requests_per_second: float = 0, rate_limit_algorithm: Literal['fixed', 'token_bucket'] = 'fixed', rate_limit_behavior: Literal['block', 'raise'] = 'block', rate_limit_burst: int | None = None, on_disconnect: Callable[[], None] | None = None, on_reconnect: Callable[[], None] | None = None, **kwargs: object)[source]

A snap7 Siemens Logo client.

There are two main comfort functions available: Logo.read() and Logo.write(). This function offers high-level access to the VM addresses of the Siemens Logo just use the form:

Notes

V10.3 for bit values V10 for the complete byte VW12 for a word (used for analog values) For more information see examples for Siemens Logo 7 and 8

__init__(*, auto_reconnect: bool = False, max_retries: int = 3, retry_delay: float = 1.0, backoff_factor: float = 2.0, max_delay: float = 30.0, heartbeat_interval: float = 0, max_requests_per_second: float = 0, rate_limit_algorithm: Literal['fixed', 'token_bucket'] = 'fixed', rate_limit_behavior: Literal['block', 'raise'] = 'block', rate_limit_burst: int | None = None, on_disconnect: Callable[[], None] | None = None, on_reconnect: Callable[[], None] | None = None, **kwargs: object) → None[source]

Initialize Logo client.

Parameters:
  • auto_reconnect – Reconnect automatically after connection loss.

  • max_retries – Maximum number of reconnection attempts.

  • retry_delay – Initial reconnection delay in seconds.

  • backoff_factor – Multiplier for successive retry delays.

  • max_delay – Maximum reconnection delay in seconds.

  • heartbeat_interval – Heartbeat interval in seconds (0 disables it).

  • max_requests_per_second – Maximum outbound requests per second (0 disables it).

  • rate_limit_algorithm – fixed for even spacing or token_bucket for bursts.

  • rate_limit_behavior – block to wait or raise to reject immediately.

  • rate_limit_burst – Token bucket capacity. Defaults to one second of requests.

  • on_disconnect – Callback invoked when the connection is lost.

  • on_reconnect – Callback invoked after successful reconnection.

  • **kwargs – Ignored. Kept for backwards compatibility.

connect(ip_address: str, tsap_snap7: int, tsap_logo: int, tcp_port: int = 102) → Logo[source]

Connect to a Siemens LOGO server.

Notes

Howto setup Logo communication configuration see: https://snap7.sourceforge.net/logo.html

Parameters:
  • ip_address – IP ip_address of server

  • tsap_snap7 – TSAP SNAP7 Client (e.g. 10.00 = 0x1000)

  • tsap_logo – TSAP Logo Server (e.g. 20.00 = 0x2000)

  • tcp_port – TCP port of server

Returns:

The snap7 Logo instance

read(vm_address: str) → int[source]

Reads from VM addresses of Siemens Logo.

Examples

read(“V40”) / read(“VW64”) / read(“V10.2”)

Parameters:

vm_address – of Logo memory (e.g. V30.1, VW32, V24)

Returns:

integer

write(vm_address: str, value: int) → int[source]

Writes to VM addresses of Siemens Logo.

Parameters:
  • vm_address – write offset

  • value – integer

Returns:

0 on success

Examples

>>> Logo().write("VW10", 200) or Logo().write("V10.3", 1)
Previous Next

© Copyright 2013-2026, Gijs Molenaar, Stephan Preeker.

Built with Sphinx using a theme provided by Read the Docs.