{"id":13801039,"url":"https://github.com/radeklat/micropython-thingspeak","last_synced_at":"2026-02-28T06:30:08.523Z","repository":{"id":98816254,"uuid":"137591453","full_name":"radeklat/micropython-thingspeak","owner":"radeklat","description":"Library for sending data to thingspeak.com from IoT devices running micropython (such as ESP8266)","archived":false,"fork":false,"pushed_at":"2018-06-16T17:22:28.000Z","size":13,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T18:47:05.438Z","etag":null,"topics":["http","https","iot-device","micropython","micropython-thingspeak","thingspeak","time-series"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/radeklat.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}},"created_at":"2018-06-16T15:42:26.000Z","updated_at":"2025-03-20T13:21:11.000Z","dependencies_parsed_at":"2023-05-25T14:00:34.497Z","dependency_job_id":null,"html_url":"https://github.com/radeklat/micropython-thingspeak","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/radeklat/micropython-thingspeak","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radeklat%2Fmicropython-thingspeak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radeklat%2Fmicropython-thingspeak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radeklat%2Fmicropython-thingspeak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radeklat%2Fmicropython-thingspeak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/radeklat","download_url":"https://codeload.github.com/radeklat/micropython-thingspeak/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radeklat%2Fmicropython-thingspeak/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29926572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"online","status_checked_at":"2026-02-28T02:00:07.010Z","response_time":90,"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":["http","https","iot-device","micropython","micropython-thingspeak","thingspeak","time-series"],"created_at":"2024-08-04T00:01:18.902Z","updated_at":"2026-02-28T06:30:08.508Z","avatar_url":"https://github.com/radeklat.png","language":"Python","readme":"# micropython-thingspeak\n\nLibrary for sending data to [thingspeak.com](thingspeak.com) from IoT \ndevices running MicroPython (such as ESP8266).\n\n# Features\n\n* Supports HTTP and HTTPS API (extension is possible)\n* Automatically calculates delay required to conform to Free plan\n* Allows naming channels (you can use _Humidity_ instead of cryptic \n  _field1_ required by the API)\n* Resolves thingspeak.com IP address only once\n* Optionally logs sent values to console\n\n# Usage guide\n\n[Download the library](https://raw.githubusercontent.com/radeklat/micropython-thingspeak/master/src/lib/thingspeak.py) \nand put it in the _lib_ folder of your project (see \n[esp8266-deploy-micropython](https://github.com/radeklat/esp8266-deploy-micropython) \nfor easy deployments!).\n\n## Get ThingSpeak API keys\n\n1. Login on [ThingSpeak website](https://thingspeak.com)\n1. Go to _Channels/My channels_\n1. Choose a channel\n1. Go to _API Keys_ tab\n1. Make note of the _Write API Key_\n\n## Configure channels\n\nAPI rate limiting is calculated based on number of channels. So it is \nnecessary to specify all your active channels, even if they are not used\non current device.\n\nEach channel requires a name (for logging and self-defensive coding), \nWrite API key () and list of field names.\n\nField names are internally transformed into _field1_ ... _fieldN_ so \nthey need to be in this order. \n\n```python\nfrom thingspeak import Channel\n\nchannel_living_room = \"living room\"\nchannel_bedroom = \"bedroom\"\nactive_channel = channel_living_room\n\nfield_temperature = \"Temperature\"\nfield_humidity = \"Humidity\"\n\nchannels = [\n    Channel(channel_living_room, '\u003cAPI KEY\u003e', [field_temperature, field_humidity]),\n    Channel(channel_bedroom, '\u003cAPI KEY\u003e', [field_temperature, field_humidity])\n]\n``` \n\n## Create API instance\n\nBy default will library use HTTP protocol and logging is turned off.\n\n```python\nfrom thingspeak import ThingSpeakAPI, ProtoHTTPS\n\nthing_speak = ThingSpeakAPI(channels, protocol_class=ProtoHTTPS, log=True)\n```\n\n## Send values\n\n```python\nimport machine\nimport time\nimport dht\n\ndht_sensor = dht.DHT22(machine.Pin(0))\n\nwhile True:\n    try:\n        dht_sensor.measure()\n    except OSError:\n        continue\n\n    thing_speak.send(active_channel, {\n        field_temperature: dht_sensor.temperature(),\n        field_humidity: dht_sensor.humidity()\n    })\n\n    time.sleep(thing_speak.min_delay)\n```\n\n`ThingSpeak.send()` returns False when sending values fails. This is in \nmost cases due to a wrong API key.\n\n# Examples\n\nYou can find a working example of sending values from DHT22 on ESP8266\nin [src/main.py](src/main.py).\n\n# Testing\n\nThere are unit tests present in the [tests](tests) directory. Before \nrunning them, set _API_KEY_ environment variable to a _Write API Key_\nof some testing channel. ","funding_links":[],"categories":["Libraries"],"sub_categories":["Communications"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradeklat%2Fmicropython-thingspeak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fradeklat%2Fmicropython-thingspeak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradeklat%2Fmicropython-thingspeak/lists"}