{"id":28697338,"url":"https://github.com/lennart080/esp8266-tinyconfig","last_synced_at":"2026-05-03T10:38:59.274Z","repository":{"id":298911052,"uuid":"1001508937","full_name":"lennart080/ESP8266-TinyConfig","owner":"lennart080","description":"Esp8266 library to store configuration data","archived":false,"fork":false,"pushed_at":"2025-06-13T14:22:48.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-13T15:36:09.900Z","etag":null,"topics":["arduino","arduino-ide","arduino-library","config","configuration","credential-storage","credentials","data","data-config","esp8266","esp8266-arduino","iot","platformio","platformio-library"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lennart080.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-13T13:57:33.000Z","updated_at":"2025-06-13T14:29:16.000Z","dependencies_parsed_at":"2025-06-13T15:39:59.950Z","dependency_job_id":"6618330a-131f-45c1-a0fc-0553c4eff277","html_url":"https://github.com/lennart080/ESP8266-TinyConfig","commit_stats":null,"previous_names":["lennart080/esp8266-tinyconfig"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lennart080/ESP8266-TinyConfig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lennart080%2FESP8266-TinyConfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lennart080%2FESP8266-TinyConfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lennart080%2FESP8266-TinyConfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lennart080%2FESP8266-TinyConfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lennart080","download_url":"https://codeload.github.com/lennart080/ESP8266-TinyConfig/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lennart080%2FESP8266-TinyConfig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281651099,"owners_count":26537963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-29T02:00:06.901Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","arduino-ide","arduino-library","config","configuration","credential-storage","credentials","data","data-config","esp8266","esp8266-arduino","iot","platformio","platformio-library"],"created_at":"2025-06-14T10:01:35.721Z","updated_at":"2025-10-29T15:47:58.059Z","avatar_url":"https://github.com/lennart080.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TinyConfig\n[![License](https://img.shields.io/github/license/lennart080/ESP8266-TinyConfig?color=blue)](https://github.com/lennart080/ESP8266-TinyConfig/blob/main/LICENSE)\n[![PlatformIO Registry](https://badgen.net/badge/PlatformIO/Available/green?icon=platformio)](https://registry.platformio.org/libraries/lennart080/ESP8266-TinyConfig)\n[![GitHub Release](https://img.shields.io/github/v/release/lennart080/ESP8266-TinyConfig)](https://github.com/lennart080/ESP8266-TinyConfig/releases)\n\nA lightweight configuration library for ESP8266 (Arduino/PlatformIO).  \nEasily store and retrieve configuration data (such as WiFi credentials, settings, etc.) in a JSON file on the ESP8266's filesystem.\n\n---\n\n## Features\n\n- **Simple API:** Store and retrieve integers, floats, and strings with ease.\n- **JSON-based:** Configuration is stored as a JSON file on LittleFS.\n- **Automatic file creation/reset:** Handles missing or corrupt config files.\n- **Configurable file size:** Prevents oversized config files.\n- **Detailed error handling:** Get error codes and human-readable error messages.\n\n---\n\n## Getting Started\n\n### Hardware Requirements\n\n- ESP8266-based board (e.g., NodeMCU, Wemos D1 Mini)\n- PlatformIO or Arduino IDE\n\n---\n\n## Installation\n\n### PlatformIO\n\nAdd this library to your `platformio.ini`:\n```\nlib_deps =\n    https://github.com/lennart080/ESP8266-TinyConfig.git\n    bblanchon/ArduinoJson\n```\n\nOr install via the PlatformIO Library Manager.\n\n### Arduino IDE\n\n1. Download this repository as a ZIP file.\n2. In Arduino IDE, go to **Sketch \u003e Include Library \u003e Add .ZIP Library...** and select the downloaded ZIP.\n3. Install the required dependencies:\n    - [ArduinoJson](https://arduinojson.org/)\n    - LittleFS (included with ESP8266 core)\n\n---\n\n## Usage\n\n#### 1. Include and Create\n\n```cpp\n#include \u003cTinyConfig.h\u003e\nTinyConfig config;\n```\n\n#### 2. Initialize the Filesystem\n\nCall `StartTC()` in your `setup()` function to mount the filesystem and prepare the config file.\n\n```cpp\nvoid setup() {\n    Serial.begin(115200);\n\n    if (!config.StartTC()) {\n        Serial.println(\"Init failed: \" + config.getLastErrorString());\n        return;\n    }\n}\n```\n\n#### 3. Set Configuration Values\n\nStore values (such as WiFi credentials or settings):\n\n```cpp\nconfig.set(\"wifi_ssid\", \"MyNetwork\");\nconfig.set(\"wifi_pass\", \"MyPassword\");\nconfig.set(\"boot_count\", 1);\n```\n\n#### 4. Retrieve Configuration Values\n\nRead values from the config file, providing a fallback if the key does not exist:\n\n```cpp\nString ssid = config.getString(\"wifi_ssid\", \"default_ssid\");\nint bootCount = config.getInt(\"boot_count\", 0);\n\nSerial.println(\"SSID: \" + ssid);\nSerial.print(\"Boot count: \");\nSerial.println(bootCount);\n```\n\n#### 5. Retrieve All Configuration Data\n\nGet all configuration as a JSON string:\n\n```cpp\nString allConfig = config.getAll();\nSerial.println(allConfig); // Prints: {\"wifi_ssid\":\"MySSID\",\"wifi_pass\":\"MyPass\",...}\n```\n\nOr as a `DynamicJsonDocument` for advanced manipulation:\n\n```cpp\nDynamicJsonDocument doc = config.getAllJson();\nif (doc.containsKey(\"wifi_ssid\")) {\n    Serial.println(doc[\"wifi_ssid\"].as\u003cString\u003e());\n}\n```\n\n#### 6. Delete a Key from the Configuration\n\nRemove a specific key and its value from the configuration:\n\n```cpp\nconfig.deleteKey(\"wifi_pass\");\n```\n\n#### 7. Reset Configuration (Optional)\n\nTo reset the configuration file to an empty JSON object:\n\n```cpp\nconfig.resetConfig();\n```\n\n#### 8. Unmount the Filesystem\n\nWhen finished, unmount the filesystem:\n\n```cpp\nconfig.StopTC();\n```\n\n---\n\n## API Reference\n\n| Method                                             | Description                                      |\n|----------------------------------------------------|--------------------------------------------------|\n| `bool StartTC()`                                   | Mounts the filesystem and prepares the config file. |\n| `bool StopTC()`                                    | Unmounts the filesystem.                         |\n| `bool set(const String\u0026 key, int/float/String)`    | Set a value in the config.                       |\n| `int getInt(const String\u0026 key, int fallback)`      | Get an integer value or fallback.                |\n| `float getFloat(const String\u0026 key, float fallback)`| Get a float value or fallback.                   |\n| `String getString(const String\u0026 key, String fallback)` | Get a string value or fallback.              |\n| `String getAll(const String\u0026 fallback = \"{}\")`     | Get the entire config as a JSON string.          |\n| `DynamicJsonDocument getAllJson()`                 | Get the entire config as a DynamicJsonDocument.  |\n| `bool deleteKey(const String\u0026 key)`                | Delete a key and its value from the config.      |\n| `bool resetConfig()`                               | Resets config to empty JSON.                     |\n| `void setMaxFileSize(size_t maxSize)`              | Set max config file size in bytes.               |\n| `TinyConfigError getLastError() const`             | Get the last error code.                         |\n| `String getLastErrorString() const`                | Get a string describing the last error.          |\n\n---\n\n## Troubleshooting\n\n- **LittleFS mount failed:** Ensure the filesystem is formatted and available.\n- **File not found:** The config file will be created automatically if missing.\n- **File too large:** Use `setMaxFileSize()` to increase the limit if needed.\n- **Not initialized:** Call `StartTC()` before using other methods.\n\n---\n\n## License\n\nThis project is licensed under the Apache 2.0 License.\n\nYou may use, share and modify it, as long as you give credit to:\n\n**Lennart Gutjahr (2025)** — Original author  \n**gutjahrlennart@gmail.com** — Email\n\nLicense details: [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n\n---\n\n## Credits\n\nBased on [ArduinoJson](https://arduinojson.org/) and [LittleFS](https://github.com/earlephilhower/arduino-esp8266littlefs).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flennart080%2Fesp8266-tinyconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flennart080%2Fesp8266-tinyconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flennart080%2Fesp8266-tinyconfig/lists"}