scsgate package

Submodules

scsgate.connection module

This module contains an helper class to initiate a connection with the SCSGate device

class scsgate.connection.Connection(device, logger)[source]

Bases: object

Connection to SCSGate device

close()[source]

Closes the connection to the serial port and ensure no pending operatoin are left

serial

Returns the pyserial.Serial instance

scsgate.messages module

This module contains the definition of all the messages known by SCSGate

class scsgate.messages.AckMessage[source]

Bases: scsgate.messages.SCSMessage

Ack message

class scsgate.messages.CommandMessage(data)[source]

Bases: scsgate.messages.SCSMessage

Message issued to turn on/off a switch

destination

The target of the message

entity

The ID of the subject of this message

source

The source of the message

status

Current status

class scsgate.messages.RequestStatusMessage(data)[source]

Bases: scsgate.messages.SCSMessage

Message sent to request the status of a switch

destination

The target of the message

entity

The ID of the subject of this message

source

The source of the message

class scsgate.messages.SCSMessage(data)[source]

Bases: object

Base class for all SCS messages

bytes

A list containing all the bytes of the message

data

The raw message

entity

The ID of the subject of this message

class scsgate.messages.ScenarioTriggeredMessage(data)[source]

Bases: scsgate.messages.SCSMessage

Message issued when a scenario switch is pressed

entity

The ID of the subject of this message

scenario

The scenario ID

source

The source of the message

class scsgate.messages.StateMessage(data)[source]

Bases: scsgate.messages.SCSMessage

Message issued to notify a change of state

entity

The ID of the subject of this message

source

The source of the message

status

Current status

toggled

True if the light is toggled, False otherwise

class scsgate.messages.UnknownMessage(data)[source]

Bases: scsgate.messages.SCSMessage

Message unknown

scsgate.messages.checksum_bytes(data)[source]

Returns a XOR of all the bytes specified inside of the given list

scsgate.messages.compose_telegram(body)[source]

Compose a SCS message

body: list containing the body of the message. returns: full telegram expressed (bytes instance)

scsgate.messages.parse(data)[source]

Parses a raw datagram and return the right type of message

scsgate.reactor module

This module contains the definition of the Reactor class. This one is useful when dealing with concurrent access to the SCSGate device

class scsgate.reactor.Reactor(connection, handle_message, logger=None)[source]

Bases: threading.Thread

Allows concurrent access to the SCSGate device

append_task(task)[source]

Adds a tasks to the list of the jobs to execute

run()[source]

Starts the thread

stop()[source]

Blocks the thread, performs cleanup of the associated connection

scsgate.tasks module

This module contains all the possible messages to send via scsgate.Reactor

class scsgate.tasks.BasicTask[source]

Bases: object

Basic task, not to be used directly

execute(connection)[source]

Method to be implemented by all subclasses

exception scsgate.tasks.ExecutionError[source]

Bases: BaseException

Error raised when something goes wrong while executing a task

class scsgate.tasks.GetStatusTask(target)[source]

Bases: scsgate.tasks.BasicTask

Requests the current status of a device

execute(connection)[source]

Method to be implemented by all subclasses

class scsgate.tasks.HaltRollerShutterTask(target)[source]

Bases: scsgate.tasks.SetStatusTask

Halt a roller shutter

class scsgate.tasks.LowerRollerShutterTask(target)[source]

Bases: scsgate.tasks.SetStatusTask

Lower a roller shutter

class scsgate.tasks.MonitorTask(notification_endpoint)[source]

Bases: scsgate.tasks.BasicTask

Read the buffer and invokes the notification endpoint if there’s a relevant message

execute(connection)[source]

Method to be implemented by all subclasses

class scsgate.tasks.RaiseRollerShutterTask(target)[source]

Bases: scsgate.tasks.SetStatusTask

Raise a roller shutter

class scsgate.tasks.SetStatusTask(target, action)[source]

Bases: scsgate.tasks.BasicTask

Generic task to request a status change. To not be used directly

execute(connection)[source]

Method to be implemented by all subclasses

class scsgate.tasks.ToggleStatusTask(target, toggled)[source]

Bases: scsgate.tasks.SetStatusTask

Change the toggled status of a light or switch

Module contents