AppleTV Plugin not finding any devices

Posted on
Sun Jun 06, 2021 11:13 am
danieljmorel offline
Posts: 42
Joined: Dec 11, 2016

AppleTV Plugin not finding any devices

I have followed the installation instruction from the appleTV plugin page,
=== you need to install
1. install x-code, in a terminal window
xcode-select —install
2. install python3 (do not use home-brew) if you don't have it on your mac
go to https://www.python.org/downloads/release/python-392/
and download the 64 bit installer and install (all point and click)
3. download /install pyatv, in a terminal window
pip3 install pyatv

In config you only need to set one parameter: the path to python3. It is set to "/usr/local/bin/python" by default. I have changed this to "/usr/bin/python" because I am running OS X 11.4.

When I have the plugin scan for devices it looks like it's working but nothing is found.
06 13:09:48 =========getscriptScan cmd:[u'/usr/bin/python', '/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py', 'scan']
06 13:09:48 =========getscriptScan out:('', ' File "/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py", line 37\n def playstatus_update(self, updater, playstatus: Playing) -> None:\n ^\nSyntaxError: invalid syntax\n')
06 13:09:48 =========getNewDevices scan result:{}
06 13:09:58 in loop #453
06 13:10:08 in loop #454
06 13:10:18 in loop #455
06 13:10:28 in loop #456
06 13:10:38 in loop #457
06 13:10:48 in loop #458
06 13:10:58 in loop #459
06 13:11:08 in loop #460
06 13:11:18 in loop #461
06 13:11:28 in loop #462
06 13:11:38 in loop #463
06 13:11:48 in loop #464
06 13:11:58 in loop #465
06 13:12:08 in loop #466
06 13:12:18 in loop #467
06 13:12:28 in loop #468
06 13:12:38 in loop #469

Posted on
Sun Jun 06, 2021 1:08 pm
danieljmorel offline
Posts: 42
Joined: Dec 11, 2016

Re: AppleTV Plugin not finding any devices

I think that the pip3 install pyatv is not installed in the correct directory. When I set the appletv configuration to /usr/bin/python3 I get the following in console log file:
06 14:55:45 =========getscriptScan cmd:[u'/usr/bin/python3', '/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py', 'scan']
06 14:55:46 =========getscriptScan out:('', 'Traceback (most recent call last):\n File "/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py", line 13, in <module>\n from pyatv import connect, const, scan\nModuleNotFoundError: No module named \'pyatv\'\n')
06 14:55:46 =========getNewDevices scan result:{}
06 14:55:56 in loop #124

When I look in the /usr/bin/ I see the following: There is no python3.9...
python
python-config
python2
python2.7
python2.7-config
python3
pythonw
pythonw2.7

When I run "which python3" in terminal, I get:
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
so when I change the appletv configuration to that directory I get:
06 15:08:19 =========getscriptScan cmd:[u'/Library/Frameworks/Python.framework/Versions/3.9/bin/python3', '/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py', 'scan']
06 15:08:19 =========getscriptScan out:('', 'Traceback (most recent call last):\n File "/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py", line 13, in <module>\n from pyatv import connect, const, scan\n File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/__init__.py", line 10, in <module>\n from pyatv import conf, exceptions, interface\n File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/conf.py", line 16, in <module>\n from pyatv.interface import BaseService, DeviceInfo\n File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/interface.py", line 37, in <module>\n from pyatv.support import net\n File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/support/net.py", line 10, in <module>\n import netifaces\nImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/netifaces.cpython-39-darwin.so, 2): no suitable image found. Did find:\n\t/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/netifaces.cpython-39-darwin.so: mach-o, but wrong architecture\n\t/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/netifaces.cpython-39-darwin.so: mach-o, but wrong architecture\n')
06 15:08:19 =========getNewDevices scan result:{}
06 15:08:30 in loop #199

Posted on
Sun Jun 06, 2021 1:44 pm
danieljmorel offline
Posts: 42
Joined: Dec 11, 2016

Re: AppleTV Plugin not finding any devices

When I enter "atvremote scan" in terminal all of my Apple TV's show up.

Posted on
Sun Jun 06, 2021 9:19 pm
kw123 offline
User avatar
Posts: 8381
Joined: May 12, 2013
Location: Dallas, TX

