{"id":19585140,"url":"https://github.com/bucknalla/balena-pycom-ota","last_synced_at":"2025-07-05T05:07:41.588Z","repository":{"id":92315462,"uuid":"133686917","full_name":"Bucknalla/balena-pycom-ota","owner":"Bucknalla","description":"📶 Over the Air Update Manager for balena devices to control Pycom devices ","archived":false,"fork":false,"pushed_at":"2019-06-17T22:01:42.000Z","size":237,"stargazers_count":13,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-27T11:42:28.284Z","etag":null,"topics":["balena","balenacloud","ota-update","pycom"],"latest_commit_sha":null,"homepage":"","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/Bucknalla.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":"2018-05-16T15:28:46.000Z","updated_at":"2022-01-25T17:34:19.000Z","dependencies_parsed_at":"2023-05-16T20:30:20.185Z","dependency_job_id":null,"html_url":"https://github.com/Bucknalla/balena-pycom-ota","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Bucknalla/balena-pycom-ota","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bucknalla%2Fbalena-pycom-ota","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bucknalla%2Fbalena-pycom-ota/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bucknalla%2Fbalena-pycom-ota/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bucknalla%2Fbalena-pycom-ota/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bucknalla","download_url":"https://codeload.github.com/Bucknalla/balena-pycom-ota/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bucknalla%2Fbalena-pycom-ota/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263687156,"owners_count":23496089,"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":["balena","balenacloud","ota-update","pycom"],"created_at":"2024-11-11T07:53:03.410Z","updated_at":"2025-07-05T05:07:41.583Z","avatar_url":"https://github.com/Bucknalla.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Balena OTA Manager for Pycom Devices\n\nThis repo consists of a [balena](https://balena.io) image of a Pycom Over the Air (OTA) firmware (FW) and software (SW) Manager. The repo consists of two main components:\n\n- The server that provides the update files and generates update \"manifests\" (to determine the correct FW/SW to issue)\n- The library that allows a Pycom module perform updates from the server, along with an example `main.py` script\n\nThis repo is set up such that the update sever can directly run from it, when built into a balena container. It is important to be aware that **file structure is extremely important** and moving files/firmware binaries around will cause issues when generating the manifesto.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"images/balena-pycom.png\" width=\"600px\" \u003e\n\u003c/p\u003e\n\n## Installation\n\nBegin by cloning this repo to your local environment, using the following command:\n\n```bash\ngit clone https://github.com/bucknalla/balena-pycom-ota.git\n```\n\nYou may wish to jump ahead to the section on [balena Dashboard](#balena-ota-manager) to learn about provisioning balena OS to your devices.\n\n## OTA Server\n\n### Server Setup\n\nThe Pycom OTA Server will run a HTTP server on port 8000 (this can be changed in the [OTA_server.py](OTA_server.py) file). The OTA server allows for both FW and SW updates to Pycom devices.\n\nWithin this repository, there are two directories labelled `1.0.0` and `1.0.1`. These are both working examples of the OTA procedure, the only difference being the colour of the on-board LED so that a successful update can be demonstrated (Blue for `1.0.0` and green for `1.0.1`). You should upload version `1.0.0` to the module first and then via the OTA update procedure it will update to version `1.0.1`. The `pymakr.conf` associated with this project is included for ease of identifying which directory to upload. For more information, see the Pycom Libraries [OTA Example](https://github.com/pycom/pycom-libraries/tree/master/examples/OTA). Additional versions of SW may be placed into the [Pycom](Pycom/) folder, following the same versioning scheme.\n\nYou will also need to set up device/fleet variables [config.py](config.py) to add your WiFi SSID, password and the address of the update server. Ensure you make these changes in both `1.0.0` and `1.0.1` or the code will stop working after the OTA update. Additionally, if you wish to use the OTA server to update the firmware of a Pycom device, place the firmware.bin file into the [Pycom](Pycom/) directory.\n\n**It is essential that you test the SW and FW before deploying to a device in the field as there is no way to recover a device failure.** I intend to provide examples with improved fault tolerance with regards to restoring previous firmware/software version, in later additions to this project.\n\n## Pycom Device\n\n### Pycom Setup\n\nTo write your own Pycom device code, navigate to the [Pycom/1.0.0/flash](Pycom/1.0.0/flash/) directory and modify the [Pycom/1.0.0/flash/main.py](Pycom/1.0.0/flash/main.py) file. Ensure to retain the OTA library and the config.py files.\n\nTo upload your own programs to the Pycom device, copy the [Pycom/1.0.0/flash](Pycom/1.0.0/flash/) directory onto the Pycom device either via USB or FTP upload.\n\n## Balena OTA Manager\n\n### Setup\n\nTo setup a balena device (i.e. RPi3) with OTA Manager, provision a balena device following their [getting started](https://docs.balena.io/learn/getting-started/raspberrypi3/python/) guide. Once you have reached the point of [deploying code](https://docs.balena.io/learn/getting-started/raspberrypi3/python/#deploy-code), follow the steps below:\n\nEnsure that you are in the repository \u0026 add your balena remote\n\n```bash\ncd balena-pycom-ota\ngit remote add balena \u003cUSERNAME\u003e@git.balena.io:\u003cUSERNAME\u003e/\u003cAPPNAME\u003e.git\n```\n\n*This can be found in your balena Application dashboard in the top right corner.*\n\nNext push your local repo up to the remote\n\n```bash\ngit push balena master\n```\n\nThis will then build the container image and start the server running on your device. You will still need to specify settings for your server and Pycom devices.\n\n### User Settings\n\nIn order to specify settings such as `WIFI_SSID` and `WIFI_PASS`, you will need to navigate to the `device service variable` settings tab within the balena dashboard interface. Create variables with following options:\n\n```bash\nWIFI_SSID = \"your-wifi-ssid\"\nWIFI_PASS = \"your-wifi-password\"\nSERVER_IP = \"your-server-ip\"\nSERVER_PORT =  \"your-server-port\"\n```\n\n## Future Features\n\n- [x] Allow for Device Variable Configuration\n- [ ] Allow eligible devices to open Access Points for Pycom Devices\n- [ ] Provide example for fault tolerant software (i.e. restore to previous firmware)\n- [ ] Provide automatic firmware retrieval from Pycom servers (With options for Stable, Latest, etc. builds)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbucknalla%2Fbalena-pycom-ota","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbucknalla%2Fbalena-pycom-ota","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbucknalla%2Fbalena-pycom-ota/lists"}