Skip to content

Messages module

This module represents all the possible types of messages that can be sent or received.

Generally, messages are composed of a series of specific tags, each of which represents a specific piece of information. They follow the following structure:

*tag1*tag2*tag3*tagN##

Each tag can have a set of parameters that further define its meaning.

pyown.messages.base.parse_message

parse_message(message: str) -> BaseMessage

Parses a message from the OpenWebNet bus.

Parameters:

Name Type Description Default
message str

The message to parse

required

Returns:

Name Type Description
BaseMessage BaseMessage

The appropriate message class instance, GenericMessage if the message has an unknown WHO tag or its structure is unknown

pyown.messages.base.BaseMessage

BaseMessage(*args, **kwargs)

Bases: ABC


              flowchart TD
              pyown.messages.base.BaseMessage[BaseMessage]

              

              click pyown.messages.base.BaseMessage href "" "pyown.messages.base.BaseMessage"
            

Base class for all the messages from the OpenWebNet bus.

It defines the structure of the messages and the methods to parse and create them.

Attributes:

Name Type Description
prefix str

Prefix of the message

suffix str

Suffix of the message

separator str

Separator of the tags

tags property

tags: tuple[str, ...] | list[str]

Returns a copy of the tags.

The tags are the elements that compose the message, like the WHO, WHAT, WHERE, etc.

Returns:

Type Description
tuple[str, ...] | list[str]

tuple[str, ...] | list[str]: The tags of the message

type property

type: MessageType

Returns the type of the message.

Returns:

Name Type Description
MessageType MessageType

The type of the message

message abstractmethod property

message: str

Returns the message represented by the class.

This function is equivalent to the __str__ method.

Returns:

Name Type Description
str str

The message

bytes property

bytes: bytes

Returns the message encoded in bytes.

Returns:

Name Type Description
bytes bytes

The message encoded in bytes

who property

who: Who | None

Returns the WHO tag of the message.

where property

where: Where | None

Returns the WHERE tag of the message.

pattern classmethod

pattern() -> Pattern[str]

Returns the regex pattern used to match the message represented by the class.

Returns:

Type Description
Pattern[str]

Pattern[str]: The regex pattern used to match the message

parse classmethod

parse(tags: list[str]) -> BaseMessage

Parses the tags of a message and returns an instance of the class.

Subclasses override this; the base implementation only signals it is missing.

pyown.messages.base.GenericMessage

GenericMessage(tags: list[str])

Bases: BaseMessage


              flowchart TD
              pyown.messages.base.GenericMessage[GenericMessage]
              pyown.messages.base.BaseMessage[BaseMessage]

                              pyown.messages.base.BaseMessage --> pyown.messages.base.GenericMessage
                


              click pyown.messages.base.GenericMessage href "" "pyown.messages.base.GenericMessage"
              click pyown.messages.base.BaseMessage href "" "pyown.messages.base.BaseMessage"
            

Represents a generic message.

This is used when the message has an unknown structure, or to send specific messages that don't need a specific class to represent them.

message property

message: str

Returns the string representation of the message.

Returns:

Name Type Description
str str

The message

tags property

tags: tuple[str, ...] | list[str]

Returns a copy of the tags.

The tags are the elements that compose the message, like the WHO, WHAT, WHERE, etc.

Returns:

Type Description
tuple[str, ...] | list[str]

tuple[str, ...] | list[str]: The tags of the message

type property

type: MessageType

Returns the type of the message.

Returns:

Name Type Description
MessageType MessageType

The type of the message

bytes property

bytes: bytes

Returns the message encoded in bytes.

Returns:

Name Type Description
bytes bytes

The message encoded in bytes

who property

who: Who | None

Returns the WHO tag of the message.

where property

where: Where | None

Returns the WHERE tag of the message.

parse classmethod

parse(tags: list[str]) -> Self

Parses the tags of a message from the OpenWebNet bus.

In this case, it only checks if the tags are correct.

Parameters:

Name Type Description Default
tags list[str]

The tags of the message

required

Returns:

Name Type Description
GenericMessage Self

The instance of the class

pattern classmethod

pattern() -> Pattern[str]

Returns the regex pattern used to match the message represented by the class.

Returns:

Type Description
Pattern[str]

Pattern[str]: The regex pattern used to match the message