Re: AppleTV Plugin not finding any devices

could you try:
Code: Select all
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 /Library/Application Support/Perceptive\ Automation/Indigo\ 7.5/Plugins/appleTV.indigoPlugin/Contents/Server\ Plugin/atvscript.py scan
and post the output

Karl

Posted on
Mon Jun 07, 2021 11:56 am
danieljmorel offline
Posts: 42
Joined: Dec 11, 2016

Re: AppleTV Plugin not finding any devices

it says in the appletv configuration:
path to python3: Does Not Exist.

When I go to the finder and paste the link under Go/Go to Folder it just gives me a bonk and takes me to the recents folder.

Posted on
Mon Jun 07, 2021 12:00 pm
danieljmorel offline
Posts: 42
Joined: Dec 11, 2016

Re: AppleTV Plugin not finding any devices

Putting in just: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
Returns this:

07 13:59:05 =========getscriptScan cmd:[u'/Library/Frameworks/Python.framework/Versions/3.9/bin/python3', '/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py', 'scan']
07 13:59:05 =========getscriptScan out:('', 'Traceback (most recent call last):\n File "/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py", line 13, in <module>\n from pyatv import connect, const, scan\n File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/__init__.py", line 10, in <module>\n from pyatv import conf, exceptions, interface\n File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/conf.py", line 16, in <module>\n from pyatv.interface import BaseService, DeviceInfo\n File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/interface.py", line 37, in <module>\n from pyatv.support import net\n File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/support/net.py", line 10, in <module>\n import netifaces\nImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/netifaces.cpython-39-darwin.so, 2): no suitable image found. Did find:\n\t/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/netifaces.cpython-39-darwin.so: mach-o, but wrong architecture\n\t/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/netifaces.cpython-39-darwin.so: mach-o, but wrong architecture\n')
07 13:59:05 =========getNewDevices scan result:{}
07 13:59:15 in loop #8353

Posted on
Mon Jun 07, 2021 12:03 pm
danieljmorel offline
Posts: 42
Joined: Dec 11, 2016

Re: AppleTV Plugin not finding any devices

Plugging in this: /Library/Application Support/Perceptive\ Automation/Indigo\ 7.5/Plugins/appleTV.indigoPlugin/Contents/Server\ Plugin/atvscript.py scan

Brings this:
Jun 7, 2021 at 2:01:21 PM
appleTV Warning /Library/Application Support/Perceptive\ Automation/Indigo\ 7.5/Plugins/appleTV.indigoPlugin/Contents/Server\ Plugin/atvscript.py scan is not present on this mac, see logfile on how to install python3
appleTV
# =================== HELP for appleTV plugin===========================
## **credits**
This plugin is build on top of AVTpy by Postlund, see https://github.com/postlund/pyatv

## STEPS TO MAKE IT WORK
1. INSTALL X-CODE in a terminal window
xcode-select —install

2. INSTALL PYTHON3 - if you don't have it on your mac (do not use home-brew)
go to eg https://www.python.org/downloads/release/python-392/
and download the 64 bit installer and install (all point and click)

3. DOWNLOAD/INSTALL pyatv in a terminal window
pip3 install pyatv

path to python either /usr/local/bin/python3 for 10.14.x and earlier (w pip3 install)
or /usr/bin/python3 for 11.x and later)
Try 'which python3' in a terminal window to check for path on your MAC)

## WHAT DOES THE PLUGIN DO:
1. it scans the local network for apple TVs with atvscript.py scan
for each apple tv it finds it will create a correcponding indigo device
you can exclude ip numbers from being considered
2. then is lauchnes a listener for any change of channel, volume, dev state etc and populates the indigo dev states accordingly
3. every xx minutes it will rescan for new apple TVs - or you can manually scan in plugin/menu
4. you can send predefined commands selectable from a list in menu or action to the apple TVs
5. you can send free text commands in menu or action to the apple TVs, see below for list
6. you can set certain IP numbers to be ignored (in menu), change ip number / mac# of an apple device in device edit if that has changed
-- not yet implemented: play music / video on apple TV. That requires to sync a pin between the apple TV and the plugin

## Possible things that can go wrong:
dev state: 'Unclosed client session' or something like it
try to use iphone remote app to connect to the appleTV. If that does not work, a power cycle/restart of the appleTV should fix it

