{"id":15417942,"url":"https://github.com/pelikhan/devicescript-adafruit-io","last_synced_at":"2025-03-01T21:51:52.311Z","repository":{"id":173462335,"uuid":"650805735","full_name":"pelikhan/devicescript-adafruit-io","owner":"pelikhan","description":"A DeviceScript library to use Adafruit IO","archived":false,"fork":false,"pushed_at":"2023-07-27T15:15:29.000Z","size":96,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-12T00:26:31.672Z","etag":null,"topics":["devicescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pelikhan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"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":"2023-06-07T21:08:25.000Z","updated_at":"2023-06-09T18:30:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"780a3863-24a0-4f69-aace-92defaab26a0","html_url":"https://github.com/pelikhan/devicescript-adafruit-io","commit_stats":{"total_commits":32,"total_committers":2,"mean_commits":16.0,"dds":0.1875,"last_synced_commit":"123fb61db7dd4c7f9df783ab497860b684f445c0"},"previous_names":["pelikhan/devicescript-adafruit-io"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelikhan%2Fdevicescript-adafruit-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelikhan%2Fdevicescript-adafruit-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelikhan%2Fdevicescript-adafruit-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelikhan%2Fdevicescript-adafruit-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pelikhan","download_url":"https://codeload.github.com/pelikhan/devicescript-adafruit-io/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241430321,"owners_count":19961635,"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","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":["devicescript"],"created_at":"2024-10-01T17:18:25.168Z","updated_at":"2025-03-01T21:51:52.276Z","avatar_url":"https://github.com/pelikhan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Adafruit.IO DeviceScript Client\n\nThis project is a [DeviceScript](https://microsoft.github.io/devicescript/) library that uses [Adafruit.io REST APIs](https://io.adafruit.com/api/docs/#create-data) to upload data.\n\n\u003e Requires a microcontroller with network connectivity such as the [Adafruit QT Py C3](https://microsoft.github.io/devicescript/devices/esp32/adafruit-qt-py-c3).\n\n## Setup\n\nInstall this project to your DeviceScript project\n\n```bash\nnpm install --save pelikhan/devicescript-adafruit-io#v...\n```\n\nwhere `v...` is the current release\n\n## Settings\n\nThe APIs will read a default username, feed and key from the [settings](https://microsoft.github.io/devicescript/developer/settings).\n\n```.env\n# env.defaults\nIO_USERNAME=user\nIO_FEED=feed\n```\n\n```.env\n# env.local\nIO_KEY=...\n```\n\nThis extension uses the following settings:\n\n-   IO_KEY: (required) access key\n-   IO_FEED: feed name\n-   IO_USERNAME: io.adafruit.com user name\n-   IO_LAT: (optional) latitude (as a number)\n-   IO_LON: (optional) longitude (as a number)\n-   IO_ELE: (optional) elevation (as a number)\n\n## REST\n\nThe createData function will upload a value to the Adafruit.io feed using the [REST APIs](https://io.adafruit.com/api/docs/#create-data) and return the HTTP status code.\n\n```ts\nimport { createData } from \"devicescript-adafruit-io\"\nconst value = await temperature.reading.read()\nconst status = await createData(value)\nconsole.log({ status })\n```\n\n## MQTT\n\nThis API connects to the [MQTT](https://io.adafruit.com/api/docs/mqtt.html#adafruit-io-mqtt-api)\nbroker and let's you publish sensor data through the feed topics.\n\n```ts\nimport {\n    publishData,\n    startAdafruitIOMQTTClient,\n} from \"devicescript-adafruit-io\"\n\nconst client = await startAdafruitIOMQTTClient()\n\nawait publishData(client, 456)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpelikhan%2Fdevicescript-adafruit-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpelikhan%2Fdevicescript-adafruit-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpelikhan%2Fdevicescript-adafruit-io/lists"}