pyown.messages.ack.ACK

ACK()

Bases: BaseMessage


              flowchart TD
              pyown.messages.ack.ACK[ACK]
              pyown.messages.base.BaseMessage[BaseMessage]

                              pyown.messages.base.BaseMessage --> pyown.messages.ack.ACK
                


              click pyown.messages.ack.ACK href "" "pyown.messages.ack.ACK"
              click pyown.messages.base.BaseMessage href "" "pyown.messages.base.BaseMessage"
            

Represents an ACK message.

Used to acknowledge a command sent or to end a list of messages sent as a result of a command.

Syntax: *#*1## (constant string)

message property

message: str

Returns the string representation of the message.

It's a constant string: *#*1##

tags property

tags: tuple[str, ...] | list[str]

Returns a copy of the tags.

The tags are the elements that compose the message, like the WHO, WHAT, WHERE, etc.

Returns:

Type Description
tuple[str, ...] | list[str]

tuple[str, ...] | list[str]: The tags of the message

type property

type: MessageType

Returns the type of the message.

Returns:

Name Type Description
MessageType MessageType

The type of the message

bytes property

bytes: bytes

Returns the message encoded in bytes.

Returns:

Name Type Description
bytes bytes

The message encoded in bytes

who property

who: Who | None

Returns the WHO tag of the message.

where property

where: Where | None

Returns the WHERE tag of the message.

parse classmethod

parse(tags: list[str]) -> Self

Parses the tags of a message from the OpenWebNet bus.

In this case, it only checks if the tags are correct.

pattern classmethod

pattern() -> Pattern[str]

Returns the regex pattern used to match the message represented by the class.

Returns:

Type Description
Pattern[str]

Pattern[str]: The regex pattern used to match the message

pyown.messages.nack.NACK

NACK()

Bases: BaseMessage


              flowchart TD
              pyown.messages.nack.NACK[NACK]
              pyown.messages.base.BaseMessage[BaseMessage]

                              pyown.messages.base.BaseMessage --> pyown.messages.nack.NACK
                


              click pyown.messages.nack.NACK href "" "pyown.messages.nack.NACK"
              click pyown.messages.base.BaseMessage href "" "pyown.messages.base.BaseMessage"
            

Represents a NACK message.

Used to signal that a command sent wasn’t executed correctly, or it's not supported.

Syntax: *#*0## (constant string)

message property

message: str

Returns the string representation of the message.

It's a constant string: *#*0##

tags property

tags: tuple[str, ...] | list[str]

Returns a copy of the tags.

The tags are the elements that compose the message, like the WHO, WHAT, WHERE, etc.

Returns:

Type Description
tuple[str, ...] | list[str]

tuple[str, ...] | list[str]: The tags of the message

type property

type: MessageType

Returns the type of the message.

Returns:

Name Type Description
MessageType MessageType

The type of the message

bytes property

bytes: bytes

Returns the message encoded in bytes.

Returns:

Name Type Description
bytes bytes

The message encoded in bytes

who property

who: Who | None

Returns the WHO tag of the message.

where property

where: Where | None

Returns the WHERE tag of the message.

parse classmethod

parse(tags: list[str]) -> Self

Parses the tags of a message from the OpenWebNet bus.

In this case, it only checks if the tags are correct.

pattern classmethod

pattern() -> Pattern[str]

Returns the regex pattern used to match the message represented by the class.

Returns:

Type Description
Pattern[str]

Pattern[str]: The regex pattern used to match the message

pyown.messages.normal.NormalMessage

NormalMessage(tags: tuple[Who, What, Where])

Bases: BaseMessage


              flowchart TD
              pyown.messages.normal.NormalMessage[NormalMessage]
              pyown.messages.base.BaseMessage[BaseMessage]

                              pyown.messages.base.BaseMessage --> pyown.messages.normal.NormalMessage
                


              click pyown.messages.normal.NormalMessage href "" "pyown.messages.normal.NormalMessage"
              click pyown.messages.base.BaseMessage href "" "pyown.messages.base.BaseMessage"
            

Represents a Normal message.

Syntax: *who*what*where##

who property

who: Who

The WHO tag of the message.

what property

what: What

The WHAT tag of the message.

where property

where: Where

The WHERE tag of the message.

message property

message: str

