コード例 #1
0
ファイル: wizard.py プロジェクト: liuse2ee/esphome-tools-dc1
def wizard_write(path, **kwargs):
    name = kwargs['name']
    board = kwargs['board']
    if 'platform' not in kwargs:
        kwargs[
            'platform'] = 'ESP8266' if board in ESP8266_BOARD_PINS else 'ESP32'
    platform = kwargs['platform']

    with codecs.open(path, 'w') as f_handle:
        f_handle.write(wizard_file(**kwargs))
    storage = StorageJSON.from_wizard(name, name + '.local', platform, board)
    storage_path = ext_storage_path(os.path.dirname(path),
                                    os.path.basename(path))
    storage.save(storage_path)
コード例 #2
0
ファイル: wizard.py プロジェクト: yuvalabou/esphome
def wizard_write(path, **kwargs):
    name = kwargs["name"]
    board = kwargs["board"]

    kwargs["ssid"] = sanitize_double_quotes(kwargs["ssid"])
    kwargs["psk"] = sanitize_double_quotes(kwargs["psk"])
    kwargs["password"] = sanitize_double_quotes(kwargs["password"])

    if "platform" not in kwargs:
        kwargs["platform"] = "ESP8266" if board in ESP8266_BOARD_PINS else "ESP32"
    platform = kwargs["platform"]

    write_file(path, wizard_file(**kwargs))
    storage = StorageJSON.from_wizard(name, name + ".local", platform, board)
    storage_path = ext_storage_path(os.path.dirname(path), os.path.basename(path))
    storage.save(storage_path)
コード例 #3
0
ファイル: wizard.py プロジェクト: yevgenb/esphome-1
def wizard_write(path, **kwargs):
    name = kwargs['name']
    board = kwargs['board']

    kwargs['ssid'] = sanitize_double_quotes(kwargs['ssid'])
    kwargs['psk'] = sanitize_double_quotes(kwargs['psk'])
    kwargs['password'] = sanitize_double_quotes(kwargs['password'])

    if 'platform' not in kwargs:
        kwargs['platform'] = 'ESP8266' if board in ESP8266_BOARD_PINS else 'ESP32'
    platform = kwargs['platform']

    write_file(path, wizard_file(**kwargs))
    storage = StorageJSON.from_wizard(name, name + '.local', platform, board)
    storage_path = ext_storage_path(os.path.dirname(path), os.path.basename(path))
    storage.save(storage_path)
コード例 #4
0
ファイル: wizard.py プロジェクト: krahabb/esphome
def wizard_write(path, **kwargs):
    from esphome.components.esp8266 import boards as esp8266_boards

    name = kwargs["name"]
    board = kwargs["board"]

    for key in ("ssid", "psk", "password", "ota_password"):
        if key in kwargs:
            kwargs[key] = sanitize_double_quotes(kwargs[key])

    if "platform" not in kwargs:
        kwargs["platform"] = (
            "ESP8266" if board in esp8266_boards.ESP8266_BOARD_PINS else "ESP32"
        )
    hardware = kwargs["platform"]

    write_file(path, wizard_file(**kwargs))
    storage = StorageJSON.from_wizard(name, f"{name}.local", hardware)
    storage_path = ext_storage_path(os.path.dirname(path), os.path.basename(path))
    storage.save(storage_path)