コード例 #1
0
ファイル: __init__.py プロジェクト: TheZoker/home-assistant
    STATE_ON)
from homeassistant.exceptions import UnknownUser, Unauthorized
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.config_validation import (  # noqa
    PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, ENTITY_SERVICE_SCHEMA)
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers import intent
from homeassistant.loader import bind_hass
import homeassistant.util.color as color_util

DOMAIN = 'light'
SCAN_INTERVAL = timedelta(seconds=30)

GROUP_NAME_ALL_LIGHTS = 'all lights'
ENTITY_ID_ALL_LIGHTS = GROUP_ENTITY_ID_FORMAT.format('all_lights')

ENTITY_ID_FORMAT = DOMAIN + '.{}'

# Bitfield of features supported by the light entity
SUPPORT_BRIGHTNESS = 1
SUPPORT_COLOR_TEMP = 2
SUPPORT_EFFECT = 4
SUPPORT_FLASH = 8
SUPPORT_COLOR = 16
SUPPORT_TRANSITION = 32
SUPPORT_WHITE_VALUE = 128

# Integer that represents transition time in seconds to make change.
ATTR_TRANSITION = "transition"
コード例 #2
0
from homeassistant.helpers.event import track_time_change
from homeassistant.const import (ATTR_BATTERY_LEVEL, CONF_PORT, CONF_HOST,
                                 CONF_SCAN_INTERVAL, ATTR_ENTITY_ID,
                                 EVENT_HOMEASSISTANT_START,
                                 EVENT_HOMEASSISTANT_STOP)
import homeassistant.helpers.config_validation as cv
from .const import DOMAIN, SCAN_INTERVAL

_LOGGER = logging.getLogger(__name__)

DATA_ZIGATE_DEVICES = 'zigate_devices'
DATA_ZIGATE_ATTRS = 'zigate_attributes'
ADDR = 'addr'
IEEE = 'ieee'

ENTITY_ID_ALL_ZIGATE = GROUP_ENTITY_ID_FORMAT.format('all_zigate')

SUPPORTED_PLATFORMS = ('sensor', 'binary_sensor', 'switch', 'light', 'cover',
                       'climate')

CONFIG_SCHEMA = vol.Schema(
    {
        DOMAIN:
        vol.Schema({
            vol.Optional(CONF_PORT): cv.string,
            vol.Optional(CONF_HOST): cv.string,
            vol.Optional('channel'): cv.positive_int,
            vol.Optional('gpio'): cv.boolean,
            vol.Optional('enable_led'): cv.boolean,
            vol.Optional('polling'): cv.boolean,
            vol.Optional(CONF_SCAN_INTERVAL): cv.positive_int,
コード例 #3
0
from homeassistant.components.group import (ENTITY_ID_FORMAT as
                                            GROUP_ENTITY_ID_FORMAT)
from homeassistant.const import (MAJOR_VERSION, MINOR_VERSION, ATTR_ENTITY_ID,
                                 SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_ON)
from homeassistant.helpers.config_validation import PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.loader import bind_hass

_LOGGER = logging.getLogger(__name__)

DOMAIN = 'display'
ENTITY_ID_FORMAT = DOMAIN + '.{}'

GROUP_NAME_ALL_DISPLAYS = 'all displays'
ENTITY_ID_ALL_DISPLAYS = GROUP_ENTITY_ID_FORMAT.format('all_displays')

SCAN_INTERVAL = timedelta(seconds=30)

ATTR_BRIGHTNESS = 'brightness'
ATTR_URL = 'url'

SERVICE_LOAD_URL = 'load_url'
SERVICE_SET_BRIGHTNESS = 'set_brightness'

SUPPORT_TURN_ON = 1
SUPPORT_TURN_OFF = 2
SUPPORT_LOAD_URL = 4
SUPPORT_SET_BRIGHTNESS = 8

DISPLAY_DEVICE_SCHEMA = vol.Schema({
コード例 #4
0
    STATE_ON)
from homeassistant.exceptions import UnknownUser, Unauthorized
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.config_validation import (  # noqa
    PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE)
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers import intent
from homeassistant.loader import bind_hass
import homeassistant.util.color as color_util

DOMAIN = 'light'
SCAN_INTERVAL = timedelta(seconds=30)

GROUP_NAME_ALL_LIGHTS = 'all lights'
ENTITY_ID_ALL_LIGHTS = GROUP_ENTITY_ID_FORMAT.format('all_lights')

ENTITY_ID_FORMAT = DOMAIN + '.{}'

# Bitfield of features supported by the light entity
SUPPORT_BRIGHTNESS = 1
SUPPORT_COLOR_TEMP = 2
SUPPORT_EFFECT = 4
SUPPORT_FLASH = 8
SUPPORT_COLOR = 16
SUPPORT_TRANSITION = 32
SUPPORT_WHITE_VALUE = 128

# Integer that represents transition time in seconds to make change.
ATTR_TRANSITION = "transition"