The string representation of the message as sent on the bus.

tags property

tags: tuple[str, ...] | list[str]

Returns a copy of the tags.

The tags are the elements that compose the message, like the WHO, WHAT, WHERE, etc.

Returns:

Type Description
tuple[str, ...] | list[str]

tuple[str, ...] | list[str]: The tags of the message

type property

type: MessageType

Returns the type of the message.

Returns:

Name Type Description
MessageType MessageType

The type of the message

bytes property

bytes: bytes

Returns the message encoded in bytes.

Returns:

Name Type Description
bytes bytes

The message encoded in bytes

parse classmethod

parse(tags: list[str]) -> Self

Parses the tags of a message from the OpenWebNet bus.

pattern classmethod

pattern() -> Pattern[str]

Returns the regex pattern used to match the message represented by the class.

Returns:

Type Description
Pattern[str]

Pattern[str]: The regex pattern used to match the message

pyown.messages.status.StatusRequest

StatusRequest(tags: tuple[Who, Where])

Bases: BaseMessage


              flowchart TD
              pyown.messages.status.StatusRequest[StatusRequest]
              pyown.messages.base.BaseMessage[BaseMessage]

                              pyown.messages.base.BaseMessage --> pyown.messages.status.StatusRequest
                


              click pyown.messages.status.StatusRequest href "" "pyown.messages.status.StatusRequest"
              click pyown.messages.base.BaseMessage href "" "pyown.messages.base.BaseMessage"
            

Represents a status request message.

Syntax: *#who*where##

who property

who: Who

The WHO tag of the message.

where property

where: Where

The WHERE tag of the message.

message property

message: str

The string representation of the message as sent on the bus.

tags property

tags: tuple[str, ...] | list[str]

Returns a copy of the tags.

The tags are the elements that compose the message, like the WHO, WHAT, WHERE, etc.

Returns:

Type Description
tuple[str, ...] | list[str]

tuple[str, ...] | list[str]: The tags of the message

type property

type: MessageType

Returns the type of the message.

Returns:

Name Type Description
MessageType MessageType

The type of the message

bytes property

bytes: bytes

Returns the message encoded in bytes.

Returns:

Name Type Description
bytes bytes

The message encoded in bytes

parse classmethod

parse(tags: list[str]) -> Self

Parses the tags of a message from the OpenWebNet bus.

pattern classmethod

pattern() -> Pattern[str]

Returns the regex pattern used to match the message represented by the class.

Returns:

Type Description
Pattern[str]

Pattern[str]: The regex pattern used to match the message

pyown.messages.dimension.DimensionRequest

DimensionRequest(tags: tuple[Who, Where, Dimension])

Bases: BaseMessage


              flowchart TD
              pyown.messages.dimension.DimensionRequest[DimensionRequest]
              pyown.messages.base.BaseMessage[BaseMessage]

                              pyown.messages.base.BaseMessage --> pyown.messages.dimension.DimensionRequest
                


              click pyown.messages.dimension.DimensionRequest href "" "pyown.messages.dimension.DimensionRequest"
              click pyown.messages.base.BaseMessage href "" "pyown.messages.base.BaseMessage"
            

Represents a dimension request message.

Syntax: *#who*where*dimension##

who property

who: Who

The WHO tag of the message.

where property

where: Where

The WHERE tag of the message.

dimension property

dimension: Dimension

The DIMENSION tag of the message.

message property

message: str

The string representation of the message as sent on the bus.

tags property

tags: tuple[str, ...] | list[str]

Returns a copy of the tags.

The tags are the elements that compose the message, like the WHO, WHAT, WHERE, etc.

Returns:

Type Description
tuple[str, ...] | list[str]

tuple[str, ...] | list[str]: The tags of the message

type property

type: MessageType

Returns the type of the message.

Returns:

Name Type Description
MessageType MessageType

The type of the message

bytes property

bytes: bytes

Returns the message encoded in bytes.

Returns:

Name Type Description
bytes bytes

The message encoded in bytes

parse classmethod

parse(tags: list[str]) -> Self

Parses the tags of a message from the OpenWebNet bus.

pattern classmethod

pattern() -> Pattern[str]

Returns the regex pattern used to match the message represented by the class.

Returns:

Type Description
Pattern[str]

Pattern[str]: The regex pattern used to match the message

