Returns an object with name
, host
, id
and protocol
.
Can be used to initiate a new device instance.
Send a key press to the Apple TV
await device.pressKey(NodePyATVKeys.home);
await device.pressKey('home');
Add an event listener. Will start the event subscription with the Apple TV as long as there are listeners for any event registered.
Emit an event.
Remove an event listener. Will stop the event subscription with the Apple TV if this was the last event listener.
Add an event listener. Will start the event subscription with the Apple TV as long as there are listeners for any event registered.
Add an event listener. Will start the event subscription with the Apple TV as long as there are listeners for any event registered. Removes the listener automatically after the first occurrence.
Remove an event listener. Will stop the event subscription with the Apple TV if this was the last event listener.
Get all IDs of the Apple TV. Requires pyatv >= 0.14.5.
Returns true, if debugging is enabled. Returns the custom logging method, if one was specified. Otherwise, if debug log is disabled, returns undefined.
Enable or disable debugging or set a custom debugging method to use.
Get the IP address of the Apple TV.
Get the ID of the Apple TV.
Get the MAC address of the Apple TV. Requires pyatv >= 0.14.5.
Get the model identifier of the device. Only set, if the device was found using [[find()]]. Requires pyatv ≧ 0.10.3.
Get the model name of the device. Only set, if the device was found with [[find()]]. Requires pyatv ≧ 0.10.3.
Get the name of the Apple TV.
import pyatv from '@sebbo2002/node-pyatv';
const devices = await pyatv.find();
devices.forEach(device =>
console.log(device.name)
);
Get the operating system of the device. Only set, if the device was found with [[find()]]. Requires pyatv ≧ 0.10.3.
Get the used protocol to connect to the Apple TV.
Returns a list of services supported by the device. Ony set, if the device was found during a scan using [[find()]]. Requires pyatv ≧ 0.10.3.
Get the device version. Only set, if the device was found during a scan using [[find()]]. Requires pyatv ≧ 0.10.3.
Launch an application. Probably requires companionCredentials
, see
https://pyatv.dev/documentation/atvremote/#apps for more details.
App identifier, e.g. com.netflix.Netflix
Returns the list of installed apps on the Apple TV. Probably requires companionCredentials
,
see https://pyatv.dev/documentation/atvremote/#apps for more details.
Returns the album of the current playing media
Returns the currently used app
Returns the id of the currently used app
Returns the artist of the current playing media
Returns the app specific content identifier
Get the date and time when the state was last updated.
Get the state of this device (e.g. playing, etc.)
Returns the episode number. Probably only set if MRP is used.
Returns the current focus state of the device
Returns the genre of the current playing media
Get the hash of the current media
Returns the iTunes Store identifier if available. Requires pyatv >= 0.16.0
Get the media type of the current media
Returns the current output devices of the device
Returns the title of the current playing media
Returns the current power state (= is it on or off, see [[NodePyATVPowerState]]) of the device.
Returns the repeat state
Returns the season number. Probably only set if MRP is used.
Returns the season name. Probably only set if MRP is used.
Returns the shuffle state
Returns an [[NodePyATVState]] object representing the current state
of the device. Has an internal cache, which has a default TTL of 5s.
You can change this default value by passing the maxAge
option.
await device.getState({maxAge: 10000}); // cache TTL: 10s
Returns the title of the current playing media
Returns the media length of the current playing media
Returns the current volume of the device in percent (0 - 100)
Represents an Apple TV. Use [[getState]] to query the current state (e.g. media type and title). You can also use the attribute methods (e.g. [[getTitle]] to get the state. If you want realtime updates, subscribe to it's events with an
EventEmitter
like API, so for example by using [[on]], [[once]] or [[addListener]]. It's also possible to send key commands by using [[pressKey]] or methods like [[pause]].