-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
GitHub IoT #5984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub IoT #5984
Conversation
A problem was found with your submission https://github.com/4211421036/IoTModule ❌ ERROR: Submission URL is already in the Library Manager index. |
Arduino Lint has suggestions for possible improvements to https://github.com/4211421036/githubiot:
|
Thanks for your interest in contributing to the Arduino Library Manager index @4211421036 After resolving the issue, trigger this check again by doing one of the following:
❗ NOTE: It is not necessary to open a new pull request. ❗ More information: |
Hi @4211421036 ❌ ERROR: Pull request removes newline from the end of a file. Please resolve this error. The checks will automatically run again once that is done. More information: |
Hi @4211421036. If you intended to submit a library, please check the instructions and update your pull request if necessary: |
❌ ERROR: Arduino Lint found errors with https://github.com/4211421036/githubiot:
|
Thanks for your interest in contributing to the Arduino Library Manager index @4211421036 After resolving the issue, trigger this check again by doing one of the following:
❗ NOTE: It is not necessary to open a new pull request. ❗ More information: |
Hi @4211421036. If you intended to submit a library, please check the instructions and update your pull request if necessary: |
Hi @4211421036. If you intended to submit a library, please check the instructions and update your pull request if necessary: |
❌ ERROR: Arduino Lint found errors with https://github.com/4211421036/githubiot:
|
Thanks for your interest in contributing to the Arduino Library Manager index @4211421036 After resolving the issue, trigger this check again by doing one of the following:
❗ NOTE: It is not necessary to open a new pull request. ❗ More information: |
Hi @4211421036. If you intended to submit a library, please check the instructions and update your pull request if necessary: |
Hi @4211421036. If you intended to submit a library, please check the instructions and update your pull request if necessary: |
❌ ERROR: Arduino Lint found errors with https://github.com/4211421036/githubiot:
|
Thanks for your interest in contributing to the Arduino Library Manager index @4211421036 After resolving the issue, trigger this check again by doing one of the following:
❗ NOTE: It is not necessary to open a new pull request. ❗ More information: |
Hello! I'm checking your submission again. |
Hi @4211421036. If you intended to submit a library, please check the instructions and update your pull request if necessary: |
❌ ERROR: Arduino Lint found errors with https://github.com/4211421036/githubiot:
|
Thanks for your interest in contributing to the Arduino Library Manager index @4211421036 After resolving the issue, trigger this check again by doing one of the following:
❗ NOTE: It is not necessary to open a new pull request. ❗ More information: |
Hello! I'm checking your submission again. |
Hi @4211421036. If you intended to submit a library, please check the instructions and update your pull request if necessary: |
❌ ERROR: Arduino Lint found errors with https://github.com/4211421036/githubiot:
|
Thanks for your interest in contributing to the Arduino Library Manager index @4211421036 After resolving the issue, trigger this check again by doing one of the following:
❗ NOTE: It is not necessary to open a new pull request. ❗ More information: |
Your submission has now been accepted! Thanks for your contribution to the Arduino Library Manager index. The library(s) will be available for installation via Library Manager within a day's time. You can check the logs from the Library Manager indexer for your library(s) here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@4211421036 I fixed the mess for you this time, but in the future please be more careful in how you prepare your pull requests:
Make sure to always create a branch in your fork for each pull request. You should never make any commits directly to the main
branch in your fork. The main
branch should always match the main
branch in this repository exactly. This way, you can use the main
branch as the base for the branches you create for your pull requests. You can learn how to do that from this tutorial:
Always make sure the main
branch in your fork is in sync with the main
branch in this repository before you make the branch for your pull request. You can learn how to sync your fork from the documentation here:
Documentation and Usage Guide GitHub IoT Arduino Module
Version 1.0.0 - February 24, 2025
Introduction
The
githubiot
library enables IoT devices based on ESP8266 or ESP32 microcontrollers to use GitHub as a data storage backend. This innovative approach eliminates the need for dedicated database servers while providing versioning capabilities, web accessibility, and integration with existing GitHub workflows.This library handles all aspects of GitHub API communication, including authentication, file retrieval, content encoding/decoding, and update operations, allowing developers to focus on their IoT application rather than backend infrastructure.
Table of Contents
Features
Dependencies
This library requires the following dependencies:
Installation
Installation by Search Arduino IDE
GitHubIoT
Manual Installation
Using Library Manager
Installing Dependencies
Make sure to install all required dependencies using the Arduino Library Manager.
Integration GitHub Action
Note
This module integration with GitHub Action Workflow. Please README Documentation at Repository IoT GitHub
Usage Integration it
Important
Library Components
The library consists of two main files:
Class Structure
API Reference
Constructor
Creates a new instance of the githubiot class.
Parameters:
token
: GitHub authentication token with 'Bearer ' prefixrepo_url
: GitHub API URL for the file to be updatedExample:
Get Current SHA
String githubiot::get_current_sha()
Retrieves the current SHA hash of the file from GitHub.
Returns:
Example:
Upload to GitHub
Uploads data to GitHub by updating the specified file.
Parameters:
doc
: ArduinoJson DynamicJsonDocument containing the data to uploadlast_sha
: Reference to the current SHA string (will be updated with the new SHA)Example:
Usage Examples
Basic Data Logging
Time Series Data Collection
Technical Background
GitHub API Interaction
The library communicates with the GitHub API using HTTP requests. Each file in a GitHub repository has a unique SHA hash that changes when the file is modified. When updating a file, you must provide the current SHA to ensure you're updating the latest version.
The workflow follows this sequence:
JSON Data Format
JSON (JavaScript Object Notation) is used as the data format due to its flexibility and widespread support. The ArduinoJson library provides efficient JSON processing on memory-constrained devices.
Base64 Encoding
GitHub requires file content to be Base64 encoded in API requests. The encoding process converts binary data to ASCII text using the following transformation:
Where each block$B_i$ is computed from 3 octets of the input message $M$ :
The encoding function maps 3 bytes (24 bits) to 4 ASCII characters (6 bits each) according to the Base64 alphabet.
HTTP Status Codes
Note
The library handles various HTTP status codes returned by the GitHub API:
Performance Considerations
Memory Usage
The ArduinoJson library uses dynamic memory allocation. The size of the
DynamicJsonDocument
should be adjusted based on your data complexity:For ESP8266 devices with limited memory, consider:
Network Performance
Caution
GitHub API has rate limits:
The average request-response cycle takes approximately 500-1500ms depending on network conditions.
Power Consumption
To optimize power consumption for battery-operated devices:
Troubleshooting
Common Issues and Solutions
"Failed to get SHA"
Possible causes:
Important
Solutions:
"HTTP Error 401"
Caution
Possible causes:
Solutions:
"HTTP Error 422"
Caution
Possible causes:
Solutions:
Debugging Techniques
Enable debug output by defining
DEBUG_GITHUBIOT
before including the library:Advanced Usage
Updating Existing JSON Files
To update an existing JSON file while preserving its structure:
Custom Commit Messages
The current implementation uses a fixed commit message ("Update data"). For custom messages, the library would need to be extended.
Error Handling Strategy
Implement a robust error handling strategy:
License
This library is released under the
MIT
License.Author