Skip to content

Tags

This module defines all the basic building blocks for every message. Each message is composed of a series of tags, each of which represents a specific piece of information. Tags can be of different types, such as Who, What, Where, Dimension, and Value. Each tag can have a set of parameters that further define its meaning.

pyown.tags.base.VALID_TAG_CHARS module-attribute

VALID_TAG_CHARS: Final[str] = '0123456789#'

This are the only valid characters for a tag

pyown.tags.base.is_valid_tag

is_valid_tag(tag: str) -> bool

Checks if the tag is valid.

A tag is valid if it contains only the characters defined in the VALID_TAG_CHARS constant.

Parameters:

Name Type Description Default
tag str

The tag to check

required

Returns:

Name Type Description
bool bool

True if the tag is valid, False otherwise

pyown.tags.base.Tag

Tag(string: str | int = '', *args, **kwargs)

Tag class.

This a base class for all the other types of tags. This class does not support parameters. To use parameters, use the TagWithParameters class.

string property

string: str

Returns the value of the tag

tag property

tag: str | None

Returns the value of the tag without its parameters or prefix

parameters property

parameters: list[str] | None

Returns the parameters of the tag. For a tag without parameters, this function returns None.

with_parameter

with_parameter(parameter: str | int) -> TagWithParameters

Returns the tag with the specified parameter

pyown.tags.base.TagWithParameters

TagWithParameters(string: str | int = '', *args, **kwargs)

Bases: Tag

Tag with parameters.

A tag with parameters is a tag that contains a value and a list of parameters. So, it follows the following format value#parameter1#parameter2#...#parameterN

string property

string: str

Returns the value of the tag

tag property

tag: str

Returns the value of the tag without its parameters or prefix

parameters property

parameters: list[str]

Returns the parameters of the tag

with_parameter

with_parameter(parameter: str | int) -> Self

Returns the tag with the specified parameter

pyown.tags.who.Who

Who(string: str | int = '', *args, **kwargs)

Bases: Tag, StrEnum

Who tag class.

This is an enum class because the value allowed in this tag is limited to the ones listed.

Attributes:

Name Type Description
SCENE str

used for scenarios modules

LIGHTING str

used to manage all lighting devices

AUTOMATION str

used to control shutter, rolling shutters, and other automation devices

LOAD_CONTROL str

used to control power management devices

THERMOREGULATION str

used to control heating and cooling centralized systems or probes

BURGLAR_ALARM str

used to control security systems

DOOR_ENTRY_SYSTEM str

used to control outdoor entry systems

VIDEO_DOOR_ENTRY str

used to control video door entry systems

AUXILIARY str

used to control auxiliary devices

GATEWAY str

used to get information about the gateway

ACTUATORS_LOCKS str

used to control actuators and locks

CEN_1 str

similar to the SCENE who

SOUND_DIFFUSION_1 str

used to control sound diffusion systems

MH200N_SCENE str

used to control scenarios on the MH200N (similar to SCENE)

ENERGY_MANAGEMENT str

used to read data from energy measurement devices

SOUND_DIFFUSION_2 str

extension of SOUND_DIFFUSION_1

LIGHTING_MANAGEMENT str

extension of LIGHTING

CEN_2 str

extension of CEN_1

AUTOMATION_DIAGNOSTICS str

used to read and set low level values to automation devices (only used by the official MyHome software)

THERMOREGULATION_DIAGNOSTICS str

used to read and set low level values to thermoregulation devices (only used by the official MyHome software)

DEVICE_DIAGNOSTICS str

used to read and set low level values to devices (only used by the official MyHome software)

ENERGY_DIAGNOSTICS str

used to read and set low level values to energy management devices . (only used by the official MyHome software)

string property

string: str

Returns the value of the tag

tag property

tag: str | None

Returns the value of the tag without its parameters or prefix

parameters property

parameters: list[str] | None

Returns the parameters of the tag. For a tag without parameters, this function returns None.

name property

name: str

Get a string description of the tag

with_parameter

with_parameter(parameter: str | int) -> TagWithParameters

Returns the tag with the specified parameter

pyown.tags.what.What

What(string: str | int = '', *args, **kwargs)

Bases: TagWithParameters

Represents the WHAT tag.

The tag WHAT, identifies the action to make (ON lights, OFF lights, dimmer at 20%, shutters UP, shutters DOWN, etc...)

string property

string: str

Returns the value of the tag

tag property

tag: str

Returns the value of the tag without its parameters or prefix

parameters property

parameters: list[str]

Returns the parameters of the tag

with_parameter

with_parameter(parameter: str | int) -> Self

Returns the tag with the specified parameter

pyown.tags.where.Where

Where(string: str | int = '', *args, **kwargs)

Bases: TagWithParameters

Represents the WHERE tag.

The tag WHERE is the address on the bus for the related device. This can indicate, also, a group of devices or a local bus.

string property

string: str

Returns the value of the tag

tag property

tag: str

Returns the value of the tag without its parameters or prefix

parameters property

parameters: list[str]

Returns the parameters of the tag

type property

type: WhereType

Gets what the where tag indicates to.

Returns:

Name Type Description
WhereType WhereType

The type of the WHERE tag.

with_parameter

with_parameter(parameter: str | int) -> Self

Returns the tag with the specified parameter

pyown.tags.dimension.Dimension

Dimension(string: str | int = '', *args, **kwargs)

Bases: TagWithParameters

Represents the DIMENSION tag.

It's used in dimension messages.

It's not clear in the official documentation what exactly is the DIMENSION tag. But in many cases it's used to request information about the status of a device, making it similar to the WHAT tag.

string property

string: str

Returns the value of the tag

tag property

tag: str

Returns the value of the tag without its parameters or prefix

parameters property

parameters: list[str]

Returns the parameters of the tag

with_parameter

with_parameter(parameter: str | int) -> Self

Returns the tag with the specified parameter

pyown.tags.base.Value

Value(string: str | int = '', *args, **kwargs)

Bases: Tag

Represents a value tag in a dimension response message.

string property

string: str

Returns the value of the tag

tag property

tag: str | None

Returns the value of the tag without its parameters or prefix

parameters property

parameters: list[str] | None

Returns the parameters of the tag. For a tag without parameters, this function returns None.

with_parameter

with_parameter(parameter: str | int) -> TagWithParameters

Returns the tag with the specified parameter