Ejemplo n.º 1
0
def core_to_hass_config(data, config):
    ret = mqtt.build_hass_config(data,
                                 'cover',
                                 config,
                                 include_state=True,
                                 include_command=True)
    if ret is None:
        return None
    return ret
Ejemplo n.º 2
0
def core_to_hass_config(data, config):
    ret = mqtt.build_hass_config(data,
                                 'sensor',
                                 config,
                                 include_state=True,
                                 include_command=False)
    if ret is None:
        return None
    if CONF_ICON in config:
        ret['icon'] = config[CONF_ICON]
    return ret
Ejemplo n.º 3
0
def core_to_hass_config(data, config):
    ret = mqtt.build_hass_config(data,
                                 'binary_sensor',
                                 config,
                                 include_state=True,
                                 include_command=False)
    if ret is None:
        return None
    if CONF_DEVICE_CLASS in config:
        ret['device_class'] = config[CONF_DEVICE_CLASS]
    return ret
Ejemplo n.º 4
0
def core_to_hass_config(data, config):
    ret = mqtt.build_hass_config(data, 'sensor', config, include_state=True, include_command=False)
    if ret is None:
        return None
    if CONF_UNIT_OF_MEASUREMENT in config:
        ret['unit_of_measurement'] = config[CONF_UNIT_OF_MEASUREMENT]
    if CONF_EXPIRE_AFTER in config:
        expire = config[CONF_EXPIRE_AFTER]
        if expire is not None:
            ret['expire_after'] = expire.total_seconds
    if CONF_ICON in config:
        ret['icon'] = config[CONF_ICON]
    return ret
Ejemplo n.º 5
0
def core_to_hass_config(data, config):
    ret = mqtt.build_hass_config(data,
                                 'switch',
                                 config,
                                 include_state=True,
                                 include_command=True)
    if ret is None:
        return None
    if CONF_ICON in config:
        ret['icon'] = config[CONF_ICON]
    if CONF_OPTIMISTIC in config:
        ret['optimistic'] = config[CONF_OPTIMISTIC]
    return ret
Ejemplo n.º 6
0
def core_to_hass_config(data, config):
    ret = mqtt.build_hass_config(data,
                                 'fan',
                                 config,
                                 include_state=True,
                                 include_command=True)
    if ret is None:
        return None
    if CONF_OSCILLATION_OUTPUT in config:
        default = mqtt.get_default_topic_for(data, 'fan', config[CONF_NAME],
                                             'oscillation/state')
        ret['oscillation_state_topic'] = config.get(
            CONF_OSCILLATION_STATE_TOPIC, default)
        default = mqtt.get_default_topic_for(data, 'fan', config[CONF_NAME],
                                             'oscillation/command')
        ret['oscillation_command__topic'] = config.get(
            CONF_OSCILLATION_COMMAND_TOPIC, default)
    return ret