mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Add constants for device classes of binary_sensor (#1549)
This commit is contained in:
parent
34d37961c3
commit
422f0ad7a9
2 changed files with 39 additions and 7 deletions
|
@ -7,16 +7,26 @@ from esphome.const import CONF_DEVICE_CLASS, CONF_FILTERS, \
|
|||
CONF_ID, CONF_INTERNAL, CONF_INVALID_COOLDOWN, CONF_INVERTED, \
|
||||
CONF_MAX_LENGTH, CONF_MIN_LENGTH, CONF_ON_CLICK, \
|
||||
CONF_ON_DOUBLE_CLICK, CONF_ON_MULTI_CLICK, CONF_ON_PRESS, CONF_ON_RELEASE, CONF_ON_STATE, \
|
||||
CONF_STATE, CONF_TIMING, CONF_TRIGGER_ID, CONF_FOR, CONF_NAME, CONF_MQTT_ID
|
||||
CONF_STATE, CONF_TIMING, CONF_TRIGGER_ID, CONF_FOR, CONF_NAME, CONF_MQTT_ID, \
|
||||
DEVICE_CLASS_EMPTY, DEVICE_CLASS_BATTERY, DEVICE_CLASS_BATTERY_CHARGING, DEVICE_CLASS_COLD, \
|
||||
DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_DOOR, DEVICE_CLASS_GARAGE_DOOR, DEVICE_CLASS_GAS, \
|
||||
DEVICE_CLASS_HEAT, DEVICE_CLASS_LIGHT, DEVICE_CLASS_LOCK, DEVICE_CLASS_MOISTURE, \
|
||||
DEVICE_CLASS_MOTION, DEVICE_CLASS_MOVING, DEVICE_CLASS_OCCUPANCY, DEVICE_CLASS_OPENING, \
|
||||
DEVICE_CLASS_PLUG, DEVICE_CLASS_POWER, DEVICE_CLASS_PRESENCE, DEVICE_CLASS_PROBLEM, \
|
||||
DEVICE_CLASS_SAFETY, DEVICE_CLASS_SMOKE, DEVICE_CLASS_SOUND, DEVICE_CLASS_VIBRATION, \
|
||||
DEVICE_CLASS_WINDOW
|
||||
from esphome.core import CORE, coroutine, coroutine_with_priority
|
||||
from esphome.util import Registry
|
||||
|
||||
CODEOWNERS = ['@esphome/core']
|
||||
DEVICE_CLASSES = [
|
||||
'', 'battery', 'cold', 'connectivity', 'door', 'garage_door', 'gas',
|
||||
'heat', 'light', 'lock', 'moisture', 'motion', 'moving', 'occupancy',
|
||||
'opening', 'plug', 'power', 'presence', 'problem', 'safety', 'smoke',
|
||||
'sound', 'vibration', 'window'
|
||||
DEVICE_CLASS_EMPTY, DEVICE_CLASS_BATTERY, DEVICE_CLASS_BATTERY_CHARGING, DEVICE_CLASS_COLD,
|
||||
DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_DOOR, DEVICE_CLASS_GARAGE_DOOR, DEVICE_CLASS_GAS,
|
||||
DEVICE_CLASS_HEAT, DEVICE_CLASS_LIGHT, DEVICE_CLASS_LOCK, DEVICE_CLASS_MOISTURE,
|
||||
DEVICE_CLASS_MOTION, DEVICE_CLASS_MOVING, DEVICE_CLASS_OCCUPANCY, DEVICE_CLASS_OPENING,
|
||||
DEVICE_CLASS_PLUG, DEVICE_CLASS_POWER, DEVICE_CLASS_PRESENCE, DEVICE_CLASS_PROBLEM,
|
||||
DEVICE_CLASS_SAFETY, DEVICE_CLASS_SMOKE, DEVICE_CLASS_SOUND, DEVICE_CLASS_VIBRATION,
|
||||
DEVICE_CLASS_WINDOW
|
||||
]
|
||||
|
||||
IS_PLATFORM_COMPONENT = True
|
||||
|
|
|
@ -666,18 +666,40 @@ UNIT_VOLT_AMPS_REACTIVE = 'VAR'
|
|||
UNIT_WATT = 'W'
|
||||
UNIT_WATT_HOURS = 'Wh'
|
||||
|
||||
# device classes of binary_sensor component
|
||||
DEVICE_CLASS_BATTERY_CHARGING = 'battery_charging'
|
||||
DEVICE_CLASS_COLD = 'cold'
|
||||
DEVICE_CLASS_CONNECTIVITY = 'connectivity'
|
||||
DEVICE_CLASS_DOOR = 'door'
|
||||
DEVICE_CLASS_GARAGE_DOOR = 'garage_door'
|
||||
DEVICE_CLASS_GAS = 'gas'
|
||||
DEVICE_CLASS_HEAT = 'heat'
|
||||
DEVICE_CLASS_LIGHT = 'light'
|
||||
DEVICE_CLASS_LOCK = 'lock'
|
||||
DEVICE_CLASS_MOISTURE = 'moisture'
|
||||
DEVICE_CLASS_MOTION = 'motion'
|
||||
DEVICE_CLASS_MOVING = 'moving'
|
||||
|
||||
DEVICE_CLASS_OCCUPANCY = 'occupancy'
|
||||
DEVICE_CLASS_OPENING = 'opening'
|
||||
DEVICE_CLASS_PLUG = 'plug'
|
||||
DEVICE_CLASS_PRESENCE = 'presence'
|
||||
DEVICE_CLASS_PROBLEM = 'problem'
|
||||
DEVICE_CLASS_SAFETY = 'safety'
|
||||
DEVICE_CLASS_SMOKE = 'smoke'
|
||||
DEVICE_CLASS_SOUND = 'sound'
|
||||
DEVICE_CLASS_VIBRATION = 'vibration'
|
||||
DEVICE_CLASS_WINDOW = 'window'
|
||||
# device classes of both binary_sensor and sensor component
|
||||
DEVICE_CLASS_EMPTY = ''
|
||||
DEVICE_CLASS_BATTERY = 'battery'
|
||||
DEVICE_CLASS_POWER = 'power'
|
||||
# device classes of sensor component
|
||||
DEVICE_CLASS_CURRENT = 'current'
|
||||
DEVICE_CLASS_ENERGY = 'energy'
|
||||
DEVICE_CLASS_HUMIDITY = 'humidity'
|
||||
DEVICE_CLASS_ILLUMINANCE = 'illuminance'
|
||||
DEVICE_CLASS_SIGNAL_STRENGTH = 'signal_strength'
|
||||
DEVICE_CLASS_TEMPERATURE = 'temperature'
|
||||
DEVICE_CLASS_POWER = 'power'
|
||||
DEVICE_CLASS_POWER_FACTOR = 'power_factor'
|
||||
DEVICE_CLASS_PRESSURE = 'pressure'
|
||||
DEVICE_CLASS_TIMESTAMP = 'timestamp'
|
||||
|
|
Loading…
Reference in a new issue