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
¶
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 |
pattern
classmethod
¶
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
¶
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
¶
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
¶
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
¶
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
¶
Parses the tags of a message from the OpenWebNet bus.
In this case, it only checks if the tags are correct.
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
¶
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
¶
Parses the tags of a message from the OpenWebNet bus.
In this case, it only checks if the tags are correct.
pyown.messages.normal.NormalMessage
¶
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##
tags
property
¶
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
¶
Parses the tags of a message from the OpenWebNet bus.
pyown.messages.status.StatusRequest
¶
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##
tags
property
¶
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
¶
Parses the tags of a message from the OpenWebNet bus.
pyown.messages.dimension.DimensionRequest
¶
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##
tags
property
¶
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
¶
Parses the tags of a message from the OpenWebNet bus.
pyown.messages.dimension.DimensionWriting
¶
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##
tags
property
¶
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
¶
Parses the tags of a message from the OpenWebNet bus.
pyown.messages.dimension.DimensionResponse
¶
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##
tags
property
¶
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 |