当前位置: 首页>>代码示例>>Python>>正文


Python const.CONF_NAME属性代码示例

本文整理汇总了Python中homeassistant.const.CONF_NAME属性的典型用法代码示例。如果您正苦于以下问题:Python const.CONF_NAME属性的具体用法?Python const.CONF_NAME怎么用?Python const.CONF_NAME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在homeassistant.const的用法示例。


在下文中一共展示了const.CONF_NAME属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: async_setup_platform

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
    """Set up a binary sensor for an Amcrest IP Camera."""
    if discovery_info is None:
        return

    device_name = discovery_info[CONF_NAME]
    binary_sensors = discovery_info[CONF_BINARY_SENSORS]
    amcrest = hass.data[DATA_AMCREST][device_name]

    amcrest_binary_sensors = []
    for sensor_type in binary_sensors:
        amcrest_binary_sensors.append(
            AmcrestBinarySensor(amcrest.name, amcrest.device, sensor_type))

    async_add_devices(amcrest_binary_sensors, True)
    return True 
开发者ID:pnbruckner,项目名称:homeassistant-config,代码行数:18,代码来源:binary_sensor.py

示例2: async_add_entities_config

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def async_add_entities_config(hass, config, async_add_entities):
    """Set up cover for KNX platform configured within platform."""
    cover = XknxCover(
        hass.data[DATA_XKNX].xknx,
        name=config[CONF_NAME],
        group_address_long=config.get(CONF_MOVE_LONG_ADDRESS),
        group_address_short=config.get(CONF_MOVE_SHORT_ADDRESS),
        group_address_position_state=config.get(CONF_POSITION_STATE_ADDRESS),
        group_address_angle=config.get(CONF_ANGLE_ADDRESS),
        group_address_angle_state=config.get(CONF_ANGLE_STATE_ADDRESS),
        group_address_position=config.get(CONF_POSITION_ADDRESS),
        travel_time_down=config[CONF_TRAVELLING_TIME_DOWN],
        travel_time_up=config[CONF_TRAVELLING_TIME_UP],
        invert_position=config[CONF_INVERT_POSITION],
        invert_angle=config[CONF_INVERT_ANGLE],
    )

    hass.data[DATA_XKNX].xknx.devices.add(cover)
    async_add_entities([KNXCover(cover)]) 
开发者ID:XKNX,项目名称:xknx,代码行数:21,代码来源:cover.py

示例3: _create_entities

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def _create_entities(hass: HomeAssistant, entry: dict):
    entities = []

    controller = hass.data[DOMAIN][entry.entry_id]["controller"]
    coordinator = hass.data[DOMAIN][entry.entry_id]["coordinator"]
    name = entry.data[CONF_NAME]

    entities.append(ControllerOperationSwitch(entry, name, controller, coordinator))

    for _, program in controller.programs.items():
        entities.append(ProgramEnabledSwitch(entry, name, program, coordinator))

    for _, station in controller.stations.items():
        entities.append(StationEnabledSwitch(entry, name, station, coordinator))

    return entities 
开发者ID:vinteo,项目名称:hass-opensprinkler,代码行数:18,代码来源:switch.py

示例4: _create_entities

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def _create_entities(hass: HomeAssistant, entry: dict):
    entities = []

    controller = hass.data[DOMAIN][entry.entry_id]["controller"]
    coordinator = hass.data[DOMAIN][entry.entry_id]["coordinator"]
    name = entry.data[CONF_NAME]

    entities.append(
        ControllerSensorActive(entry, name, "sensor_1", controller, coordinator)
    )
    entities.append(
        ControllerSensorActive(entry, name, "sensor_2", controller, coordinator)
    )
    entities.append(
        ControllerSensorActive(entry, name, "rain_delay", controller, coordinator)
    )

    for _, program in controller.programs.items():
        entities.append(ProgramIsRunningBinarySensor(entry, name, program, coordinator))

    for _, station in controller.stations.items():
        entities.append(StationIsRunningBinarySensor(entry, name, station, coordinator))

    return entities 
开发者ID:vinteo,项目名称:hass-opensprinkler,代码行数:26,代码来源:binary_sensor.py

示例5: _create_entities

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def _create_entities(hass: HomeAssistant, entry: dict):
    entities = []

    controller = hass.data[DOMAIN][entry.entry_id]["controller"]
    coordinator = hass.data[DOMAIN][entry.entry_id]["coordinator"]
    name = entry.data[CONF_NAME]

    entities.append(LastRunSensor(entry, name, controller, coordinator))
    entities.append(RainDelayStopTimeSensor(entry, name, controller, coordinator))
    entities.append(WaterLevelSensor(entry, name, controller, coordinator))
    entities.append(FlowRateSensor(entry, name, controller, coordinator))

    for _, station in controller.stations.items():
        entities.append(StationStatusSensor(entry, name, station, coordinator))

    return entities 
开发者ID:vinteo,项目名称:hass-opensprinkler,代码行数:18,代码来源:sensor.py

