{"id":18824888,"url":"https://github.com/wwj718/octostudio_py","last_synced_at":"2025-04-14T01:31:18.375Z","repository":{"id":204141187,"uuid":"711057411","full_name":"wwj718/octostudio_py","owner":"wwj718","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-01T23:51:38.000Z","size":219,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T07:14:06.059Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/wwj718.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-28T04:56:34.000Z","updated_at":"2025-02-11T09:29:04.000Z","dependencies_parsed_at":"2023-11-01T14:28:08.929Z","dependency_job_id":null,"html_url":"https://github.com/wwj718/octostudio_py","commit_stats":null,"previous_names":["wwj718/octostudio_py"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwj718%2Foctostudio_py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwj718%2Foctostudio_py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwj718%2Foctostudio_py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwj718%2Foctostudio_py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wwj718","download_url":"https://codeload.github.com/wwj718/octostudio_py/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248807532,"owners_count":21164698,"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":[],"created_at":"2024-11-08T00:57:50.922Z","updated_at":"2025-04-14T01:31:18.016Z","avatar_url":"https://github.com/wwj718.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OctoStudio\n\nThis Python library pass messages between Python and [OctoStudio](https://octostudio.org/en/).\n\nSpecifically, it works with two blocks of OctoStudio:\n\n- beam to phones\n- wait for beam (work-in-progress)\n\n\n\u003cimg width=300 src=\"./octostudio.png\" /\u003e\n\n\n## Install\n\n```\n# Python \u003e= 3.10\npip install octostudio\n```\n\n## Usage\n\n```\nfrom octostudio import OctoStudio\n\ndef on_message(shape):\n    print(shape)\n\nocto = OctoStudio()\nocto.on_message = on_message\nocto.start()\n```\n\n\n## For MicroBlocks users\n\nThis library was originally used to bridge OctoStudio's Bluetooth radio with MicroBlocks' wifi radio.\n\nTo do this you need to install this package, then run the command: `octostudio-microblocks-bridge`\n\nTake a look at the [inner workings](./octostudio/microblocks.py).\n\n## For Scrarch users\n\nInstall dependencies:\n\n```bash\npip install paho-mqtt octostudio\n``` \n\nrun the command: `octostudio-scratch-bridge`. Take a look at the [inner workings](./octostudio/scratch.py).\n\n\nOpen [the demo project](https://create.codelab.club/projects/57459/editor/)\n\n[OctoStudio \u0026 Scratch demo video](https://wwj718.github.io/post/img/octo-scratch.mp4)\n\n### Customize\n\noctostudio-scratch-bridge uses the default MQTT broker and account. Other users may also be using it. If you want to use your own broker and account, you can run the following code instead of the default octostudio-scratch-bridge:\n\n```python\n# custom octostudio-scratch-bridge\nimport paho.mqtt.client as mqtt\nfrom octostudio import OctoStudio\n\nmqtt_client = mqtt.Client()\n# You can use other MQTT broker. If you want to use it with Scratch, make sure the MQTT broker supports wss protocol\nmqtt_client.username_pw_set('guest', 'test')\nmqtt_client.connect(\"mqtt.aimaker.space\", 1883, 60)\n\ndef on_message(shape):\n    mqtt_client.publish(\"octo_message\", shape)\nocto = OctoStudio()\nocto.on_message = on_message\nocto.start()\n```\n\n## For Snap! users\n\nInstall dependencies:\n\n```bash\npip install paho-mqtt octostudio\n``` \n\nrun the command: `octostudio-snap-bridge`. Take a look at the [inner workings](./octostudio/snap.py).\n\nOpen [the demo project](https://snap.berkeley.edu/project?username=alan_russell\u0026projectname=octostudio%2dsnap%2ddemo)\n\n## FAQ\n\n### How to send a message to OctoStudio?\n\n[send a message to OctoStudio](https://wwj718.github.io/post/%E7%BC%96%E7%A8%8B/extend-octostudio/#%E5%BE%80-octostudio-%E9%87%8C%E5%8F%91%E9%80%81%E6%B6%88%E6%81%AF)\n\nI implemented this part directly in MicroBlocks instead of the bridge. I will update the relevant principles to this article soon.\n\n### Messages being delayed\n\nReference here: [Maximum rate that advertisements can be scanned/read](https://github.com/hbldh/bleak/discussions/831).\n\nNo solution found yet.\n\n[Related source code](https://github.com/wwj718/octostudio_py/blob/main/octostudio/__init__.py#L53), looking forward to you improving it.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwwj718%2Foctostudio_py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwwj718%2Foctostudio_py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwwj718%2Foctostudio_py/lists"}