## AVAILABE COMMANDS IN MENU AND ACTION

### RREMOTE CONTROLL COMMANDS:
- down - Press key down
- home - Press key home
- home_hold - Hold key home
- left - Press key left
- menu - Press key menu
- next - Press key next
- pause - Press key play
- play - Press key play
- play_pause - Toggle between play and pause
- previous - Press key previous
- right - Press key right
- select - Press key select
- set_position - Seek in the current playing media
- set_repeat - Change repeat state
- set_shuffle - Change shuffle mode to on or off
- skip_backward - Skip backwards a time interval
- skip_forward - Skip forward a time interval
- stop - Press key stop
- suspend - Suspend the device
- top_menu - Go to main menu (long press menu)
- up - Press key up
- volume_down - Press key volume down
- volume_up - Press key volume up
- delay=xxxx - Sleep for a certain amount in milliseconds before next command eg when you send 2 or more commands

### POWER COMMANDS:
- power_state - Return device power state
- turn_off - Turn device off
- turn_on - Turn device on

### METADATA COMMANDS, PRINTED TO LOG
- app - Return information about current app playing something
- artwork - Return artwork for what is currently playing (or None)
- artwork_id - Return a unique identifier for current artwork
- device_id - Return a unique identifier for current device
- playing - Return what is currently playing

### PLAYING COMMANDS: - print result to log
- album - Album of the currently playing song
- artist - Artist of the currently playing song
- device_state - Device state, e.g. playing or paused
- genre - Genre of the currently playing song
- hash - Create a unique hash for what is currently playing
- media_type - Type of media is currently playing, e.g. video, music
- position - Position in the playing media (seconds)
- repeat - Repeat mode
- shuffle - If shuffle is enabled or not
- title - Title of the current media, e.g. movie or song name
- total_time - Total play time in seconds

### DEVICE COMMANDS:
- artwork_save - Download artwork and save it to artwork.png
- features - Print a list of all features and options

## NOT IMPLEMENTED YET, needs pairing --
### AirPlay commands:
- play_url - Play media from an URL on the device

## DETAILED logs are in
../Perceptive Automation/Indigo x.y/Logs/com.karlwachs.appleTV/plugin.log
===============================================================================

Posted on
Mon Jun 07, 2021 12:29 pm
kw123 offline
User avatar
Posts: 8381
Joined: May 12, 2013
Location: Dallas, TX

Re: AppleTV Plugin not finding any devices

I meant to a terminal - Not the plugin.


Sent from my iPhone using Tapatalk

Posted on
Mon Jun 07, 2021 6:50 pm
danieljmorel offline
Posts: 42
Joined: Dec 11, 2016

Re: AppleTV Plugin not finding any devices

This is what I get when run on terminal:

Last login: Mon Jun 7 20:47:01 on ttys000
djm@WorkOutNW ~ % /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 /Library/Application Support/Perceptive\ Automation/Indigo\ 7.5/Plugins/appleTV.indigoPlugin/Contents/Server\ Plugin/atvscript.py scan
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3: can't open file '/Library/Application': [Errno 2] No such file or directory
djm@WorkOutNW ~ %

Posted on
Mon Jun 07, 2021 7:14 pm
danieljmorel offline
Posts: 42
Joined: Dec 11, 2016

Re: AppleTV Plugin not finding any devices

So When I navigated to the atvscript.py in the directory you gave me, I attempted to open it with terminal. I received a message saying that the script was not from a trusted source. Change the security settings in my preferences and chose to "open it anyway". Here is what I got.

Last login: Mon Jun 7 20:48:21 on ttys000
/Library/Application\ Support/Perceptive\ Automation/Indigo\ 7.5/Plugins/appleTV.indigoPlugin/Contents/Server\ Plugin/atvscript.py ; exit;
djm@WorkOutNW ~ % /Library/Application\ Support/Perceptive\ Automation/Indigo\ 7.5/Plugins/appleTV.indigoPlugin/Contents/Server\ Plugin/atvscript.py ; exit;
zsh: killed
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...none found.

[Process completed]

Posted on
Mon Jun 07, 2021 7:17 pm
danieljmorel offline
Posts: 42
Joined: Dec 11, 2016

Re: AppleTV Plugin not finding any devices

I ran it again, pasting it into terminal and this is what I get now:

