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


Python config_validation.icon方法代码示例

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


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

示例1: __init__

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def __init__(self, generated_entity_id, name, ip_address, phone_id, device_id, device_password, scan_interval, icon):
        """Initialize the device"""
        self.entity_id = generated_entity_id
        self._name = name
        self._ip_address = ip_address
        self._phone_id = phone_id
        self._device_id = device_id
        self._device_password = device_password
        self._scan_interval = scan_interval
        self._icon = icon

        self._state = None
        self._skip_update = False
        self._current_power_w = None
        self._current_power_a = None
        self._listenr_remove_func = None
        self._auto_off_time_left = None
        self._auto_off_config = None

        _LOGGER.debug('new entity established: ' + self.entity_id) 
开发者ID:TomerFi,项目名称:home-assistant-custom-components,代码行数:22,代码来源:switch.py

示例2: __init__

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def __init__(self, device, name, icon, switchid):
        """Initialize the Tuya switch."""
        self._device = device
        self._name = name
        self._state = False
        self._icon = icon
        self._switchid = switchid
        self._status = self._device.status() 
开发者ID:mileperhour,项目名称:localtuya-homeassistant,代码行数:10,代码来源:switch.py

示例3: icon

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def icon(self):
        """Return the icon."""
        return self._icon 
开发者ID:mileperhour,项目名称:localtuya-homeassistant,代码行数:5,代码来源:switch.py

示例4: icon

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def icon(self):
        """Return the icon to display."""
        return self._icon 
开发者ID:TomerFi,项目名称:home-assistant-custom-components,代码行数:5,代码来源:switch.py

示例5: __init__

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def __init__(self, instance, object_id, friendly_name, address,
                 address_type, icon):
        """Initialize the switch."""
        self._name = friendly_name
        self._address = address
        self._address_type = address_type
        self._state = False
        self._icon = icon
        self.entity_id = ENTITY_ID_FORMAT.format(object_id)
        self._instance = instance

        # _LOGGER.debug("Switch INIT") 
开发者ID:pilotak,项目名称:HomeAssistant-CustomComponents,代码行数:14,代码来源:switch.py

示例6: icon

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def icon(self):
        """Return the icon to use for device if any."""
        return self._icon 
开发者ID:pilotak,项目名称:HomeAssistant-CustomComponents,代码行数:5,代码来源:switch.py

示例7: async_setup

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def async_setup(hass, config):
    """Set up an input select."""
    component = hass.data[DOMAIN] = EntityComponent(_LOGGER, DOMAIN, hass)

    entities = []

    for object_id, cfg in config[DOMAIN].items():
        name = cfg.get(CONF_NAME)
        options = cfg.get(CONF_OPTIONS)
        initial = cfg.get(CONF_INITIAL)
        icon = cfg.get(CONF_ICON)
        entities.append(InputSelect(object_id, name, initial, options, icon))

    if not entities:
        return False

    component.async_register_entity_service(
        SERVICE_SELECT_OPTION, SERVICE_SELECT_OPTION_SCHEMA,
        'async_select_option'
    )

    component.async_register_entity_service(
        SERVICE_SELECT_NEXT, SERVICE_SELECT_NEXT_SCHEMA,
        lambda entity, call: entity.async_offset_index(1)
    )

    component.async_register_entity_service(
        SERVICE_SELECT_PREVIOUS, SERVICE_SELECT_PREVIOUS_SCHEMA,
        lambda entity, call: entity.async_offset_index(-1)
    )

    component.async_register_entity_service(
        SERVICE_SET_OPTIONS, SERVICE_SET_OPTIONS_SCHEMA,
        'async_set_options'
    )

    await component.async_add_entities(entities)
    return True 
开发者ID:cnk700i,项目名称:common_timer,代码行数:40,代码来源:__init__.py

示例8: __init__

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def __init__(self, object_id, name, initial, options, icon):
        """Initialize a select input."""
        self.entity_id = ENTITY_ID_FORMAT.format(object_id)
        self._name = name
        self._current_option = initial
        self._options = options
        self._icon = icon 
开发者ID:cnk700i,项目名称:common_timer,代码行数:9,代码来源:__init__.py

示例9: icon

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def icon(self):
        """Return the icon to be used for this entity."""
        return self._icon 
开发者ID:cnk700i,项目名称:common_timer,代码行数:5,代码来源:__init__.py

