twocolors / node-red-contrib-apple-tv-x Goto Github PK
View Code? Open in Web Editor NEWNodes for controlling Apple TVs in Node-RED (wrapper pyatv)
License: GNU General Public License v3.0
Nodes for controlling Apple TVs in Node-RED (wrapper pyatv)
License: GNU General Public License v3.0
Installed the plugin inside my docker Container. Search and companion pair was successful. But I can't pair airplay. Plugin is unable to connect to my aTV4k.
`2022-02-22 07:57:08 ERROR [pyatv.scripts.atvremote]: Pairing failed
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pyatv/support/init.py", line 33, in error_handler
return await func(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/pyatv/protocols/airplay/auth/hap.py", line 43, in start_pairing
await self.http.post("/pair-pin-start", headers=_AIRPLAY_HEADERS)
File "/usr/lib/python3.8/site-packages/pyatv/support/http.py", line 359, in post
return await self.send_and_receive(
File "/usr/lib/python3.8/site-packages/pyatv/support/http.py", line 412, in send_and_receive
raise exceptions.HttpError(
pyatv.exceptions.HttpError: HTTP/1.1 method POST failed with code 400: Bad Request
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pyatv/scripts/atvremote.py", line 179, in pair
await self._perform_pairing(pairing)
File "/usr/lib/python3.8/site-packages/pyatv/scripts/atvremote.py", line 189, in _perform_pairing
await pairing.begin()
File "/usr/lib/python3.8/site-packages/pyatv/protocols/airplay/pairing.py", line 62, in begin
return await error_handler(
File "/usr/lib/python3.8/site-packages/pyatv/support/init.py", line 41, in error_handler
raise fallback(str(ex)) from ex
pyatv.exceptions.PairingError: HTTP/1.1 method POST failed with code 400: Bad Request`
Hello! For information, here is the problem I have juste after installing the node. I had to run NodeRed in safe mode and uninstall it to recover normal operation. Thanks for your work.
7 May 13:35:42 - [info] Node-RED version: v1.3.4
7 May 13:35:42 - [info] Node.js version: v12.20.0
7 May 13:35:42 - [info] Linux 5.4.79-v7+ arm LE
Hi, I've a Raspberrypi 4 whit docker and the Official Node-RED Docker container.
When I Exec to Docker as Root user, I get this error:
bash-5.0# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rust.sh && sh rust.sh -y && rm rust.sh && source $HOME/.cargo/env
info: downloading installer
curl: (22) The requested URL returned error: 404
rustup: installer for platform 'armv7-unknown-linux-musleabihf' not found, this may be unsupported
bash-5.0#
Any suggestion?
Thanks
Hey,
I’m using node red official docker image. When I try to pair my Apple TV 4K I’m getting just an error “ No devices retrieved, check your Apple TVs connection settings”. ATV is Running. I have no clue how to debug that.
Greetings
Is there a way of installing this to work with node-red on Windows?
sending "skipForward" msg.payload to Apple TV out node with pyatv backend. I get this error:
Error: Unsupported key value skip_forward!
When using the "VolumeUp" or "VolumeDown" commands, it returns an error -
Error: Unable to execute request 1L: /usr/local/lib/python3.8/dist-packages/pyatv/scripts/atvscript.py:313: DeprecationWarning: Call to deprecated function volume_down.
await getattr(atv.remote_control, args.command)()
Hi,
analogous to the recommended docker installation I installed pyatv in an exclusive proxmox container without any virtual environment. Node Red is running in a different container.
atvscript is in /usr/local/bin. What should I enter in the field path of the OUT configuration node?
Or do I have to install pyatv in the same container in which Nodered is running?
Thank you for any help1
Graefer
Hello,
is it possible to integrate the functions of getting a cover url from what is currently playing and setting the position directly with a value?
My Installation aborts with following mesage
Node Red V2.1.4 on FreeBSD 11
2022-01-15T20:12:18.892Z Install : node-red-contrib-apple-tv-x 0.5.2
2022-01-15T20:12:19.007Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict [email protected]
2022-01-15T20:12:21.792Z [err] npm
2022-01-15T20:12:21.792Z [err] ERR! code ENOENT
2022-01-15T20:12:21.793Z [err] npm ERR!
2022-01-15T20:12:21.793Z [err] syscall spawn git
2022-01-15T20:12:21.793Z [err] npm ERR!
2022-01-15T20:12:21.793Z [err] path git
2022-01-15T20:12:21.793Z [err] npm ERR! errno
2022-01-15T20:12:21.793Z [err] -2
2022-01-15T20:12:21.795Z [err] npm
2022-01-15T20:12:21.795Z [err] ERR! enoent Error while executing:
2022-01-15T20:12:21.795Z [err] npm ERR! enoent
2022-01-15T20:12:21.795Z [err] undefined ls-remote -h -t ssh://[email protected]/ikhilko/node-appletv-x.git
2022-01-15T20:12:21.795Z [err] npm ERR! enoent
2022-01-15T20:12:21.795Z [err] npm ERR! enoent
2022-01-15T20:12:21.795Z [err] npm ERR! enoent spawn git ENOENT
2022-01-15T20:12:21.795Z [err] npm
2022-01-15T20:12:21.795Z [err] ERR! enoent This is related to npm not being able to find a file.
2022-01-15T20:12:21.795Z [err] npm ERR! enoent
2022-01-15T20:12:21.800Z [err]
2022-01-15T20:12:21.800Z [err] npm
2022-01-15T20:12:21.800Z [err] ERR! A complete log of this run can be found in:
2022-01-15T20:12:21.800Z [err] npm ERR!
2022-01-15T20:12:21.800Z [err] /root/.npm/_logs/2022-01-15T20_12_21_796Z-debug.log
2022-01-15T20:12:21.815Z rc=254
Following the RFE to allow IPs/IDs to be manually specified #9 , the launch_app parameter no longer works (but same worked in 0.5.0):
when sending msg.payload
set to launch_app=com.netflix.Netflix
debug output
Error: Command failed: atvremote --airplay-credentials abcdefghijklmnopqrstuvwxyz launch_app=com.netflix.Netflix
Scan Results
[...]
From the debug message, it would appear that the command isn't passing the actual device.
Sending a simple command, like "play" and "pause" continues to work fine.
Node configs (to reproduce)
Injection Node:
[{"id":"bd7c8d34.dc5d38","type":"inject","z":"c45155cd.0e34c8","name":"Launch Netflix","topic":"","payload":"launch_app=com.netflix.Netflix","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":550,"y":1040,"wires":[["caa4d47d.366338"]]}]
ATV Out:
[{"id":"caa4d47d.366338","type":"atvx-out","z":"c45155cd.0e34c8","name":"","atvx":"e7158f3.0ee17f","skip_deprecated":false,"x":750,"y":1300,"wires":[]},{"id":"e7158f3.0ee17f","type":"atvx-config","z":"","name":"Big Screen (manual)","backend":"pyatv","companion":"684aea51228e5c7b68064b148e34471af6736937f831b6795c3751592cf048fe:add0564b0387070eb9796c559797ec5a82d5f0ed16d3914b971ae9ef61cf6fc9:32353041323034422d343136352d344233412d394430362d363042363345443943453430:64373132643230312d623063642d343363332d386334372d393163633465646335373162","debug":true}]
ATV In:
[{"id":"66b3dfa3.5298e","type":"atvx-in","z":"c45155cd.0e34c8","name":"New ATV","atvx":"e7158f3.0ee17f","x":190,"y":1300,"wires":[["caa4d47d.366338"]]},{"id":"e7158f3.0ee17f","type":"atvx-config","z":"","name":"Big Screen (manual)","backend":"pyatv","companion":"684aea51228e5c7b68064b148e34471af6736937f831b6795c3751592cf048fe:add0564b0387070eb9796c559797ec5a82d5f0ed16d3914b971ae9ef61cf6fc9:32353041323034422d343136352d344233412d394430362d363042363345443943453430:64373132643230312d623063642d343363332d386334372d393163633465646335373162","debug":true}]
Great node! Thank you! Finally, something that works in Node Red and no need to use HomeAssistant to get ATV status.
However, I have a request, in HA ATV integration can distinguish between play, pause or idle. It would be great to have this here as well. Idle and playing is implemented already (with isPlaying being true or false), but paused is not.
And in my view it rather important since I e.g do not want to turn on the lights full for a short break but only if I stopped the movie, or when it's totally finished.
Hello,
I'm running node red via I-broker Adapter v3.3.1 and after installing the apple-tv-x node I'm getting this error message in the log
Exception-Code: ENOTDIR: spawn ENOTDIR
Error: spawn ENOTDIR at ChildProcess.spawn (node:internal/child_process:413:11) at spawn (node:child_process:713:9) at execute (/usr/local/iobroker/iobroker-data/node-red/node_modules/@sebbo2002/node-pyatv/dist/lib/tools.js:69:19) at NodePyATVDeviceEvents.startListening (/usr/local/iobroker/iobroker-data/node-red/node_modules/@sebbo2002/node-pyatv/dist/lib/device-events.js:106:42) at NodePyATVDeviceEvents.checkListener (/usr/local/iobroker/iobroker-data/node-red/node_modules/@sebbo2002/node-pyatv/dist/lib/device-events.js:87:18) at NodePyATVDeviceEvents.on (/usr/local/iobroker/iobroker-data/node-red/node_modules/@sebbo2002/node-pyatv/dist/lib/device-events.js:195:14) at NodePyATVDevice.on (/usr/local/iobroker/iobroker-data/node-red/node_modules/@sebbo2002/node-pyatv/dist/lib/device.js:629:21) at Timeout.ATVxConfig.node.doConnectCli [as _onTimeout] (/usr/local/iobroker/iobroker-data/node-red/node_modules/node-red-contrib-apple-tv-x/nodes/config.js:60:20) at listOnTimeout (node:internal/timers:559:17) at processTimers (node:internal/timers:502:7)
unhandled promise rejection: spawn ENOTDIR
Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
18 Dec 09:46:28 - [error] [atvx-config:Wohnzimmer] Error: spawn /usr/local/bin/python/atvscript ENOENT at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19) at onErrorNT (node:internal/child_process:478:16) at processTicksAndRejections (node:internal/process/task_queues:83:21) at runNextTicks (node:internal/process/task_queues:65:3) at listOnTimeout (node:internal/timers:528:9) at processTimers (node:internal/timers:502:7)
which python3 via terminal gives back
/Library/Frameworks/Python.framework/Versions/3.11/bin/python3
Macmini macOS Mojave 10.14.6
8GB Ram
2,6 GHz Intel Core i5
Any help is appreciated - many thanks in advance...!
Regards..
Hi,
I’m using node red official docker image. When I try to pair my Apple TV 4K I’m getting just an error “ No devices retrieved, check your Apple TVs connection settings”. ATV is Running.
I am using below command
sudo docker run -it --net=host -v node_red_data:/data --name nodered5 nodered/node-red
still not able to recognise
My Apple TV shows up in the list but when I click Initiate Connection, nothing appears on the Apple TV so I can't go any further.
Any help appreciated.
tvOS 15.0
Hi @twocolors ,
is it possible to get the atv status also?
If i install this on my homebridge i get status of the atv over motion sensor. So if i wake up my atv by the remote control or by my iphone, the status switch from off to on.
Right now i installed this on my Node-Red Server and can catch up the paused or playing status. So the problem is, that if i wake up my atv it does not regognize is until i switch to an App and let this play something. So the service works a little drifferent from the homebridge plugin.
It would be great to get a status if the atv is in sleep mode, so the tv is off (by HDMI-CEC) or the atv is awake and wait for an app to start and the tv is on (by HDMI-CEC)
I found the "powerState", but most of the time i get back an "null" status. Sometimes i could catch an "on" status.
Don't know why, but if i put a debug node behind, push on Deploy and i get a lot of payloads at one moment.
Thank you for your work
Can the reboot command that you can get by long-pressing menu and home on the apple remote be added?
Would be really useful! Many thanks!
Due to networking issues, the pyatv scan isn't finding all my devices, but it can see them when specifying the IP address.
When creating a note in the atvs-config node panel, one is limited to what the scan turns up.
I'd like a way to be able to manually specify an IP address.
Hi
I just installed the node and the pyatv on my raspberry.
My Raspberry and Apple TV is on different LANs but the lan allows crostalk.
This:
$ atvremote --id 00:11:22:33:44:54 --protocol companion pair
$ atvremote --id 00:11:22:33:44:54 --protocol airplay pair
Doesn't work.
I just get:
2022-04-23 20:30:45 ERROR [pyatv.scripts.atvremote]: Could not find any Apple TV on current network
Searching in the node finds the Apple TV, but when I try to inject any payload I just get this:
Error: Got pyatv Error: power_state is not supported
pyatv Stacktrace:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pyatv/scripts/atvscript.py", line 302, in appstart
print(args.output(await _handle_command(args, abort_sem, loop)), flush=True)
File "/usr/local/lib/python3.7/dist-packages/pyatv/scripts/atvscript.py", line 198, in _handle_command
return await _run_command(atv, args, abort_sem, loop)
File "/usr/local/lib/python3.7/dist-packages/pyatv/scripts/atvscript.py", line 218, in _run_command
output(True, values={"power_state": atv.power.power_state.name.lower()})
File "/usr/local/lib/python3.7/dist-packages/pyatv/support/shield.py", line 72, in _guard_method
return func(self, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/pyatv/core/facade.py", line 338, in power_state
return self.relay("power_state")
File "/usr/local/lib/python3.7/dist-packages/pyatv/core/relayer.py", line 91, in relay
target, chain(self._takeover_protocol, priority or self._priorities)
File "/usr/local/lib/python3.7/dist-packages/pyatv/core/relayer.py", line 114, in _find_instance
raise exceptions.NotSupportedError(f"{target} is not supported")
pyatv.exceptions.NotSupportedError: power_state is not supported
What am I missing?
Hey there. Great node, simple to use, however i am having issues with the "up" command, and only that command. All other inputs work as expected. Have you experienced this behavior previously?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.