djm@WorkOutNW /library % /library % /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 /Library/Application Support/Perceptive\ Automation/Indigo\ 7.5/Plugins/appleTV.indigoPlugin/Contents/Server\ Plugin/atvscript.py scan
zsh: permission denied: /library
djm@WorkOutNW /library %

Posted on
Mon Jun 07, 2021 7:23 pm
danieljmorel offline
Posts: 42
Joined: Dec 11, 2016

Re: AppleTV Plugin not finding any devices

When I check my security preference I see:

macOS cannot verify the developer of “appleTV.indigoPlugin”. Are you sure you want to open it?
By opening this app, you will be overriding system security which can expose your computer and personal information to malware that may harm your Mac or compromise your privacy.

Safari downloaded this file on June 1, 2021.

I chose to open it and this is what came up in the terminal window:
Last login: Mon Jun 7 21:04:50 on ttys001
/Library/Application\ Support/Perceptive\ Automation/Indigo\ 7.5/Plugins/appleTV.indigoPlugin/Contents/Server\ Plugin/atvscript.py ; exit;
djm@WorkOutNW ~ % /Library/Application\ Support/Perceptive\ Automation/Indigo\ 7.5/Plugins/appleTV.indigoPlugin/Contents/Server\ Plugin/atvscript.py ; exit;
usage: atvscript.py [-h] [-i ID] [--protocol PROTOCOL] [-s SCAN_HOSTS]
[--output OUTPUT] [--debug]
[--dmap-credentials DMAP_CREDENTIALS]
[--mrp-credentials MRP_CREDENTIALS]
[--airplay-credentials AIRPLAY_CREDENTIALS]
command
atvscript.py: error: the following arguments are required: command
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

Posted on
Mon Jun 07, 2021 10:05 pm
kw123 offline
User avatar
Posts: 8381
Joined: May 12, 2013
Location: Dallas, TX

Re: AppleTV Plugin not finding any devices

The parameter scan is missing

Make sure that any “ “ (space) is escaped with a “\” in the paths ie the long part with
… indigo 7.5 …

But not between the arguments.


Sent from my iPhone using Tapatalk

Posted on
Mon Jun 07, 2021 11:11 pm
kw123 offline
User avatar
Posts: 8381
Joined: May 12, 2013
Location: Dallas, TX

Re: AppleTV Plugin not finding any devices

to be explicit:
Code: Select all
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 /Library/Application\ Support/Perceptive\ Automation/Indigo\ 7.5/Plugins/appleTV.indigoPlugin/Contents/Server\ Plugin/atvscript.py scan

Posted on
Tue Jun 08, 2021 6:27 am
danieljmorel offline
Posts: 42
Joined: Dec 11, 2016

Re: AppleTV Plugin not finding any devices

Thank you,
Here are the results:

djm@WorkOutNW ~ % /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 /Library/Application\ Support/Perceptive\ Automation/Indigo\ 7.5/Plugins/appleTV.indigoPlugin/Contents/Server\ Plugin/atvscript.py scan
{"result": "success", "datetime": "2021-06-08T08:25:47.476539-04:00", "devices": [{"name": "MultiMedia Room (7)", "address": "10.0.1.152", "identifier": "C47BB17E08BCF70A", "services": [{"protocol": "airplay", "port": 7000}, {"protocol": "dmap", "port": 3689}], "deep_sleep": false, "MAC": "60:03:08:D7:EC:8A", "device_info": "3 ATV SW 8.4.4"}, {"name": "Music Room", "address": "10.0.1.150", "identifier": "0F4FE39EDCC50AD9", "services": [{"protocol": "airplay", "port": 7000}, {"protocol": "dmap", "port": 3689}], "deep_sleep": false, "MAC": "58:1F:AA:FE:97:85", "device_info": "2 ATV SW"}, {"name": "Kitchen Apple TV", "address": "10.0.1.151", "identifier": "B40651F5ED6FD9C2", "services": [{"protocol": "airplay", "port": 7000}, {"protocol": "dmap", "port": 3689}], "deep_sleep": false, "MAC": "F4:F9:51:D2:C6:28", "device_info": "3 ATV SW 8.4.4"}]}
djm@WorkOutNW ~ %

Who is online

Users browsing this forum: No registered users and 1 guest