Python homeassistant.helpers.config_validation.icon() Examples

The following are 17 code examples of homeassistant.helpers.config_validation.icon(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module homeassistant.helpers.config_validation , or try the search function .
Example #1
Source File: switch.py    From home-assistant-custom-components with MIT License 6 votes vote down vote up
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) 
Example #2
Source File: __init__.py    From common_timer with Apache License 2.0 5 votes vote down vote up
def icon(self):
        """Return the icon to be used for this entity."""
        return self._icon 
Example #3
Source File: input_label.py    From mysmarthome with MIT License 5 votes vote down vote up
def icon(self):
        """Return the icon to be used for this entity."""
        return self._icon 
Example #4
Source File: input_label.py    From mysmarthome with MIT License 5 votes vote down vote up
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 
Example #5
Source File: input_label.py    From mysmarthome with MIT License 5 votes vote down vote up
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 
Example #6
Source File: __init__.py    From common_timer with Apache License 2.0 5 votes vote down vote up
def icon(self):
        """Return the icon to be used for this entity."""
        return self._icon 
Example #7
Source File: __init__.py    From common_timer with Apache License 2.0 5 votes vote down vote up
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 
Example #8
Source File: __init__.py    From common_timer with Apache License 2.0 5 votes vote down vote up
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 
Example #9
Source File: __init__.py    From common_timer with Apache License 2.0 5 votes vote down vote up
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 
Example #10
Source File: __init__.py    From common_timer with Apache License 2.0 5 votes vote down vote up
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 
Example #11
Source File: switch.py    From localtuya-homeassistant with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #12
Source File: __init__.py    From common_timer with Apache License 2.0 5 votes vote down vote up
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 
Example #13
Source File: __init__.py    From common_timer with Apache License 2.0 5 votes vote down vote up
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 
Example #14
Source File: switch.py    From HomeAssistant-CustomComponents with Apache License 2.0 5 votes vote down vote up
def icon(self):
        """Return the icon to use for device if any."""
        return self._icon 
Example #15
Source File: switch.py    From HomeAssistant-CustomComponents with Apache License 2.0 5 votes vote down vote up
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") 
Example #16
Source File: switch.py    From home-assistant-custom-components with MIT License 5 votes vote down vote up
def icon(self):
        """Return the icon to display."""
        return self._icon 
Example #17
Source File: switch.py    From localtuya-homeassistant with GNU General Public License v3.0 5 votes vote down vote up
def icon(self):
        """Return the icon."""
        return self._icon