Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.matrix Namespace Reference

Namespaces

 const
 
 notify
 

Classes

class  ConfigCommand
 
class  MatrixBot
 

Functions

bool async_setup (HomeAssistant hass, ConfigType config)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
string ATTR_FORMAT = "format"
 
string ATTR_IMAGES = "images"
 
 COMMAND_SCHEMA
 
string CONF_ROOMS_REGEX = "^[!|#][^:]*:.*"
 
string CONF_USERNAME_REGEX = "^@[^:]*:.*"
 
 CONFIG_SCHEMA
 
string DEFAULT_CONTENT_TYPE = "application/octet-stream"
 
 DEFAULT_MESSAGE_FORMAT = FORMAT_TEXT
 
string EVENT_MATRIX_COMMAND = "matrix_command"
 
 ExpressionCommand = NewType("ExpressionCommand", re.Pattern)
 
 Final
 
list MESSAGE_FORMATS = [FORMAT_HTML, FORMAT_TEXT]
 
 RoomAlias = NewType("RoomAlias", str)
 
 RoomAnyID = RoomID | RoomAlias
 
 RoomID = NewType("RoomID", str)
 
 SERVICE_SCHEMA_SEND_MESSAGE
 
string SESSION_FILE = ".matrix.conf"
 
 WordCommand = NewType("WordCommand", str)
 

Detailed Description

The Matrix bot component.

Function Documentation

◆ async_setup()

bool homeassistant.components.matrix.async_setup ( HomeAssistant  hass,
ConfigType  config 
)
Set up the Matrix bot component.

Definition at line 136 of file __init__.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.matrix._LOGGER = logging.getLogger(__name__)
private

Definition at line 49 of file __init__.py.

◆ ATTR_FORMAT

string homeassistant.components.matrix.ATTR_FORMAT = "format"

Definition at line 69 of file __init__.py.

◆ ATTR_IMAGES

string homeassistant.components.matrix.ATTR_IMAGES = "images"

Definition at line 70 of file __init__.py.

◆ COMMAND_SCHEMA

homeassistant.components.matrix.COMMAND_SCHEMA
Initial value:
1 = vol.All(
2  vol.Schema(
3  {
4  vol.Exclusive(CONF_WORD, "trigger"): cv.string,
5  vol.Exclusive(CONF_EXPRESSION, "trigger"): cv.is_regex,
6  vol.Required(CONF_NAME): cv.string,
7  vol.Optional(CONF_ROOMS): vol.All(
8  cv.ensure_list, [cv.matches_regex(CONF_ROOMS_REGEX)]
9  ),
10  }
11  ),
12  cv.has_at_least_one_key(CONF_WORD, CONF_EXPRESSION),
13 )

Definition at line 88 of file __init__.py.

◆ CONF_ROOMS_REGEX

string homeassistant.components.matrix.CONF_ROOMS_REGEX = "^[!|#][^:]*:.*"

Definition at line 60 of file __init__.py.

◆ CONF_USERNAME_REGEX

string homeassistant.components.matrix.CONF_USERNAME_REGEX = "^@[^:]*:.*"

Definition at line 59 of file __init__.py.

◆ CONFIG_SCHEMA

homeassistant.components.matrix.CONFIG_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  DOMAIN: vol.Schema(
4  {
5  vol.Required(CONF_HOMESERVER): cv.url,
6  vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean,
7  vol.Required(CONF_USERNAME): cv.matches_regex(CONF_USERNAME_REGEX),
8  vol.Required(CONF_PASSWORD): cv.string,
9  vol.Optional(CONF_ROOMS, default=[]): vol.All(
10  cv.ensure_list, [cv.matches_regex(CONF_ROOMS_REGEX)]
11  ),
12  vol.Optional(CONF_COMMANDS, default=[]): [COMMAND_SCHEMA],
13  }
14  )
15  },
16  extra=vol.ALLOW_EXTRA,
17 )

Definition at line 102 of file __init__.py.

◆ DEFAULT_CONTENT_TYPE

string homeassistant.components.matrix.DEFAULT_CONTENT_TYPE = "application/octet-stream"

Definition at line 64 of file __init__.py.

◆ DEFAULT_MESSAGE_FORMAT

homeassistant.components.matrix.DEFAULT_MESSAGE_FORMAT = FORMAT_TEXT

Definition at line 67 of file __init__.py.

◆ EVENT_MATRIX_COMMAND

string homeassistant.components.matrix.EVENT_MATRIX_COMMAND = "matrix_command"

Definition at line 62 of file __init__.py.

◆ ExpressionCommand

homeassistant.components.matrix.ExpressionCommand = NewType("ExpressionCommand", re.Pattern)

Definition at line 73 of file __init__.py.

◆ Final

homeassistant.components.matrix.Final

Definition at line 53 of file __init__.py.

◆ MESSAGE_FORMATS

list homeassistant.components.matrix.MESSAGE_FORMATS = [FORMAT_HTML, FORMAT_TEXT]

Definition at line 66 of file __init__.py.

◆ RoomAlias

homeassistant.components.matrix.RoomAlias = NewType("RoomAlias", str)

Definition at line 74 of file __init__.py.

◆ RoomAnyID

homeassistant.components.matrix.RoomAnyID = RoomID | RoomAlias

Definition at line 76 of file __init__.py.

◆ RoomID

homeassistant.components.matrix.RoomID = NewType("RoomID", str)

Definition at line 75 of file __init__.py.

◆ SERVICE_SCHEMA_SEND_MESSAGE

homeassistant.components.matrix.SERVICE_SCHEMA_SEND_MESSAGE
Initial value:
1 = vol.Schema(
2  {
3  vol.Required(ATTR_MESSAGE): cv.string,
4  vol.Optional(ATTR_DATA, default={}): {
5  vol.Optional(ATTR_FORMAT, default=DEFAULT_MESSAGE_FORMAT): vol.In(
6  MESSAGE_FORMATS
7  ),
8  vol.Optional(ATTR_IMAGES): vol.All(cv.ensure_list, [cv.string]),
9  },
10  vol.Required(ATTR_TARGET): vol.All(
11  cv.ensure_list, [cv.matches_regex(CONF_ROOMS_REGEX)]
12  ),
13  }
14 )

Definition at line 120 of file __init__.py.

◆ SESSION_FILE

string homeassistant.components.matrix.SESSION_FILE = ".matrix.conf"

Definition at line 51 of file __init__.py.

◆ WordCommand

homeassistant.components.matrix.WordCommand = NewType("WordCommand", str)

Definition at line 72 of file __init__.py.