示例6: __init__

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def __init__(self, block, instance, prefix=""):
        conf = instance.conf
        id_prefix = conf.get(CONF_OBJECT_ID_PREFIX)
        self._unique_id = slugify(id_prefix + "_" + block.type + "_" +
                                  block.id + prefix)
        self.entity_id = "." + self._unique_id
        entity_id = \
            instance._get_specific_config(CONF_ENTITY_ID, None, block.id)
        if entity_id is not None:
            self.entity_id = "." + slugify(id_prefix + "_" + entity_id + prefix)
            self._unique_id += "_" + slugify(entity_id)
        self._show_id_in_name = conf.get(CONF_SHOW_ID_IN_NAME)
        self._block = block
        self.hass = instance.hass
        self.instance = instance
        self._block.cb_updated.append(self._updated)
        block.shelly_device = self  #todo, should be array??
        self._name = instance._get_specific_config(CONF_NAME, None, block.id)
        self._name_ext = None
        self._is_removed = False
        self.async_on_remove(self._remove_handler)
        self._master_unit = False
        self._settings = instance.get_settings(block.id) 
开发者ID:StyraHem,项目名称:ShellyForHASS,代码行数:25,代码来源:block.py

示例7: _show_init_form

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def _show_init_form(self, user_input):
        data_schema = OrderedDict()
        one_time = self.config_entry.options.get(CONF_ONE_TIME)
        unit_of_measurement = self.config_entry.options.get(CONF_UNIT_OF_MEASUREMENT)
        half_anniversary = self.config_entry.options.get(CONF_HALF_ANNIVERSARY)
        if one_time is None:
            one_time = DEFAULT_ONE_TIME
        if half_anniversary is None:
            half_anniversary = DEFAULT_HALF_ANNIVERSARY
        if unit_of_measurement is None:
            unit_of_measurement = DEFAULT_UNIT_OF_MEASUREMENT
        data_schema[vol.Required(CONF_NAME,default=self.config_entry.options.get(CONF_NAME),)] = str
        data_schema[vol.Required(CONF_DATE, default=self.config_entry.options.get(CONF_DATE),)] = str
        data_schema[vol.Required(CONF_ONE_TIME, default=one_time,)] = bool
        data_schema[vol.Required(CONF_HALF_ANNIVERSARY,default=half_anniversary,)] = bool
        data_schema[vol.Required(CONF_DATE_FORMAT,default=self.config_entry.options.get(CONF_DATE_FORMAT),)] = str
        data_schema[vol.Required(CONF_UNIT_OF_MEASUREMENT,default=unit_of_measurement,)] = str
        return self.async_show_form(
            step_id="init", data_schema=vol.Schema(data_schema), errors=self._errors
        ) 
开发者ID:pinkywafer,项目名称:Anniversaries,代码行数:22,代码来源:config_flow.py

示例8: __init__

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def __init__(self, pico, data, mac):
        """Initialize a Lutron Pico."""
        self._data = data
        self._name = pico[CONF_NAME]
        self._area_name = None
        if CONF_AREA_NAME in pico:
            self._area_name = pico[CONF_AREA_NAME]
            # if available, prepend area name to sensor
            self._name = pico[CONF_AREA_NAME] + " " + pico[CONF_NAME]
        self._integration = int(pico[CONF_ID])
        self._buttons = pico[CONF_BUTTONS]
        self._minbutton = 100
        for button_num in self._buttons:
            if button_num < self._minbutton:
                self._minbutton = button_num
        self._state = 0
        self._mac = mac 
开发者ID:upsert,项目名称:lutron-caseta-pro,代码行数:19,代码来源:sensor.py

示例9: async_add_entities_config

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def async_add_entities_config(hass, config, async_add_entities):
    """Set up switch for KNX platform configured within platform."""
    switch = XknxSwitch(
        hass.data[DATA_XKNX].xknx,
        name=config[CONF_NAME],
        group_address=config[CONF_ADDRESS],
        group_address_state=config.get(CONF_STATE_ADDRESS),
    )
    hass.data[DATA_XKNX].xknx.devices.add(switch)
    async_add_entities([KNXSwitch(switch)]) 
开发者ID:XKNX,项目名称:xknx,代码行数:12,代码来源:switch.py

示例10: async_get_service_config

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def async_get_service_config(hass, config):
    """Set up notification for KNX platform configured within platform."""
    notification = XknxNotification(
        hass.data[DATA_XKNX].xknx,
        name=config[CONF_NAME],
        group_address=config[CONF_ADDRESS],
    )
    hass.data[DATA_XKNX].xknx.devices.add(notification)
    return KNXNotificationService([notification]) 
开发者ID:XKNX,项目名称:xknx,代码行数:11,代码来源:notify.py

