Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@sebbo2002/node-pyatv

sebbo20024kMIT9.0.0TypeScript support: included

A lightweight wrapper around pyatv…

readme

node-pyatv

License Unit Tests

A lightweight wrapper around pyatv's which also supports realtime notifications.

📝 Content

☁ 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

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.

📑 Changelog

Please have a look at CHANGELOG.md to see the changelog.

🤨 FAQ

How to install pyatv

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 (c) Sebastian Pekarek under the MIT license.

changelog

9.0.0 (2025-05-12)

chore

Features

  • Connect via MAC address instead of host (a9e6614), closes #353

BREAKING CHANGES

  • Drop node.js v18 Support

This node.js version is no longer supported. For more information see https://nodejs.dev/en/about/releases/

  • This change means that NodePyATVDevice.host() no longer necessarily returns a string, but possibly undefined. The signature of toJSON() has also been adjusted accordingly.

8.1.2 (2025-02-07)

8.1.1 (2025-01-09)

Bug Fixes

8.1.0 (2024-11-15)

Bug Fixes

  • Support for seriesName fixed (dc5bf58)

Features

  • Add iTunes Store Identifier (73e809e)
  • Add Support for contentIdentifier, episodeNumber, seasonNumber and seasonName (fdd935d), closes #339
  • Device: Add missing state getters (e80c4f7)

8.0.0 (2024-08-26)

chore

  • Drop support for node.js v19 and v21 (2fff079)

BREAKING CHANGES

  • Drop node.js v21 Support

These node.js versions are no longer supported. For more information see https://nodejs.dev/en/about/releases/

7.4.0 (2024-08-04)

Bug Fixes

  • Do not trigger "special" events when they are not received (c63dfe6), closes #326

Features

  • Export NodePyATVFindResponseObject and NodePyATVRequestOptions (c668148), closes #324
  • Support unicast scans (2b25f7e), closes #324

7.3.0 (2024-01-30)

Bug Fixes

  • core: fix typo getParameters (e28b86b)
  • core: fix unintentional event trigger (c4bd9a5)
  • Do not reset state to initial default state on unsupported messages (876c9b4), closes #295
  • Types: Fix NodePyATVFocusState typo (cc96a83)

Features

7.2.1 (2023-12-29)

Bug Fixes

7.2.0 (2023-12-26)

Features

7.1.0 (2023-11-23)

Features

  • Log pyatv output of push_updates (fc2618c)

7.0.4-develop.2 (2023-10-18)

Reverts

  • Revert "ci: Run tests with node.js v18, v20 and v21" (1b245a5)

7.0.4-develop.1 (2023-10-17)

7.0.3 (2023-09-18)

Reverts

  • Revert "ci: Downgrade is-semantic-release till it's fixed" (91c2ab5)

7.0.3-develop.2 (2023-09-01)

7.0.3-develop.1 (2023-08-24)

Reverts

  • Revert "ci: Downgrade is-semantic-release till it's fixed" (91c2ab5)

7.0.2 (2023-08-17)

7.0.2-develop.2 (2023-08-17)

7.0.2-develop.1 (2023-07-14)

7.0.1 (2023-07-11)

7.0.1-develop.1 (2023-06-22)

7.0.0 (2023-06-14)

Build System

  • Deprecate node.js v14 / v17 (7a2de45)

Features

  • Support focus state and volume events (9fb10c6)

BREAKING CHANGES

7.0.0-develop.2 (2023-06-14)

Features

  • Support focus state and volume events (9fb10c6)

7.0.0-develop.1 (2023-06-14)

Build System

  • Deprecate node.js v14 / v17 (7a2de45)

BREAKING CHANGES

6.0.3 (2023-05-19)

6.0.3-develop.2 (2023-05-19)

6.0.3-develop.1 (2023-05-02)

6.0.2 (2023-04-20)

6.0.2-develop.1 (2023-04-18)

6.0.1 (2023-03-31)

Bug Fixes

  • Add check.sh to npm module (ac7b04e)

6.0.0 (2023-03-31)

Build System

Features

  • List and launch AppleTV Apps (680d1de)

BREAKING CHANGES

  • From now on, only node.js ^14.8.0 || >=16.0.0 are supported

6.0.0-develop.3 (2023-03-30)

6.0.0-develop.2 (2023-03-21)

Features

  • List and launch AppleTV Apps (680d1de)

6.0.0-develop.1 (2023-02-12)

Build System

BREAKING CHANGES

  • From now on, only node.js ^14.8.0 || >=16.0.0 are supported

5.1.2-develop.3 (2022-12-07)

5.1.2-develop.2 (2022-12-04)

5.1.2-develop.1 (2022-12-04)

5.1.1 (2022-10-18)

5.1.1-develop.2 (2022-10-11)

