2020-09-28 00:02:20 +00:00
|
|
|
"""Constants for 1-Wire component."""
|
2021-05-11 15:28:17 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2020-11-08 02:42:20 +00:00
|
|
|
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
2020-10-09 15:31:05 +00:00
|
|
|
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
2020-11-08 18:06:41 +00:00
|
|
|
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
2020-10-27 13:34:25 +00:00
|
|
|
from homeassistant.const import (
|
|
|
|
DEVICE_CLASS_CURRENT,
|
|
|
|
DEVICE_CLASS_HUMIDITY,
|
|
|
|
DEVICE_CLASS_ILLUMINANCE,
|
|
|
|
DEVICE_CLASS_PRESSURE,
|
|
|
|
DEVICE_CLASS_TEMPERATURE,
|
|
|
|
DEVICE_CLASS_VOLTAGE,
|
|
|
|
ELECTRICAL_CURRENT_AMPERE,
|
|
|
|
LIGHT_LUX,
|
|
|
|
PERCENTAGE,
|
|
|
|
PRESSURE_MBAR,
|
|
|
|
TEMP_CELSIUS,
|
|
|
|
VOLT,
|
|
|
|
)
|
2020-10-09 15:31:05 +00:00
|
|
|
|
2020-09-28 00:02:20 +00:00
|
|
|
CONF_MOUNT_DIR = "mount_dir"
|
|
|
|
CONF_NAMES = "names"
|
|
|
|
|
2020-10-09 15:31:05 +00:00
|
|
|
CONF_TYPE_OWSERVER = "OWServer"
|
|
|
|
CONF_TYPE_SYSBUS = "SysBus"
|
|
|
|
|
2020-10-24 01:57:16 +00:00
|
|
|
DEFAULT_OWSERVER_HOST = "localhost"
|
2020-09-28 00:02:20 +00:00
|
|
|
DEFAULT_OWSERVER_PORT = 4304
|
|
|
|
DEFAULT_SYSBUS_MOUNT_DIR = "/sys/bus/w1/devices/"
|
|
|
|
|
|
|
|
DOMAIN = "onewire"
|
|
|
|
|
2020-10-15 17:57:15 +00:00
|
|
|
PRESSURE_CBAR = "cbar"
|
|
|
|
|
2020-11-03 17:12:01 +00:00
|
|
|
SENSOR_TYPE_COUNT = "count"
|
|
|
|
SENSOR_TYPE_CURRENT = "current"
|
|
|
|
SENSOR_TYPE_HUMIDITY = "humidity"
|
|
|
|
SENSOR_TYPE_ILLUMINANCE = "illuminance"
|
|
|
|
SENSOR_TYPE_MOISTURE = "moisture"
|
|
|
|
SENSOR_TYPE_PRESSURE = "pressure"
|
2020-11-08 02:42:20 +00:00
|
|
|
SENSOR_TYPE_SENSED = "sensed"
|
2020-11-03 17:12:01 +00:00
|
|
|
SENSOR_TYPE_TEMPERATURE = "temperature"
|
|
|
|
SENSOR_TYPE_VOLTAGE = "voltage"
|
|
|
|
SENSOR_TYPE_WETNESS = "wetness"
|
2020-11-08 18:06:41 +00:00
|
|
|
SWITCH_TYPE_LATCH = "latch"
|
|
|
|
SWITCH_TYPE_PIO = "pio"
|
2020-11-03 17:12:01 +00:00
|
|
|
|
2021-05-11 15:28:17 +00:00
|
|
|
SENSOR_TYPES: dict[str, list[str | None]] = {
|
2020-11-03 17:12:01 +00:00
|
|
|
# SensorType: [ Unit, DeviceClass ]
|
|
|
|
SENSOR_TYPE_TEMPERATURE: [TEMP_CELSIUS, DEVICE_CLASS_TEMPERATURE],
|
|
|
|
SENSOR_TYPE_HUMIDITY: [PERCENTAGE, DEVICE_CLASS_HUMIDITY],
|
|
|
|
SENSOR_TYPE_PRESSURE: [PRESSURE_MBAR, DEVICE_CLASS_PRESSURE],
|
|
|
|
SENSOR_TYPE_ILLUMINANCE: [LIGHT_LUX, DEVICE_CLASS_ILLUMINANCE],
|
|
|
|
SENSOR_TYPE_WETNESS: [PERCENTAGE, DEVICE_CLASS_HUMIDITY],
|
|
|
|
SENSOR_TYPE_MOISTURE: [PRESSURE_CBAR, DEVICE_CLASS_PRESSURE],
|
|
|
|
SENSOR_TYPE_COUNT: ["count", None],
|
|
|
|
SENSOR_TYPE_VOLTAGE: [VOLT, DEVICE_CLASS_VOLTAGE],
|
|
|
|
SENSOR_TYPE_CURRENT: [ELECTRICAL_CURRENT_AMPERE, DEVICE_CLASS_CURRENT],
|
2020-11-08 02:42:20 +00:00
|
|
|
SENSOR_TYPE_SENSED: [None, None],
|
2020-11-08 18:06:41 +00:00
|
|
|
SWITCH_TYPE_LATCH: [None, None],
|
|
|
|
SWITCH_TYPE_PIO: [None, None],
|
2020-10-27 13:34:25 +00:00
|
|
|
}
|
|
|
|
|
2021-03-02 20:43:59 +00:00
|
|
|
PLATFORMS = [
|
2020-11-08 02:42:20 +00:00
|
|
|
BINARY_SENSOR_DOMAIN,
|
2020-10-09 15:31:05 +00:00
|
|
|
SENSOR_DOMAIN,
|
2020-11-08 18:06:41 +00:00
|
|
|
SWITCH_DOMAIN,
|
2020-09-28 00:02:20 +00:00
|
|
|
]
|