2021-01-11 00:08:25 +01:00
|
|
|
"""Constants for the Z-Wave JS integration."""
|
2021-03-02 23:22:42 +01:00
|
|
|
import logging
|
|
|
|
|
2021-09-28 09:06:02 +02:00
|
|
|
import voluptuous as vol
|
|
|
|
|
|
|
|
import homeassistant.helpers.config_validation as cv
|
|
|
|
|
2021-03-02 23:22:42 +01:00
|
|
|
CONF_ADDON_DEVICE = "device"
|
2021-06-24 13:15:42 +02:00
|
|
|
CONF_ADDON_EMULATE_HARDWARE = "emulate_hardware"
|
|
|
|
CONF_ADDON_LOG_LEVEL = "log_level"
|
2021-03-02 23:22:42 +01:00
|
|
|
CONF_ADDON_NETWORK_KEY = "network_key"
|
2021-09-30 00:04:24 +02:00
|
|
|
CONF_ADDON_S0_LEGACY_KEY = "s0_legacy_key"
|
|
|
|
CONF_ADDON_S2_ACCESS_CONTROL_KEY = "s2_access_control_key"
|
|
|
|
CONF_ADDON_S2_AUTHENTICATED_KEY = "s2_authenticated_key"
|
|
|
|
CONF_ADDON_S2_UNAUTHENTICATED_KEY = "s2_unauthenticated_key"
|
2021-01-27 08:56:16 +01:00
|
|
|
CONF_INTEGRATION_CREATED_ADDON = "integration_created_addon"
|
2021-03-02 23:22:42 +01:00
|
|
|
CONF_NETWORK_KEY = "network_key"
|
2021-09-30 00:04:24 +02:00
|
|
|
CONF_S0_LEGACY_KEY = "s0_legacy_key"
|
|
|
|
CONF_S2_ACCESS_CONTROL_KEY = "s2_access_control_key"
|
|
|
|
CONF_S2_AUTHENTICATED_KEY = "s2_authenticated_key"
|
|
|
|
CONF_S2_UNAUTHENTICATED_KEY = "s2_unauthenticated_key"
|
2021-03-02 23:22:42 +01:00
|
|
|
CONF_USB_PATH = "usb_path"
|
2021-01-27 08:56:16 +01:00
|
|
|
CONF_USE_ADDON = "use_addon"
|
2021-04-21 03:40:54 +02:00
|
|
|
CONF_DATA_COLLECTION_OPTED_IN = "data_collection_opted_in"
|
2021-01-11 00:08:25 +01:00
|
|
|
DOMAIN = "zwave_js"
|
|
|
|
|
|
|
|
DATA_CLIENT = "client"
|
2021-04-13 02:26:49 +02:00
|
|
|
DATA_PLATFORM_SETUP = "platform_setup"
|
2021-01-18 16:08:52 +01:00
|
|
|
|
|
|
|
EVENT_DEVICE_ADDED_TO_REGISTRY = f"{DOMAIN}_device_added_to_registry"
|
2021-02-01 23:47:58 +01:00
|
|
|
|
2021-03-02 23:22:42 +01:00
|
|
|
LOGGER = logging.getLogger(__package__)
|
|
|
|
|
2021-02-01 23:47:58 +01:00
|
|
|
# constants for events
|
2021-03-29 22:28:55 +02:00
|
|
|
ZWAVE_JS_VALUE_NOTIFICATION_EVENT = f"{DOMAIN}_value_notification"
|
|
|
|
ZWAVE_JS_NOTIFICATION_EVENT = f"{DOMAIN}_notification"
|
2021-04-28 10:22:54 +02:00
|
|
|
ZWAVE_JS_VALUE_UPDATED_EVENT = f"{DOMAIN}_value_updated"
|
2021-02-01 23:47:58 +01:00
|
|
|
ATTR_NODE_ID = "node_id"
|
|
|
|
ATTR_HOME_ID = "home_id"
|
|
|
|
ATTR_ENDPOINT = "endpoint"
|
|
|
|
ATTR_LABEL = "label"
|
|
|
|
ATTR_VALUE = "value"
|
2021-03-02 22:10:30 +01:00
|
|
|
ATTR_VALUE_RAW = "value_raw"
|
2021-02-01 23:47:58 +01:00
|
|
|
ATTR_COMMAND_CLASS = "command_class"
|
|
|
|
ATTR_COMMAND_CLASS_NAME = "command_class_name"
|
|
|
|
ATTR_TYPE = "type"
|
|
|
|
ATTR_PROPERTY_NAME = "property_name"
|
|
|
|
ATTR_PROPERTY_KEY_NAME = "property_key_name"
|
2021-03-02 22:10:30 +01:00
|
|
|
ATTR_PROPERTY = "property"
|
|
|
|
ATTR_PROPERTY_KEY = "property_key"
|
2021-02-02 09:37:42 +01:00
|
|
|
ATTR_PARAMETERS = "parameters"
|
2021-03-29 22:28:55 +02:00
|
|
|
ATTR_EVENT = "event"
|
|
|
|
ATTR_EVENT_LABEL = "event_label"
|
|
|
|
ATTR_EVENT_TYPE = "event_type"
|
|
|
|
ATTR_EVENT_DATA = "event_data"
|
|
|
|
ATTR_DATA_TYPE = "data_type"
|
2021-03-30 11:13:48 +02:00
|
|
|
ATTR_WAIT_FOR_RESULT = "wait_for_result"
|
2021-07-20 10:31:12 +02:00
|
|
|
ATTR_OPTIONS = "options"
|
2021-02-23 13:24:07 +01:00
|
|
|
|
2021-07-12 06:22:33 +02:00
|
|
|
ATTR_NODE = "node"
|
|
|
|
ATTR_ZWAVE_VALUE = "zwave_value"
|
|
|
|
|
2021-08-20 21:21:55 +02:00
|
|
|
# automation trigger attributes
|
|
|
|
ATTR_PREVIOUS_VALUE = "previous_value"
|
|
|
|
ATTR_PREVIOUS_VALUE_RAW = "previous_value_raw"
|
|
|
|
ATTR_CURRENT_VALUE = "current_value"
|
|
|
|
ATTR_CURRENT_VALUE_RAW = "current_value_raw"
|
|
|
|
ATTR_DESCRIPTION = "description"
|
|
|
|
|
2021-02-23 17:35:11 +01:00
|
|
|
# service constants
|
2021-09-28 09:06:02 +02:00
|
|
|
SERVICE_SET_LOCK_USERCODE = "set_lock_usercode"
|
|
|
|
SERVICE_CLEAR_LOCK_USERCODE = "clear_lock_usercode"
|
2021-07-28 23:15:27 +02:00
|
|
|
SERVICE_SET_VALUE = "set_value"
|
|
|
|
SERVICE_RESET_METER = "reset_meter"
|
|
|
|
SERVICE_MULTICAST_SET_VALUE = "multicast_set_value"
|
|
|
|
SERVICE_PING = "ping"
|
|
|
|
SERVICE_REFRESH_VALUE = "refresh_value"
|
2021-02-23 17:35:11 +01:00
|
|
|
SERVICE_SET_CONFIG_PARAMETER = "set_config_parameter"
|
2021-03-30 05:07:55 +02:00
|
|
|
SERVICE_BULK_SET_PARTIAL_CONFIG_PARAMETERS = "bulk_set_partial_config_parameters"
|
2021-02-23 17:35:11 +01:00
|
|
|
|
2021-07-28 23:15:27 +02:00
|
|
|
ATTR_NODES = "nodes"
|
|
|
|
# config parameter
|
2021-02-23 17:35:11 +01:00
|
|
|
ATTR_CONFIG_PARAMETER = "parameter"
|
|
|
|
ATTR_CONFIG_PARAMETER_BITMASK = "bitmask"
|
|
|
|
ATTR_CONFIG_VALUE = "value"
|
2021-07-28 23:15:27 +02:00
|
|
|
# refresh value
|
2021-02-24 00:58:04 +01:00
|
|
|
ATTR_REFRESH_ALL_VALUES = "refresh_all_values"
|
2021-07-28 23:15:27 +02:00
|
|
|
# multicast
|
2021-05-28 03:57:35 +02:00
|
|
|
ATTR_BROADCAST = "broadcast"
|
2021-07-28 23:15:27 +02:00
|
|
|
# meter reset
|
|
|
|
ATTR_METER_TYPE = "meter_type"
|
2021-08-20 22:25:39 +02:00
|
|
|
ATTR_METER_TYPE_NAME = "meter_type_name"
|
2021-06-14 22:38:35 +02:00
|
|
|
|
2021-02-23 13:24:07 +01:00
|
|
|
ADDON_SLUG = "core_zwave_js"
|
2021-08-20 22:25:39 +02:00
|
|
|
|
|
|
|
# Sensor entity description constants
|
|
|
|
ENTITY_DESC_KEY_BATTERY = "battery"
|
|
|
|
ENTITY_DESC_KEY_CURRENT = "current"
|
|
|
|
ENTITY_DESC_KEY_VOLTAGE = "voltage"
|
|
|
|
ENTITY_DESC_KEY_ENERGY_MEASUREMENT = "energy_measurement"
|
|
|
|
ENTITY_DESC_KEY_ENERGY_TOTAL_INCREASING = "energy_total_increasing"
|
|
|
|
ENTITY_DESC_KEY_POWER = "power"
|
|
|
|
ENTITY_DESC_KEY_POWER_FACTOR = "power_factor"
|
|
|
|
ENTITY_DESC_KEY_CO = "co"
|
|
|
|
ENTITY_DESC_KEY_CO2 = "co2"
|
|
|
|
ENTITY_DESC_KEY_HUMIDITY = "humidity"
|
|
|
|
ENTITY_DESC_KEY_ILLUMINANCE = "illuminance"
|
|
|
|
ENTITY_DESC_KEY_PRESSURE = "pressure"
|
|
|
|
ENTITY_DESC_KEY_SIGNAL_STRENGTH = "signal_strength"
|
|
|
|
ENTITY_DESC_KEY_TEMPERATURE = "temperature"
|
|
|
|
ENTITY_DESC_KEY_TARGET_TEMPERATURE = "target_temperature"
|
|
|
|
ENTITY_DESC_KEY_TIMESTAMP = "timestamp"
|
2021-08-30 17:48:36 +02:00
|
|
|
ENTITY_DESC_KEY_MEASUREMENT = "measurement"
|
|
|
|
ENTITY_DESC_KEY_TOTAL_INCREASING = "total_increasing"
|
2021-09-28 09:06:02 +02:00
|
|
|
|
|
|
|
# Schema Constants
|
|
|
|
|
|
|
|
# Validates that a bitmask is provided in hex form and converts it to decimal
|
|
|
|
# int equivalent since that's what the library uses
|
|
|
|
BITMASK_SCHEMA = vol.All(
|
|
|
|
cv.string,
|
|
|
|
vol.Lower,
|
|
|
|
vol.Match(
|
|
|
|
r"^(0x)?[0-9a-f]+$",
|
|
|
|
msg="Must provide an integer (e.g. 255) or a bitmask in hex form (e.g. 0xff)",
|
|
|
|
),
|
|
|
|
lambda value: int(value, 16),
|
|
|
|
)
|
|
|
|
|
|
|
|
VALUE_SCHEMA = vol.Any(
|
|
|
|
bool,
|
|
|
|
vol.Coerce(int),
|
|
|
|
vol.Coerce(float),
|
|
|
|
BITMASK_SCHEMA,
|
|
|
|
cv.string,
|
|
|
|
)
|