https://github.com/sebbo2002/node-pyatv
A lightweight node.js wrapper around pyatv…
https://github.com/sebbo2002/node-pyatv
apple-tv appletv node nodejs pyatv
Last synced: 4 months ago
JSON representation
A lightweight node.js wrapper around pyatv…
- Host: GitHub
- URL: https://github.com/sebbo2002/node-pyatv
- Owner: sebbo2002
- License: mit
- Created: 2019-01-16T20:16:30.000Z (over 7 years ago)
- Default Branch: develop
- Last Pushed: 2026-02-06T10:17:27.000Z (6 months ago)
- Last Synced: 2026-02-06T18:15:31.876Z (6 months ago)
- Topics: apple-tv, appletv, node, nodejs, pyatv
- Language: TypeScript
- Homepage:
- Size: 14.2 MB
- Stars: 30
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# node-pyatv
[](LICENSE)
[](https://github.com/sebbo2002/node-pyatv/actions?query=workflow%3ARelease+branch%3Amain)
A lightweight wrapper around pyatv's which also supports realtime notifications.
## 📝 Content
- [Installation](#-installation)
- [Quick Start](#-quick-start)
- [API Reference](#-api-reference)
- [Changelog](https://github.com/sebbo2002/node-pyatv/blob/main/CHANGELOG.md)
- [FAQ](#-faq)
## ☁ Installation
Before you use `node-pyatv` you need to install pyatv. This module woun't do this for you. Run `atvremote --version` to
double check your installation. See FAQ section for installation tips.
To install the javascript module via npm just run:
npm install @sebbo2002/node-pyatv
## ⚒ Quick Start
```typescript
import pyatv, { NodePyATVDeviceEvent } from '@sebbo2002/node-pyatv';
const devices = await pyatv.find(/*{debug: true}*/);
if (!devices.length) {
throw new Error('Oh no.');
}
const device = devices[0];
// request current title
console.log(await device.getTitle());
// request full state
console.log(await device.getState());
// subscribe to events
device.on('update:deviceState', (event: NodePyATVDeviceEvent | Error) => {
if (event instanceof Error) return;
console.log(`Current device state is ${event.value}`);
});
```
## 📑 API Reference
The API documentation is automatically generated from the code comments and can be found
[here](https://sebbo2002.github.io/node-pyatv/main/reference/).
## 📑 Changelog
Please have a look at [CHANGELOG.md](https://github.com/sebbo2002/node-pyatv/blob/main/CHANGELOG.md) to see the changelog.
## 🤨 FAQ
#### How to install pyatv
```bash
pip3 install pyatv
```
#### How to debug things
You can pass `"debug": true` for any command called. Some debug information is then printed via console.log. Additionaly
you can pass a function to process debugs logs.
#### Why are some tests skipped?
Some unit tests require a responding apple tv to pass. These tests are disabled by default. You can set the environment
variable `ENABLE_INTEGRATION=1` to enable them.
#### Is this secure?
Defenitely not. For example, there's no escaping for parameters passed to pyatv. So be sure to double check the data you
pass to this library, otherwise it may be possible to run code on your machine.
## Copyright and license
Copyright (c) Sebastian Pekarek under the [MIT license](LICENSE).