From 5a76e61b1e65b3aec3c27f81c985369811059a74 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sun, 30 Jun 2019 09:14:04 +0200 Subject: [PATCH] Prevent too long fallback AP SSID --- esphome/wizard.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/esphome/wizard.py b/esphome/wizard.py index 5d290a3592..34ff0ec6c7 100644 --- a/esphome/wizard.py +++ b/esphome/wizard.py @@ -75,7 +75,11 @@ def sanitize_double_quotes(value): def wizard_file(**kwargs): letters = string.ascii_letters + string.digits - kwargs['fallback_name'] = "{} Fallback Hotspot".format(kwargs['name'].replace('_', ' ').title()) + ap_name_base = kwargs['name'].replace('_', ' ').title() + ap_name = "{} Fallback Hotspot".format(ap_name_base) + if len(ap_name) > 32: + ap_name = ap_name_base + kwargs['fallback_name'] = ap_name kwargs['fallback_psk'] = ''.join(random.choice(letters) for _ in range(12)) config = BASE_CONFIG.format(**kwargs)