{"id":15831673,"url":"https://github.com/cleverdevil/pnut","last_synced_at":"2025-10-19T18:33:51.996Z","repository":{"id":188400687,"uuid":"656839366","full_name":"cleverdevil/pnut","owner":"cleverdevil","description":"PNut - Network Universal Remote Control with a TiVo Pro Slider Remote","archived":false,"fork":false,"pushed_at":"2023-08-15T05:15:37.000Z","size":19,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T07:42:57.342Z","etag":null,"topics":["home-assistant","home-automation","tivo","universal-remote","zidoo"],"latest_commit_sha":null,"homepage":"","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/cleverdevil.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-06-21T18:45:26.000Z","updated_at":"2023-08-05T10:17:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"678c22ce-15fa-441c-b300-c1e5d7f749ea","html_url":"https://github.com/cleverdevil/pnut","commit_stats":null,"previous_names":["cleverdevil/pnut"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleverdevil%2Fpnut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleverdevil%2Fpnut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleverdevil%2Fpnut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleverdevil%2Fpnut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cleverdevil","download_url":"https://codeload.github.com/cleverdevil/pnut/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246635203,"owners_count":20809324,"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":["home-assistant","home-automation","tivo","universal-remote","zidoo"],"created_at":"2024-10-05T12:05:59.194Z","updated_at":"2025-10-19T18:33:46.974Z","avatar_url":"https://github.com/cleverdevil.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PNut Network Universal Remote Control\n\nPNut is a Python-based platform for creating a customizable / programmable \nuniversal remote from a [tivo-slide-pro][1] via its USB RF dongle attached to\nany Linux device with a supporting driver. I am using it with a Raspberry Pi 4\nrunning Raspberry Pi OS.\n\nUsing this platform does require a basic working knowledge of Python.\n\nThere are a few components that are bundled within PNut:\n\n* A web service for controlling an Apple TV via [pyyatv][2]\n* A daemon called `pnut-agent` that monitors for button presses and then\n  dispatches them to a programmable custom remote that you can create\n* A library of devices that can be used together to control a variety of\n  devices, including Apple TVs, AVRs, lights, fans, and more.\n\nMuch of the capabilities for supported devices comes from [home-assistant][3],\nwhich is required for using PNut.\n\n## Usage\n\n### Creating a Universal Remote\n\nThe first step to working with PNut is to create a custom remote control using\nthe PNut building blocks. Here is an extremely simple example, which we'll place\ninto `myremote.py`.\n\n```python\nimport homeassistant_api as hass\nfrom pnut import remote, atv\n\nhass_client = hass.Client(\n    '\u003curl to home assistant here\u003e',\n    '\u003ctoken for home assistant here\u003e',\n    cache_session=False\n)\n\napple_tv = remote.AppleTV(\n    hass_client,\n    'living_room',\n    atv.ATVService('localhost', '8080')\n)\n\nreceiver = remote.Receiver(\n    hass_client,\n    'media_player.living_room_avr',\n    default_source='Apple TV'\n)\n\nbutton_map = {\n    'PLAY': { apple_tv: apple_tv.play },\n    'TIVO': { apple_tv: apple_tv.top_menu },\n    'VOLUP': { apple_tv: receiver.volume_up },\n    'GUIDE': { \n        apple_tv: lambda: apple_tv.launch_app('com.google.ios.youtubeunplugged')\n    }\n}\n\nmy_remote = remote.UniversalRemote(\n    sources={'Apple TV': apple_tv},\n    source_control=receiver,\n    source_default=apple_tv,\n    button_map=button_map\n)\n```\n\nTo start a `pnut-agent` that uses this remote control, we would run:\n\n    `bin/pnut-agent myremote:my_remote`\n\nNote that the `pnut-agent` will require permissions to connect to devices via\nthe HID, which will necessitate running the agent as root or otherwise providing\npermission.\n\n### Controlling Apple TVs\n\nIn our example, you'll see that we have an Apple TV that we're controlling.\nWhile Home Assistant does provide a mechanism for controlling Apple TVs, the \nlatency is far too high to be usable. Instead, PNut provides a web service that\ncan be used to control an Apple TV.\n\nTo run the Apple TV service, you first need to create a JSON configuration file\nabout which Apple TV you want to control, credentials, and service\nconfiguration:\n\n```\n{\n  \"name\": \"\u003cName of your Apple TV\u003e\",\n  \"identifiers\": [\n    \"\u003cMAC address of your Apple TV\u003e\"\n  ],\n  \"credentials\": {\n    \"AirPlay\": \"\u003ccredentials for AirPlay\u003e\",\n    \"Companion\": \"\u003ccredentials for Companion\u003e\",\n    \"RAOP\": \"\u003ccredentials fo RAOP\u003e\"\n  },\n  \"service\": {\n    \"host\": \"localhost\",\n    \"port\": \"8080\"\n  }\n}\n```\n\nTo find identifiers and generate credentials, use [pyatv-tools][4].\n\nOnce configured, run your Apple TV service:\n\n    `bin/appletv-service atvconfig.json`\n\nNote that your universal remote instance will need to be pointed to the\nappropriate host and port.\n\n## Complete Example\n\nCheck out the [included example](myremote.py.sample), which is essentially what\nI use to control my own home theater, which features an Apple TV, an AVR,\nmultiple sets of dimmable lights, a controllable fan, and a Zidoo media player.\n\n\n[1]: \u003chttps://tivoidp.tivo.com/tivoCommunitySupport/s/article/TiVo-Slide-Pro-Remote-Product-Info?language=en_US\u003e \"TiVo Slide Pro Remote\"\n[2]: \u003chttps://pyatv.dev\u003e \"the PyATV Library\"\n[3]: \u003chttps://www.home-assistant.io/\u003e \"Home Assistant\"\n[4]: \u003chttps://pyatv.dev/documentation/getting-started/\u003e \"PyATV's command line tools\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleverdevil%2Fpnut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcleverdevil%2Fpnut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleverdevil%2Fpnut/lists"}