-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
82 lines (68 loc) · 2.38 KB
/
setup.py
File metadata and controls
82 lines (68 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env python3
"""
microclawup setup script
Run this on your PC to configure your ESP32
"""
import os
import shutil
BANNER = """
╔══════════════════════════════════════╗
║ microclawup setup ║
║ AI-powered ESP32 GPIO controller ║
╚══════════════════════════════════════╝
"""
CONFIG_TEMPLATE = '''# microclawup/config.py
# Auto-generated by setup.py — do not share this file!
# WiFi
WIFI_SSID = "{wifi_ssid}"
WIFI_PASS = "{wifi_pass}"
# Groq API Key (free at console.groq.com)
GROQ_API_KEY = "{groq_key}"
# Telegram Bot Token (from @BotFather)
BOT_TOKEN = "{bot_token}"
# Your Telegram Chat ID (from @userinfobot)
CHAT_ID = "{chat_id}"
'''
def ask(prompt, secret=False):
import getpass
if secret:
return getpass.getpass(prompt + ": ").strip()
return input(prompt + ": ").strip()
def main():
print(BANNER)
print("This script will generate your config.py file.")
print("Make sure you have the following ready:")
print(" 1. WiFi SSID and Password")
print(" 2. Groq API Key -> https://console.groq.com")
print(" 3. Telegram Bot Token -> @BotFather on Telegram")
print(" 4. Telegram Chat ID -> @userinfobot on Telegram")
print()
wifi_ssid = ask("WiFi SSID")
wifi_pass = ask("WiFi Password", secret=True)
groq_key = ask("Groq API Key", secret=True)
bot_token = ask("Telegram Bot Token", secret=True)
chat_id = ask("Telegram Chat ID")
config_content = CONFIG_TEMPLATE.format(
wifi_ssid=wifi_ssid,
wifi_pass=wifi_pass,
groq_key=groq_key,
bot_token=bot_token,
chat_id=chat_id
)
# Write config.py
config_path = os.path.join("microclawup", "config.py")
with open(config_path, "w") as f:
f.write(config_content)
print()
print("config.py created successfully!")
print()
print("Next steps:")
print(" 1. Open Thonny IDE")
print(" 2. Connect your ESP32")
print(" 3. Upload the entire 'microclawup' folder to your ESP32")
print(" 4. Upload 'main.py' to the root of your ESP32")
print(" 5. Reset your ESP32 — done!")
print()
print("Your bot will send 'MicroClawUP Online' on Telegram when ready.")
if __name__ == "__main__":
main()