示例10: async_setup

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def async_setup(hass, config):
    """Set up an input text box."""
    component = hass.data[DOMAIN] = EntityComponent(_LOGGER, DOMAIN, hass)

    entities = []

    for object_id, cfg in config[DOMAIN].items():
        name = cfg.get(CONF_NAME)
        minimum = cfg.get(CONF_MIN)
        maximum = cfg.get(CONF_MAX)
        initial = cfg.get(CONF_INITIAL)
        icon = cfg.get(CONF_ICON)
        unit = cfg.get(ATTR_UNIT_OF_MEASUREMENT)
        pattern = cfg.get(ATTR_PATTERN)
        mode = cfg.get(CONF_MODE)

        entities.append(InputText(
            object_id, name, initial, minimum, maximum, icon, unit,
            pattern, mode))

    if not entities:
        return False

    component.async_register_entity_service(
        SERVICE_SET_VALUE, SERVICE_SET_VALUE_SCHEMA,
        'async_set_value'
    )

    await component.async_add_entities(entities)
    return True 
开发者ID:cnk700i,项目名称:common_timer,代码行数:32,代码来源:__init__.py

示例11: __init__

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def __init__(self, object_id, name, initial, minimum, maximum, icon,
                 unit, pattern, mode):
        """Initialize a text input."""
        self.entity_id = ENTITY_ID_FORMAT.format(object_id)
        self._name = name
        self._current_value = initial
        self._minimum = minimum
        self._maximum = maximum
        self._icon = icon
        self._unit = unit
        self._pattern = pattern
        self._mode = mode 
开发者ID:cnk700i,项目名称:common_timer,代码行数:14,代码来源:__init__.py

示例12: async_setup

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def async_setup(hass, config):
    """Set up an input boolean."""
    component = hass.data[DOMAIN] = EntityComponent(_LOGGER, DOMAIN, hass)

    entities = []

    for object_id, cfg in config[DOMAIN].items():
        if not cfg:
            cfg = {}

        name = cfg.get(CONF_NAME)
        initial = cfg.get(CONF_INITIAL)
        icon = cfg.get(CONF_ICON)

        entities.append(InputBoolean(object_id, name, initial, icon))

    if not entities:
        return False

    component.async_register_entity_service(
        SERVICE_TURN_ON, SERVICE_SCHEMA,
        'async_turn_on'
    )

    component.async_register_entity_service(
        SERVICE_TURN_OFF, SERVICE_SCHEMA,
        'async_turn_off'
    )

    component.async_register_entity_service(
        SERVICE_TOGGLE, SERVICE_SCHEMA,
        'async_toggle'
    )

    await component.async_add_entities(entities)
    return True 
开发者ID:cnk700i,项目名称:common_timer,代码行数:38,代码来源:__init__.py

示例13: __init__

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def __init__(self, object_id, name, initial, icon):
        """Initialize a boolean input."""
        self.entity_id = ENTITY_ID_FORMAT.format(object_id)
        self._name = name
        self._state = initial
        self._icon = icon 
开发者ID:cnk700i,项目名称:common_timer,代码行数:8,代码来源:__init__.py

示例14: async_setup

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def async_setup(hass, config):
    """Set up a input_label."""
    component = EntityComponent(_LOGGER, DOMAIN, hass)

    entities = []

    for object_id, cfg in config[DOMAIN].items():
        if not cfg:
            cfg = {}
        name = cfg.get(CONF_NAME)
        initial = cfg.get(ATTR_VALUE)
        icon = cfg.get(CONF_ICON)

        entities.append(InputLabel(object_id, name, initial, icon))

    if not entities:
        return False

    component.async_register_entity_service(
        SERVICE_SETNAME, SERVICE_SCHEMA,
        'async_set_name'
    )

    component.async_register_entity_service(
        SERVICE_SETVALUE, SERVICE_SCHEMA,
        'async_set_value'
    )

    component.async_register_entity_service(
        SERVICE_SETICON, SERVICE_SCHEMA,
        'async_set_icon'
    )

    await component.async_add_entities(entities)
    return True 
开发者ID:skalavala,项目名称:mysmarthome,代码行数:37,代码来源:input_label.py

示例15: __init__

# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import icon [as 别名]
def __init__(self, object_id, name, initial, icon):
        """Initialize a input_label."""
        self.entity_id = ENTITY_ID_FORMAT.format(object_id)
        self._name = name
        self._current_value = initial
        self._icon = icon 
开发者ID:skalavala,项目名称:mysmarthome,代码行数:8,代码来源:input_label.py


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