mirror of
https://github.com/esphome/esphome.git
synced 2024-11-02 08:40:55 +01:00
Prevent too long fallback AP SSID
This commit is contained in:
parent
7b4366bfef
commit
5a76e61b1e
@ -75,7 +75,11 @@ def sanitize_double_quotes(value):
|
|||||||
|
|
||||||
def wizard_file(**kwargs):
|
def wizard_file(**kwargs):
|
||||||
letters = string.ascii_letters + string.digits
|
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))
|
kwargs['fallback_psk'] = ''.join(random.choice(letters) for _ in range(12))
|
||||||
|
|
||||||
config = BASE_CONFIG.format(**kwargs)
|
config = BASE_CONFIG.format(**kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user