5.1.1-develop.1 (2022-09-12)

5.1.0 (2022-08-11)

Features

  • Add Support for device_info and device.services (1f60980)

5.1.0-develop.1 (2022-08-04)

Features

  • Add Support for device_info and device.services (1f60980)

5.0.0 (2022-07-25)

Build System

BREAKING CHANGES

  • Only Support for node.js ^12.20.0 || >=14.13.1

5.0.0-develop.1 (2022-07-17)

Build System

BREAKING CHANGES

  • Only Support for node.js ^12.20.0 || >=14.13.1

4.3.4-develop.4 (2022-06-10)

4.3.4-develop.3 (2022-06-09)

4.3.4-develop.2 (2022-06-05)

4.3.4-develop.1 (2022-06-03)

4.3.3 (2022-05-14)

4.3.3-develop.2 (2022-05-14)

4.3.3-develop.1 (2022-05-01)

4.3.2 (2022-04-28)

4.3.2-develop.1 (2022-04-13)

4.3.1 (2022-03-31)

4.3.1-develop.1 (2022-03-31)

4.3.0 (2022-01-24)

Bug Fixes

  • Add turnOn and turnOff to NodePyATVKeys (7497591)
  • Handle turnOn/turnOff in pressKey() correctly (7e6eefa)

Features

  • Add turnOn() and turnOff() commands (82e52d4)

4.3.0-develop.3 (2022-01-21)

Bug Fixes

  • Handle turnOn/turnOff in pressKey() correctly (7e6eefa)

4.3.0-develop.2 (2022-01-21)

Bug Fixes

  • Add turnOn and turnOff to NodePyATVKeys (7497591)

4.3.0-develop.1 (2022-01-21)

Features

  • Add turnOn() and turnOff() commands (82e52d4)

4.2.1 (2021-12-14)

Bug Fixes

  • CI: Fix DockerHub container release (01b7534)

4.2.1-develop.1 (2021-12-06)

Bug Fixes

  • CI: Fix DockerHub container release (01b7534)

4.2.0 (2021-11-29)

Features

  • Add previously inaccessible types and classes to exports (9443c02)
  • Handle pyatv exceptions for getState() and event listeners (a695e11), closes #105

4.2.0-develop.2 (2021-11-29)

Features

  • Add previously inaccessible types and classes to exports (9443c02)

4.2.0-develop.1 (2021-11-29)

Features

  • Handle pyatv exceptions for getState() and event listeners (a695e11), closes #105

4.1.1-develop.1 (2021-10-22)

4.1.0 (2021-10-09)

Features

  • Add support for companion and raop credentials (6c68d6b)

4.0.0-develop.4 (2021-10-09)

Features

  • Add support for companion and raop credentials (6c68d6b)

4.0.0-develop.3 (2021-06-18)

4.0.0-develop.2 (2021-06-08)

4.0.0-develop.1 (2021-06-08)

chore

  • Remove node.js 10 Support (2b910c0)

BREAKING CHANGES

  • Removed support for node.js v10

3.1.1-develop.1 (2021-05-13)

3.1.0 (2021-05-13)

Features

  • Use repo template (@sebbo2002/js-template) (696a474)

3.1.0-develop.1 (2021-05-13)

Features

  • Use repo template (@sebbo2002/js-template) (696a474)

3.0.1 (2020-12-15)

3.0.0 (2020-11-29)

Bug Fixes

  • CI: Fix build environment variable (da77a9c)
  • CI: Fix build.sh (16088cf)
  • CI: Fix docs branch filter for release (71b6879)
  • CI: Fix gh-pages branch name (f2423ca)
  • CI: Fix release process (5249ce4)
  • CI: multibranch gh-pages (4f3cb0e)
  • CI: multibranch gh-pages (737c216)
  • CI: multibranch gh-pages (b82302a)
  • postinstall file check (39777b3)
  • module: remove prepare step, use semantic release exec (54f6e28)

Continuous Integration

  • release: fix NPM_Token for deprecation (5c988b9)

Features

BREAKING CHANGES

  • release: as the merge wasn't marked as one successfully…

2.0.0-develop.5 (2020-11-15)

Bug Fixes

  • CI: Fix docs branch filter for release (71b6879)

2.0.0-develop.4 (2020-11-15)

Bug Fixes

  • CI: Fix gh-pages branch name (f2423ca)

2.0.0-develop.3 (2020-11-15)

Bug Fixes

  • CI: Fix release process (5249ce4)

2.0.0-develop.2 (2020-11-15)

2.0.0-develop.1 (2020-11-13)

Continuous Integration

  • release: fix NPM_Token for deprecation (5c988b9)

BREAKING CHANGES

  • release: as the merge wasn't marked as one successfully…

1.1.0-develop.1 (2020-11-13)

Bug Fixes

Features