|
| 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 |
0 commit comments