pyown.messages.dimension.DimensionWriting

DimensionWriting(
    tags: tuple[
        Who, Where, Dimension, *(tuple[Value, ...])
    ],
)

Bases: BaseMessage


              flowchart TD
              pyown.messages.dimension.DimensionWriting[DimensionWriting]
              pyown.messages.base.BaseMessage[BaseMessage]

                              pyown.messages.base.BaseMessage --> pyown.messages.dimension.DimensionWriting
                


              click pyown.messages.dimension.DimensionWriting href "" "pyown.messages.dimension.DimensionWriting"
              click pyown.messages.base.BaseMessage href "" "pyown.messages.base.BaseMessage"
            

Represents a dimension writing message.

Syntax: *#who*where*#dimension*value1*value2*...*valueN##

who property

who: Who

The WHO tag of the message.

where property

where: Where

The WHERE tag of the message.

dimension property

dimension: Dimension

The DIMENSION tag of the message.

values property

values: tuple[Value, ...]

The VALUE tags of the message.

message property

message: str

The string representation of the message as sent on the bus.

tags property

tags: tuple[str, ...] | list[str]

Returns a copy of the tags.

The tags are the elements that compose the message, like the WHO, WHAT, WHERE, etc.

Returns:

Type Description
tuple[str, ...] | list[str]

tuple[str, ...] | list[str]: The tags of the message

type property

type: MessageType

Returns the type of the message.

Returns:

Name Type Description
MessageType MessageType

The type of the message

bytes property

bytes: bytes

Returns the message encoded in bytes.

Returns:

Name Type Description
bytes bytes

The message encoded in bytes

parse classmethod

parse(tags: list[str]) -> Self

Parses the tags of a message from the OpenWebNet bus.

pattern classmethod

pattern() -> Pattern[str]

Returns the regex pattern used to match the message represented by the class.

Returns:

Type Description
Pattern[str]

Pattern[str]: The regex pattern used to match the message

pyown.messages.dimension.DimensionResponse

DimensionResponse(
    tags: tuple[
        Who, Where, Dimension, *(tuple[Value, ...])
    ],
)

Bases: DimensionWriting, BaseMessage


              flowchart TD
              pyown.messages.dimension.DimensionResponse[DimensionResponse]
              pyown.messages.dimension.DimensionWriting[DimensionWriting]
              pyown.messages.base.BaseMessage[BaseMessage]

                              pyown.messages.dimension.DimensionWriting --> pyown.messages.dimension.DimensionResponse
                                pyown.messages.base.BaseMessage --> pyown.messages.dimension.DimensionWriting
                

                pyown.messages.base.BaseMessage --> pyown.messages.dimension.DimensionResponse
                


              click pyown.messages.dimension.DimensionResponse href "" "pyown.messages.dimension.DimensionResponse"
              click pyown.messages.dimension.DimensionWriting href "" "pyown.messages.dimension.DimensionWriting"
              click pyown.messages.base.BaseMessage href "" "pyown.messages.base.BaseMessage"
            

Represents a dimension writing message.

Syntax: *#who*where*dimension*value1*value2*...*valueN##

message property

message: str

The string representation of the message as sent on the bus.

tags property

tags: tuple[str, ...] | list[str]

Returns a copy of the tags.

The tags are the elements that compose the message, like the WHO, WHAT, WHERE, etc.

Returns:

Type Description
tuple[str, ...] | list[str]

tuple[str, ...] | list[str]: The tags of the message

type property

type: MessageType

Returns the type of the message.

Returns:

Name Type Description
MessageType MessageType

The type of the message

bytes property

bytes: bytes

Returns the message encoded in bytes.

Returns:

Name Type Description
bytes bytes

The message encoded in bytes

who property

who: Who

The WHO tag of the message.

where property

where: Where

The WHERE tag of the message.

dimension property

dimension: Dimension

The DIMENSION tag of the message.

values property

values: tuple[Value, ...]

The VALUE tags of the message.

pattern classmethod

pattern() -> Pattern[str]

Returns the regex pattern used to match the message represented by the class.

Returns:

Type Description
Pattern[str]

Pattern[str]: The regex pattern used to match the message

parse classmethod

parse(tags: list[str]) -> Self

Parses the tags of a message from the OpenWebNet bus.