Skip to content

Commit 42ff978

Browse files
Expand README.md documentation. Add details on User Settings.
1 parent 18c2b17 commit 42ff978

File tree

5 files changed

+145
-1
lines changed

5 files changed

+145
-1
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,34 @@ Add "http://tp-spotify.local/callback/" to the Redirect URIs section.
107107

108108
**Don't forget to save your settings.**
109109

110-
4. Set the unique Client ID and Client Secret as values for the respective variables in `spotify.h`.
110+
4. Set the unique Client ID and Client Secret as values for the respective variables in `src/spotify.h`.
111111

112112
<img src="./images/SpotifyClientId.png" width="400">
113113

114+
### Filesystem setup
114115

116+
5. Upload the file system to the device
117+
118+
- Hit the PlatformIO icon on the navigation bar on the left side (alien face).
119+
120+
- Select the Platform > Upload Filesystem Image task. Unless you later erase the flash or modify certain files, you only need to do this once if it succeeds. Pay attention to the output in the VS Code console that opens. If it reports any errors like e.g. if it cannot connect to the board or if stops midway, close VS Code completely, restart it, and then repeat the process.
121+
122+
<img src="./images/platformio-filesystem.png" width="400">
123+
124+
- If startup fails with the following message displayed: "FATAL ERROR - Filesystem Not Initialized", this step was not successful or done.
125+
126+
### User settings
127+
128+
6. The fastest way to get up and running is to open the `src/settings.h` file and adjust the handful of configuration parameters in the "User settings" section at the top. They are all documented inside the file directly. Everything should be self-explanatory. The spotify settings were updated in step 4 above.
129+
130+
<img src="./images/UserSettings.png" width="400">
131+
132+
See [full user settings documentation](./documentation/UserSettings.md) for details about all available fields, encryption options, and using `user.ini`.
133+
134+
### Upload code to device
135+
136+
7. Select the General > Upload and Monitor task. You do this every time you change code or settings.h.
137+
138+
<img src="./images/platformio-task-upload.png" width="400">
139+
140+
See [instructions](https://docs.thingpulse.com/guides/esp32-color-kit-grande/#development-environment) if you encounter problems and need Trouble Shooting tips.

documentation/UserSettings.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Color Kit Grande Spotify Controller User Settings
2+
3+
This document explains how to configure the required user settings for the Color Kit Grande Spotify Controller. These include your Wi-Fi credentials, Spotify developer information, and timezone configuration.
4+
5+
These values must be set before the device can connect to your network or Spotify account.
6+
7+
---
8+
9+
## Configuration Options
10+
11+
You can configure the settings using one of the following methods:
12+
13+
### 1. **Edit the `settings.h` file (Quick Start)**
14+
15+
Open the `src/settings.h` file and look for the **User Settings** section at the top. This contains the fields for Wi-Fi and Spotify credentials, as well as your timezone.
16+
17+
This is the fastest way to get started. However, values in `settings.h` will be compiled into the firmware and are not encrypted. They will also be tracked by git unless you modify `.gitignore`. If your system backs up files and/or you copy the files to network locations, the credentials may be visible in clear text by others. To avoid these limitations, this project uses an optional `user.ini` file discussed in the next section.
18+
19+
### 2. **Use a `user.ini` File (Recommended for Privacy and Flexibility)**
20+
21+
A `user.ini.template` file is provided in the `/data` folder. You can copy it and rename the copy to `user.ini`, then update the values inside. This file will be uploaded to the device's filesystem using the PlatformIO “Upload Filesystem Image” task. It has already been added to `.gitignore` and will not be tracked by git by default. **NOTE: If `user.ini` is found and loaded, the conflicting values in `settings.h` will be ignored and not used.**
22+
23+
The template includes guidance on privacy levels and where to enter your credentials.
24+
25+
---
26+
27+
## Required Settings
28+
29+
| Section | Key | Description |
30+
|-----------|------------------|---------------------------------------------------------------------------|
31+
| `[vault]` | `privacy_level` | `0` = None (plaintext), `1` = Good (encrypted, portable), `2` = Better (encrypted, device-tied) |
32+
| `[wifi]` | `ssid` | Your Wi-Fi network name |
33+
| | `password` | Your Wi-Fi password |
34+
| `[spotify]` | `client_id` | Your Spotify Developer App Client ID |
35+
| | `client_secret` | Your Spotify Developer App Client Secret |
36+
| `[system]` | `timezone` | POSIX timezone format string (see example or link below) |
37+
38+
> 🔗 Refer to the [POSIX timezone list](https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv) for formatting guidance.
39+
40+
41+
## Understanding Privacy Levels
42+
43+
The `privacy_level` setting controls how credentials are stored and handled by the device. It directly affects whether the values in your `user.ini` file are used in plaintext or must be encrypted before use.
44+
45+
### Level 0 – None (plaintext)
46+
- Credentials in `user.ini` are stored and used in clear text.
47+
- This is the easiest option for beginners and debugging.
48+
- **At startup, the device will print encrypted alternatives to the serial console, which can be copy-pasted into the file if you choose to increase privacy later.**
49+
50+
```text
51+
00:30:06.427 > ======================================================================
52+
00:30:06.432 > Paste these into your user.ini file to enable encrypted credentials.
53+
00:30:06.438 > ======================================================================
54+
00:30:06.443 >
55+
00:30:06.443 > ; Values to use for Good Privacy (encrypted, reusable across devices):
56+
00:30:06.449 > privacy_level = 1
57+
00:30:06.449 > ssid = kfHankF998h4coKUwRMj6w==
58+
00:30:06.454 > password = sFnXUDMIsmci6KV5mlh2rw==
59+
00:30:06.454 > client_id = NMwdXOJ8JNvkekePuwow53nHnlcbJqNKZuQSnASx/DuJBxChGn+u7rVSwVf0sf34
60+
00:30:06.466 > client_secret = NMwdXOJ8JNvkekePuwow53nHnlcbJqNKZuQSnASx/DuJBxChGn+u7rVSwVf0sf34
61+
00:30:06.471 >
62+
00:30:06.471 > ; Values to use for Better Privacy (encrypted, tied to this device):
63+
00:30:06.476 > privacy_level = 2
64+
00:30:06.476 > ssid = bzvfcf5V5qpzfd251wqlDQ==
65+
00:30:06.482 > password = /PybaE2diyJwdlH4kZC8bQ==
66+
00:30:06.482 > client_id = yub/jzKomMIza3IP8OAKDB04QHNvqLLtDfwWTcy/WpIg8PahhpE5gXVMYO65677j
67+
00:30:06.493 > client_secret = yub/jzKomMIza3IP8OAKDB04QHNvqLLtDfwWTcy/WpIg8PahhpE5gXVMYO65677j
68+
```
69+
70+
### Level 1 – Good (encrypted, reusable across devices)
71+
- Encrypted credentials are required in `user.ini`.
72+
- Encryption uses AES-128 in ECB mode with PKCS#7 padding.
73+
- A static internal base key is used to encrypt and decrypt values.
74+
- Encrypted values can be reused on any compatible device.
75+
76+
### Level 2 – Better (encrypted, tied to device)
77+
- Same encryption method as Level 1, but the AES key is derived from both the internal base key and the device's MAC address.
78+
- Encrypted values can only be decrypted by the device that created them.
79+
- Provides stronger security, but values must be regenerated for each device.
80+
81+
Good and Better levels support an optional `key_salt` setting in the `[vault]` section to increase key complexity and further personalize the encryption key derivation.
82+
83+
---
84+
85+
## Example `user.ini`
86+
87+
```ini
88+
;
89+
; User settings for Spotify Controller. Make sure to Upload Filesystem
90+
; Image after updating.
91+
;
92+
; ----------------------------------------------------------------------
93+
; Privacy Levels:
94+
; 0 - None (credentials in clear text)
95+
; 1 - Good (encrypted, reusable across devices)
96+
; 2 - Better (encrypted, tied to this device)
97+
; ----------------------------------------------------------------------
98+
[vault]
99+
privacy_level = 0
100+
; ----------------------------------------------------------------------
101+
; WiFi:
102+
; ----------------------------------------------------------------------
103+
[wifi]
104+
ssid = MyNetworkName
105+
password = MyPassword123
106+
; ----------------------------------------------------------------------
107+
; Spotify:
108+
; ----------------------------------------------------------------------
109+
[spotify]
110+
client_id = abcdefghijklmnopqrstuv1234567890
111+
client_secret = abcdefghijklmnopqrstuv1234567890
112+
; ----------------------------------------------------------------------
113+
; System Settings:
114+
; Timezone format - see
115+
; https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv
116+
; ----------------------------------------------------------------------
117+
[system]
118+
timezone = CST6CDT,M3.2.0,M11.1.0

images/UserSettings.png

212 KB
Loading

images/platformio-filesystem.png

94.9 KB
Loading

images/platformio-task-upload.png

59.8 KB
Loading

0 commit comments

Comments
 (0)