* Mqtt Notify service draft * fix updates * Remove TARGET config parameter * do not use protected attributes * complete tests * device support for auto discovery * Add targets attribute and support for data param * Add tests and resolve naming issues * CONF_COMMAND_TEMPLATE from .const * Use mqtt as default service name * make sure service has a unique name * pylint error * fix type error * Conditional device removal and test * Improve tests * update description has_notify_services() * Use TypedDict for service config * casting- fix discovery - hass.data * cleanup * move MqttNotificationConfig after the schemas * fix has_notify_services * do not test log for reg update * Improve casting types * Simplify obtaining the device_id Co-authored-by: Erik Montnemery <erik@montnemery.com> * await not needed Co-authored-by: Erik Montnemery <erik@montnemery.com> * Improve casting types and naming * cleanup_device_registry signature change and black * remove not needed condition Co-authored-by: Erik Montnemery <erik@montnemery.com>
68 lines
1.7 KiB
Python
68 lines
1.7 KiB
Python
"""Constants used by multiple MQTT modules."""
|
|
from typing import Final
|
|
|
|
from homeassistant.const import CONF_PAYLOAD
|
|
|
|
ATTR_DISCOVERY_HASH = "discovery_hash"
|
|
ATTR_DISCOVERY_PAYLOAD = "discovery_payload"
|
|
ATTR_DISCOVERY_TOPIC = "discovery_topic"
|
|
ATTR_PAYLOAD = "payload"
|
|
ATTR_QOS = "qos"
|
|
ATTR_RETAIN = "retain"
|
|
ATTR_TOPIC = "topic"
|
|
|
|
CONF_AVAILABILITY = "availability"
|
|
CONF_BROKER = "broker"
|
|
CONF_BIRTH_MESSAGE = "birth_message"
|
|
CONF_COMMAND_TEMPLATE: Final = "command_template"
|
|
CONF_COMMAND_TOPIC: Final = "command_topic"
|
|
CONF_ENCODING: Final = "encoding"
|
|
CONF_QOS: Final = "qos"
|
|
CONF_RETAIN: Final = "retain"
|
|
CONF_STATE_TOPIC = "state_topic"
|
|
CONF_STATE_VALUE_TEMPLATE = "state_value_template"
|
|
CONF_TOPIC = "topic"
|
|
CONF_WILL_MESSAGE = "will_message"
|
|
|
|
CONF_CERTIFICATE = "certificate"
|
|
CONF_CLIENT_KEY = "client_key"
|
|
CONF_CLIENT_CERT = "client_cert"
|
|
CONF_TLS_INSECURE = "tls_insecure"
|
|
CONF_TLS_VERSION = "tls_version"
|
|
|
|
DATA_MQTT_CONFIG = "mqtt_config"
|
|
DATA_MQTT_RELOAD_NEEDED = "mqtt_reload_needed"
|
|
|
|
DEFAULT_PREFIX = "homeassistant"
|
|
DEFAULT_BIRTH_WILL_TOPIC = DEFAULT_PREFIX + "/status"
|
|
DEFAULT_DISCOVERY = True
|
|
DEFAULT_ENCODING = "utf-8"
|
|
DEFAULT_QOS = 0
|
|
DEFAULT_PAYLOAD_AVAILABLE = "online"
|
|
DEFAULT_PAYLOAD_NOT_AVAILABLE = "offline"
|
|
DEFAULT_RETAIN = False
|
|
|
|
DEFAULT_BIRTH = {
|
|
ATTR_TOPIC: DEFAULT_BIRTH_WILL_TOPIC,
|
|
CONF_PAYLOAD: DEFAULT_PAYLOAD_AVAILABLE,
|
|
ATTR_QOS: DEFAULT_QOS,
|
|
ATTR_RETAIN: DEFAULT_RETAIN,
|
|
}
|
|
|
|
DEFAULT_WILL = {
|
|
ATTR_TOPIC: DEFAULT_BIRTH_WILL_TOPIC,
|
|
CONF_PAYLOAD: DEFAULT_PAYLOAD_NOT_AVAILABLE,
|
|
ATTR_QOS: DEFAULT_QOS,
|
|
ATTR_RETAIN: DEFAULT_RETAIN,
|
|
}
|
|
|
|
DOMAIN = "mqtt"
|
|
|
|
MQTT_CONNECTED = "mqtt_connected"
|
|
MQTT_DISCONNECTED = "mqtt_disconnected"
|
|
|
|
PAYLOAD_EMPTY_JSON = "{}"
|
|
PAYLOAD_NONE = "None"
|
|
|
|
PROTOCOL_31 = "3.1"
|
|
PROTOCOL_311 = "3.1.1"
|