forked from klatremis/esphome-for-deye
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsecrets.sh.example
51 lines (38 loc) · 1.78 KB
/
secrets.sh.example
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
#!/bin/bash
# OTA Password is a hash of the host name together with the base OTA salt password
ota_salt="MY_SUPER_SECRET_OTA_PASSWORD_SALT"
ota_combined="${name}-${ota_salt}"
ota_password=$(printf %s `printf %s "${ota_combined}" | sha256sum | head -c 64`)
# Web Server is a Hash of the Hostname together with the base WebServer salt password
web_server_salt="MY_SUPER_SECRET_WEB_SERVER_PASSWORD_SALT"
web_server_username="$name"
web_server_combined="${name}-${web_server_salt}"
web_server_password=$(printf %s `printf %s "${web_server_combined}" | sha256sum | head -c 64`)
# Fallback AP Password if ESP32 fails to connect to WiFi Network
wifi_ap_password="MY_SUPER_SECRET_ESP32_FALLBACK_AP_PASSWORD"
# Create a secrets.yaml containing some setup specific secrets
cat > secrets.yaml <<EOF
host_name: "${name}"
entities_id_prefix: "${entities_id_prefix}"
entities_name_prefix: "${entities_name_prefix}"
# For some reason the wifi_ssid and wifi_password must NOT be within double quotes !
wifi_ssid: MY_WIFI_SSID
wifi_password: MY_WIFI_PASSWORD
wifi_domain: ".solar.MY_DOMAIN.TLD"
wifi_ap_ssid: "${name}"
wifi_ap_password: "${wifi_ap_password}"
project_name: "luckylinux.esphome-for-deye"
project_version: "${version}"
board: "${board}"
ota_password: "${ota_password}"
web_server_username: "${web_server_username}"
web_server_password: "${web_server_password}"
mqtt_host: "172.22.1.1"
mqtt_port: "1883"
mqtt_username: ""
mqtt_password: ""
EOF
# Echo Resulting OTA Password if people want to save this in their password manager
echo -e "OTA Password (to be used when performing OTA Updates): ${ota_password}\n"
echo -e "Web Server Username (to be used when accessing the Web Server): ${web_server_username}\n"
echo -e "Web Server Password (to be used when accessing the Web Server): ${web_server_password}\n"