示例11: async_add_entities_config

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def async_add_entities_config(hass, config, async_add_entities):
    """Set up binary senor for KNX platform configured within platform."""
    name = config[CONF_NAME]

    binary_sensor = BinarySensor(
        hass.data[DATA_XKNX].xknx,
        name=name,
        group_address_state=config[CONF_STATE_ADDRESS],
        sync_state=config[CONF_SYNC_STATE],
        ignore_internal_state=config[CONF_IGNORE_INTERNAL_STATE],
        device_class=config.get(CONF_DEVICE_CLASS),
        significant_bit=config[CONF_SIGNIFICANT_BIT],
        reset_after=config.get(CONF_RESET_AFTER),
    )
    hass.data[DATA_XKNX].xknx.devices.add(binary_sensor)

    entity = KNXBinarySensor(binary_sensor)
    automations = config.get(CONF_AUTOMATION)
    if automations is not None:
        for automation in automations:
            counter = automation[CONF_COUNTER]
            hook = automation[CONF_HOOK]
            action = automation[CONF_ACTION]
            entity.automations.append(
                KNXAutomation(
                    hass=hass,
                    device=binary_sensor,
                    hook=hook,
                    action=action,
                    counter=counter,
                )
            )
    async_add_entities([entity]) 
开发者ID:XKNX,项目名称:xknx,代码行数:35,代码来源:binary_sensor.py

示例12: async_add_entities_config

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def async_add_entities_config(hass, config, async_add_entities):
    """Set up scene for KNX platform configured within platform."""
    scene = XknxScene(
        hass.data[DATA_XKNX].xknx,
        name=config[CONF_NAME],
        group_address=config[CONF_ADDRESS],
        scene_number=config[CONF_SCENE_NUMBER],
    )
    hass.data[DATA_XKNX].xknx.devices.add(scene)
    async_add_entities([KNXScene(scene)]) 
开发者ID:XKNX,项目名称:xknx,代码行数:12,代码来源:scene.py

示例13: async_add_entities_config

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def async_add_entities_config(hass, config, async_add_entities):
    """Set up light for KNX platform configured within platform."""
    group_address_tunable_white = None
    group_address_tunable_white_state = None
    group_address_color_temp = None
    group_address_color_temp_state = None
    if config[CONF_COLOR_TEMP_MODE] == ColorTempModes.absolute:
        group_address_color_temp = config.get(CONF_COLOR_TEMP_ADDRESS)
        group_address_color_temp_state = config.get(CONF_COLOR_TEMP_STATE_ADDRESS)
    elif config[CONF_COLOR_TEMP_MODE] == ColorTempModes.relative:
        group_address_tunable_white = config.get(CONF_COLOR_TEMP_ADDRESS)
        group_address_tunable_white_state = config.get(CONF_COLOR_TEMP_STATE_ADDRESS)

    light = XknxLight(
        hass.data[DATA_XKNX].xknx,
        name=config[CONF_NAME],
        group_address_switch=config[CONF_ADDRESS],
        group_address_switch_state=config.get(CONF_STATE_ADDRESS),
        group_address_brightness=config.get(CONF_BRIGHTNESS_ADDRESS),
        group_address_brightness_state=config.get(CONF_BRIGHTNESS_STATE_ADDRESS),
        group_address_color=config.get(CONF_COLOR_ADDRESS),
        group_address_color_state=config.get(CONF_COLOR_STATE_ADDRESS),
        group_address_rgbw=config.get(CONF_RGBW_ADDRESS),
        group_address_rgbw_state=config.get(CONF_RGBW_STATE_ADDRESS),
        group_address_tunable_white=group_address_tunable_white,
        group_address_tunable_white_state=group_address_tunable_white_state,
        group_address_color_temperature=group_address_color_temp,
        group_address_color_temperature_state=group_address_color_temp_state,
        min_kelvin=config[CONF_MIN_KELVIN],
        max_kelvin=config[CONF_MAX_KELVIN],
    )
    hass.data[DATA_XKNX].xknx.devices.add(light)
    async_add_entities([KNXLight(light)]) 
开发者ID:XKNX,项目名称:xknx,代码行数:35,代码来源:light.py

示例14: async_add_entities_config

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def async_add_entities_config(hass, config, async_add_entities):
    """Set up sensor for KNX platform configured within platform."""
    sensor = XknxSensor(
        hass.data[DATA_XKNX].xknx,
        name=config[CONF_NAME],
        group_address_state=config[CONF_STATE_ADDRESS],
        sync_state=config[CONF_SYNC_STATE],
        value_type=config[CONF_TYPE],
    )
    hass.data[DATA_XKNX].xknx.devices.add(sensor)
    async_add_entities([KNXSensor(sensor)]) 
开发者ID:XKNX,项目名称:xknx,代码行数:13,代码来源:sensor.py

示例15: setup_platform

# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import CONF_NAME [as 别名]
def setup_platform(hass, config, add_devices, discovery_info=None):
    name = config.get(CONF_NAME)
    add_devices([PlexRecentlyAddedSensor(hass, config, name)], True) 
开发者ID:custom-components,项目名称:sensor.plex_recently_added,代码行数:5,代码来源:sensor.py


注:本文中的homeassistant.const.CONF_NAME属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。