2015-09-26 13:57:01 +00:00
|
|
|
# coding: utf-8
|
2016-01-31 02:03:51 +00:00
|
|
|
"""Constants used by Home Assistant components."""
|
2015-08-29 22:59:05 +00:00
|
|
|
|
2016-03-26 08:01:46 +00:00
|
|
|
__version__ = "0.16.0"
|
2016-02-28 04:41:03 +00:00
|
|
|
REQUIRED_PYTHON_VER = (3, 4)
|
2015-08-29 22:59:05 +00:00
|
|
|
|
2014-12-07 07:57:02 +00:00
|
|
|
# Can be used to specify a catch all when registering state or event listeners.
|
|
|
|
MATCH_ALL = '*'
|
|
|
|
|
2015-01-11 17:20:41 +00:00
|
|
|
# If no name is specified
|
|
|
|
DEVICE_DEFAULT_NAME = "Unnamed Device"
|
|
|
|
|
2014-12-07 07:57:02 +00:00
|
|
|
# #### CONFIG ####
|
2016-01-24 22:13:39 +00:00
|
|
|
CONF_ICON = "icon"
|
2014-12-07 07:57:02 +00:00
|
|
|
CONF_LATITUDE = "latitude"
|
|
|
|
CONF_LONGITUDE = "longitude"
|
2015-03-19 06:02:58 +00:00
|
|
|
CONF_TEMPERATURE_UNIT = "temperature_unit"
|
|
|
|
CONF_NAME = "name"
|
|
|
|
CONF_TIME_ZONE = "time_zone"
|
2015-04-25 18:47:15 +00:00
|
|
|
CONF_CUSTOMIZE = "customize"
|
2014-12-07 07:57:02 +00:00
|
|
|
|
|
|
|
CONF_PLATFORM = "platform"
|
|
|
|
CONF_HOST = "host"
|
|
|
|
CONF_HOSTS = "hosts"
|
|
|
|
CONF_USERNAME = "username"
|
|
|
|
CONF_PASSWORD = "password"
|
2015-01-04 09:01:49 +00:00
|
|
|
CONF_API_KEY = "api_key"
|
2015-01-11 07:47:23 +00:00
|
|
|
CONF_ACCESS_TOKEN = "access_token"
|
2016-01-02 21:13:58 +00:00
|
|
|
CONF_FILENAME = "filename"
|
2016-01-31 08:55:46 +00:00
|
|
|
CONF_SCAN_INTERVAL = "scan_interval"
|
2015-12-11 05:39:01 +00:00
|
|
|
CONF_VALUE_TEMPLATE = "value_template"
|
|
|
|
|
2014-12-07 07:57:02 +00:00
|
|
|
# #### EVENTS ####
|
|
|
|
EVENT_HOMEASSISTANT_START = "homeassistant_start"
|
|
|
|
EVENT_HOMEASSISTANT_STOP = "homeassistant_stop"
|
|
|
|
EVENT_STATE_CHANGED = "state_changed"
|
|
|
|
EVENT_TIME_CHANGED = "time_changed"
|
2014-12-14 06:40:00 +00:00
|
|
|
EVENT_CALL_SERVICE = "call_service"
|
|
|
|
EVENT_SERVICE_EXECUTED = "service_executed"
|
2015-01-12 16:21:50 +00:00
|
|
|
EVENT_PLATFORM_DISCOVERED = "platform_discovered"
|
2015-02-14 06:49:56 +00:00
|
|
|
EVENT_COMPONENT_LOADED = "component_loaded"
|
|
|
|
EVENT_SERVICE_REGISTERED = "service_registered"
|
2014-12-07 07:57:02 +00:00
|
|
|
|
|
|
|
# #### STATES ####
|
|
|
|
STATE_ON = 'on'
|
|
|
|
STATE_OFF = 'off'
|
|
|
|
STATE_HOME = 'home'
|
|
|
|
STATE_NOT_HOME = 'not_home'
|
2015-09-10 06:37:15 +00:00
|
|
|
STATE_UNKNOWN = 'unknown'
|
2015-01-20 01:16:04 +00:00
|
|
|
STATE_OPEN = 'open'
|
|
|
|
STATE_CLOSED = 'closed'
|
2015-06-01 07:24:17 +00:00
|
|
|
STATE_PLAYING = 'playing'
|
|
|
|
STATE_PAUSED = 'paused'
|
2015-06-02 06:55:54 +00:00
|
|
|
STATE_IDLE = 'idle'
|
2015-08-31 10:07:52 +00:00
|
|
|
STATE_STANDBY = 'standby'
|
2015-09-13 05:42:38 +00:00
|
|
|
STATE_ALARM_DISARMED = 'disarmed'
|
|
|
|
STATE_ALARM_ARMED_HOME = 'armed_home'
|
|
|
|
STATE_ALARM_ARMED_AWAY = 'armed_away'
|
2015-09-28 23:36:46 +00:00
|
|
|
STATE_ALARM_PENDING = 'pending'
|
|
|
|
STATE_ALARM_TRIGGERED = 'triggered'
|
2015-11-23 00:35:22 +00:00
|
|
|
STATE_LOCKED = 'locked'
|
|
|
|
STATE_UNLOCKED = 'unlocked'
|
2016-01-31 02:03:51 +00:00
|
|
|
STATE_UNAVAILABLE = 'unavailable'
|
2014-12-07 07:57:02 +00:00
|
|
|
|
2014-12-14 06:40:00 +00:00
|
|
|
# #### STATE AND EVENT ATTRIBUTES ####
|
2014-12-07 07:57:02 +00:00
|
|
|
# Contains current time for a TIME_CHANGED event
|
|
|
|
ATTR_NOW = "now"
|
|
|
|
|
|
|
|
# Contains domain, service for a SERVICE_CALL event
|
|
|
|
ATTR_DOMAIN = "domain"
|
|
|
|
ATTR_SERVICE = "service"
|
2016-01-30 23:16:31 +00:00
|
|
|
ATTR_SERVICE_DATA = "service_data"
|
2014-12-07 07:57:02 +00:00
|
|
|
|
2014-12-14 06:40:00 +00:00
|
|
|
# Data for a SERVICE_EXECUTED event
|
|
|
|
ATTR_SERVICE_CALL_ID = "service_call_id"
|
|
|
|
|
2014-12-07 07:57:02 +00:00
|
|
|
# Contains one string or a list of strings, each being an entity id
|
|
|
|
ATTR_ENTITY_ID = 'entity_id'
|
|
|
|
|
|
|
|
# String with a friendly name for the entity
|
|
|
|
ATTR_FRIENDLY_NAME = "friendly_name"
|
|
|
|
|
|
|
|
# A picture to represent entity
|
|
|
|
ATTR_ENTITY_PICTURE = "entity_picture"
|
|
|
|
|
2015-11-03 08:20:48 +00:00
|
|
|
# Icon to use in the frontend
|
|
|
|
ATTR_ICON = "icon"
|
|
|
|
|
2014-12-07 07:57:02 +00:00
|
|
|
# The unit of measurement if applicable
|
|
|
|
ATTR_UNIT_OF_MEASUREMENT = "unit_of_measurement"
|
|
|
|
|
2015-01-06 08:10:33 +00:00
|
|
|
# Temperature attribute
|
|
|
|
ATTR_TEMPERATURE = "temperature"
|
|
|
|
TEMP_CELCIUS = "°C"
|
|
|
|
TEMP_FAHRENHEIT = "°F"
|
2015-01-06 01:11:02 +00:00
|
|
|
|
2015-01-11 07:47:23 +00:00
|
|
|
# Contains the information that is discovered
|
|
|
|
ATTR_DISCOVERED = "discovered"
|
|
|
|
|
2015-02-23 01:36:28 +00:00
|
|
|
# Location of the device/sensor
|
|
|
|
ATTR_LOCATION = "location"
|
|
|
|
|
|
|
|
ATTR_BATTERY_LEVEL = "battery_level"
|
|
|
|
|
2016-03-06 03:32:28 +00:00
|
|
|
# For devices which support a code attribute
|
|
|
|
ATTR_CODE = 'code'
|
|
|
|
ATTR_CODE_FORMAT = 'code_format'
|
|
|
|
|
2015-03-08 21:10:31 +00:00
|
|
|
# For devices which support an armed state
|
|
|
|
ATTR_ARMED = "device_armed"
|
|
|
|
|
2015-11-23 00:35:22 +00:00
|
|
|
# For devices which support a locked state
|
|
|
|
ATTR_LOCKED = "locked"
|
|
|
|
|
2015-03-08 21:10:31 +00:00
|
|
|
# For sensors that support 'tripping', eg. motion and door sensors
|
|
|
|
ATTR_TRIPPED = "device_tripped"
|
|
|
|
|
|
|
|
# For sensors that support 'tripping' this holds the most recent
|
|
|
|
# time the device was tripped
|
|
|
|
ATTR_LAST_TRIP_TIME = "last_tripped_time"
|
|
|
|
|
2015-04-15 02:57:32 +00:00
|
|
|
# For all entity's, this hold whether or not it should be hidden
|
|
|
|
ATTR_HIDDEN = "hidden"
|
|
|
|
|
2015-09-29 06:13:13 +00:00
|
|
|
# Location of the entity
|
|
|
|
ATTR_LATITUDE = "latitude"
|
|
|
|
ATTR_LONGITUDE = "longitude"
|
|
|
|
|
2015-09-30 06:08:37 +00:00
|
|
|
# Accuracy of location in meters
|
|
|
|
ATTR_GPS_ACCURACY = 'gps_accuracy'
|
|
|
|
|
2016-02-14 07:42:11 +00:00
|
|
|
# If state is assumed
|
|
|
|
ATTR_ASSUMED_STATE = 'assumed_state'
|
|
|
|
|
2014-12-07 07:57:02 +00:00
|
|
|
# #### SERVICES ####
|
|
|
|
SERVICE_HOMEASSISTANT_STOP = "stop"
|
2016-01-27 03:39:59 +00:00
|
|
|
SERVICE_HOMEASSISTANT_RESTART = "restart"
|
2014-12-07 07:57:02 +00:00
|
|
|
|
|
|
|
SERVICE_TURN_ON = 'turn_on'
|
|
|
|
SERVICE_TURN_OFF = 'turn_off'
|
2016-01-16 15:45:05 +00:00
|
|
|
SERVICE_TOGGLE = 'toggle'
|
2014-12-07 07:57:02 +00:00
|
|
|
|
|
|
|
SERVICE_VOLUME_UP = "volume_up"
|
|
|
|
SERVICE_VOLUME_DOWN = "volume_down"
|
|
|
|
SERVICE_VOLUME_MUTE = "volume_mute"
|
2015-05-31 11:36:28 +00:00
|
|
|
SERVICE_VOLUME_SET = "volume_set"
|
2014-12-07 07:57:02 +00:00
|
|
|
SERVICE_MEDIA_PLAY_PAUSE = "media_play_pause"
|
|
|
|
SERVICE_MEDIA_PLAY = "media_play"
|
|
|
|
SERVICE_MEDIA_PAUSE = "media_pause"
|
|
|
|
SERVICE_MEDIA_NEXT_TRACK = "media_next_track"
|
2015-06-01 07:24:17 +00:00
|
|
|
SERVICE_MEDIA_PREVIOUS_TRACK = "media_previous_track"
|
2015-06-03 22:17:03 +00:00
|
|
|
SERVICE_MEDIA_SEEK = "media_seek"
|
2014-12-07 07:57:02 +00:00
|
|
|
|
2015-09-13 05:42:38 +00:00
|
|
|
SERVICE_ALARM_DISARM = "alarm_disarm"
|
|
|
|
SERVICE_ALARM_ARM_HOME = "alarm_arm_home"
|
|
|
|
SERVICE_ALARM_ARM_AWAY = "alarm_arm_away"
|
2015-09-28 23:36:46 +00:00
|
|
|
SERVICE_ALARM_TRIGGER = "alarm_trigger"
|
2015-09-13 05:42:38 +00:00
|
|
|
|
2015-11-23 00:35:22 +00:00
|
|
|
SERVICE_LOCK = "lock"
|
|
|
|
SERVICE_UNLOCK = "unlock"
|
|
|
|
|
2016-02-01 02:39:04 +00:00
|
|
|
SERVICE_OPEN = "open"
|
|
|
|
SERVICE_CLOSE = "close"
|
|
|
|
|
2015-12-02 12:16:13 +00:00
|
|
|
SERVICE_MOVE_UP = 'move_up'
|
|
|
|
SERVICE_MOVE_DOWN = 'move_down'
|
2015-11-25 18:20:16 +00:00
|
|
|
SERVICE_STOP = 'stop'
|
2015-11-17 15:17:57 +00:00
|
|
|
|
2014-12-07 07:57:02 +00:00
|
|
|
# #### API / REMOTE ####
|
|
|
|
SERVER_PORT = 8123
|
|
|
|
|
2015-02-14 02:27:13 +00:00
|
|
|
URL_ROOT = "/"
|
2014-12-07 07:57:02 +00:00
|
|
|
URL_API = "/api/"
|
2015-02-14 02:27:13 +00:00
|
|
|
URL_API_STREAM = "/api/stream"
|
2015-05-02 01:24:32 +00:00
|
|
|
URL_API_CONFIG = "/api/config"
|
2014-12-07 07:57:02 +00:00
|
|
|
URL_API_STATES = "/api/states"
|
|
|
|
URL_API_STATES_ENTITY = "/api/states/{}"
|
|
|
|
URL_API_EVENTS = "/api/events"
|
|
|
|
URL_API_EVENTS_EVENT = "/api/events/{}"
|
|
|
|
URL_API_SERVICES = "/api/services"
|
|
|
|
URL_API_SERVICES_SERVICE = "/api/services/{}/{}"
|
|
|
|
URL_API_EVENT_FORWARD = "/api/event_forwarding"
|
2015-02-01 03:08:50 +00:00
|
|
|
URL_API_COMPONENTS = "/api/components"
|
2015-11-07 09:44:02 +00:00
|
|
|
URL_API_ERROR_LOG = "/api/error_log"
|
2015-11-29 01:18:35 +00:00
|
|
|
URL_API_LOG_OUT = "/api/log_out"
|
2015-12-10 07:56:20 +00:00
|
|
|
URL_API_TEMPLATE = "/api/template"
|
2015-02-14 02:27:13 +00:00
|
|
|
|
|
|
|
HTTP_OK = 200
|
|
|
|
HTTP_CREATED = 201
|
|
|
|
HTTP_MOVED_PERMANENTLY = 301
|
|
|
|
HTTP_BAD_REQUEST = 400
|
|
|
|
HTTP_UNAUTHORIZED = 401
|
|
|
|
HTTP_NOT_FOUND = 404
|
|
|
|
HTTP_METHOD_NOT_ALLOWED = 405
|
|
|
|
HTTP_UNPROCESSABLE_ENTITY = 422
|
2015-10-11 22:14:05 +00:00
|
|
|
HTTP_INTERNAL_SERVER_ERROR = 500
|
2015-02-14 02:27:13 +00:00
|
|
|
|
|
|
|
HTTP_HEADER_HA_AUTH = "X-HA-access"
|
|
|
|
HTTP_HEADER_ACCEPT_ENCODING = "Accept-Encoding"
|
|
|
|
HTTP_HEADER_CONTENT_TYPE = "Content-type"
|
|
|
|
HTTP_HEADER_CONTENT_ENCODING = "Content-Encoding"
|
|
|
|
HTTP_HEADER_VARY = "Vary"
|
|
|
|
HTTP_HEADER_CONTENT_LENGTH = "Content-Length"
|
|
|
|
HTTP_HEADER_CACHE_CONTROL = "Cache-Control"
|
|
|
|
HTTP_HEADER_EXPIRES = "Expires"
|
|
|
|
|
|
|
|
CONTENT_TYPE_JSON = "application/json"
|
2015-07-10 08:04:17 +00:00
|
|
|
CONTENT_TYPE_MULTIPART = 'multipart/x-mixed-replace; boundary={}'
|
2015-11-07 09:44:02 +00:00
|
|
|
CONTENT_TYPE_TEXT_PLAIN = 'text/plain'
|
2016-02-06 14:48:36 +00:00
|
|
|
|
|
|
|
# The exit code to send to request a restart
|
|
|
|
RESTART_EXIT_CODE = 100
|