Alllllmost there...

Posted on
Wed Apr 21, 2021 11:39 am
jltnol offline
Posts: 998
Joined: Oct 15, 2013

Alllllmost there...

Thru a bunch of fits and starts, I'm inching closer to getting this to work. Scanning for Devices returns all of the AppleTV devices, both hardware and software. Once scanned, the data is being correctly updated in the Device. So far, so good. However I am unable to actually control the device at all. The ATV hardware is just not responding.

Pretty sure I've installed all the right pieces... Xcode, Python 3, and the special ATV stuff, but just doesn't seem to be working. I haven't edited any of the devices info.. including the overwrite PIN number which is set to the default 1234.

Any ideas or Suggestions?

Posted on
Wed Apr 21, 2021 1:04 pm
kw123 offline
User avatar
Posts: 8392
Joined: May 12, 2013
Location: Dallas, TX

Re: Alllllmost there...

jltnol wrote:
Thru a bunch of fits and starts, I'm inching closer to getting this to work. Scanning for Devices returns all of the AppleTV devices, both hardware and software. Once scanned, the data is being correctly updated in the Device. So far, so good. However I am unable to actually control the device at all. The ATV hardware is just not responding.

Pretty sure I've installed all the right pieces... Xcode, Python 3, and the special ATV stuff, but just doesn't seem to be working. I haven't edited any of the devices info.. including the overwrite PIN number which is set to the default 1234.

Any ideas or Suggestions?
Can you switch on debug?

Sent from my iPhone using Tapatalk

Posted on
Wed Apr 21, 2021 3:53 pm
jltnol offline
Posts: 998
Joined: Oct 15, 2013

Re: Alllllmost there...

So not sure if this is all the info you need. I see nothing in the regular Indigo Log, so found the log in the Libray/ indigo... folder. In plugin config, I checked Threats for listing... Action commandos... Basic... Special debug for development. Let me know if you need others checked.

The plugin did find 3 other devices... one if which is an older ATV, and 2 that are computes, which may explain some of the error messages.

I deleted today's log, then re-started the plug in, then issued a simple toggle command Action Group for the ATV that shows up as Playing. The plugin is populating the indigo device with the right info...

Here's what in the log:
Code: Select all
21 16:43:46 logger  enabled for     THREADDEBUG    ==> TEST ONLY
21 16:43:46 logger  enabled for     DEBUG          ==> TEST ONLY
21 16:43:46 logger  enabled for     INFO           ==> TEST ONLY
21 16:43:46 logger  enabled for     WARNING        ==> TEST ONLY
2021-04-21 16:43:46.974   ERROR          Plugin.__init__                  logger  enabled for     ERROR          ==> TEST ONLY
2021-04-21 16:43:46.974   CRITICAL       Plugin.__init__                  logger  enabled for     CRITICAL       ==> TEST ONLY
21 16:43:46 path To python3                /usr/local/bin/python3
21 16:43:46 check for new devices every    10 minutes
21 16:43:47  start   runConcurrentThread, initialized loop settings
21 16:43:47 in loop #1
21 16:43:53 === listenToDevices  ip:192.168.5.102, (re)starting listener w cmd:[u'/usr/local/bin/python3', '/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py', '-s', u'192.168.5.102', 'push_updates']
21 16:43:53 === listenToDevices  ip:192.168.5.102, (re)started listener
21 16:43:53 === listenToDevices  ip:192.168.5.102, newlines:{"result": "failure", "datetime": "2021-04-21T16:43:53.783118-05:00", "exception": "no service to connect to", "stacktrace": "Traceback (most recent call last):\n  File \"/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py\", line 310, in appstart\n    print(args.output(await _handle_command(args, abort_sem, loop)), flush=True)\n  File \"/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py\", line 195, in _handle_command\n    atv = await connect(config, loop, protocol=Protocol.MRP)\n  File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/__init__.py\", line 63, in connect\n    service = config.main_service(protocol=protocol)\n  File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/conf.py\", line 112, in main_service\n    raise exceptions.NoServiceError(\"no service to connect to\")\npyatv.exceptions.NoServiceError: no service to connect to\n"}

21 16:43:53 === listenToDevices  ip:192.168.5.121, (re)starting listener w cmd:[u'/usr/local/bin/python3', '/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py', '-s', u'192.168.5.121', 'push_updates']
21 16:43:53 === listenToDevices  ip:192.168.5.121, (re)started listener
21 16:43:54 === listenToDevices  ip:192.168.5.121, newlines:{"result": "failure", "datetime": "2021-04-21T16:43:54.305902-05:00", "exception": "no service to connect to", "stacktrace": "Traceback (most recent call last):\n  File \"/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py\", line 310, in appstart\n    print(args.output(await _handle_command(args, abort_sem, loop)), flush=True)\n  File \"/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py\", line 195, in _handle_command\n    atv = await connect(config, loop, protocol=Protocol.MRP)\n  File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/__init__.py\", line 63, in connect\n    service = config.main_service(protocol=protocol)\n  File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/conf.py\", line 112, in main_service\n    raise exceptions.NoServiceError(\"no service to connect to\")\npyatv.exceptions.NoServiceError: no service to connect to\n"}

21 16:43:54 === listenToDevices  ip:192.168.5.13, (re)starting listener w cmd:[u'/usr/local/bin/python3', '/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py', '-s', u'192.168.5.13', 'push_updates']
21 16:43:54 === listenToDevices  ip:192.168.5.13, (re)started listener
21 16:43:54 === listenToDevices  ip:192.168.5.134, (re)starting listener w cmd:[u'/usr/local/bin/python3', '/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py', '-s', u'192.168.5.134', 'push_updates']
21 16:43:54 === listenToDevices  ip:192.168.5.134, (re)started listener
21 16:43:55 === listenToDevices  ip:192.168.5.134, newlines:{"result": "success", "datetime": "2021-04-21T16:43:55.346936-05:00", "power_state": "on"}
{"result": "success", "datetime": "2021-04-21T16:43:55.347795-05:00", "hash": "com.apple.avkit.7536.d9cf6e71", "media_type": "video", "device_state": "playing", "title": "Take Your Pills", "artist": null, "album": null, "genre": null, "total_time": 5263, "position": 149, "shuffle": "off", "repeat": "off", "app": "Netflix", "app_id": "com.netflix.Netflix"}

21 16:44:00 === listenToDevices  ip:192.168.5.13, newlines:{"result": "failure", "datetime": "2021-04-21T16:43:59.812978-05:00", "error": "device_not_found"}

21 16:44:00 === listenToDevices  ip:192.168.5.13, connection lost:{"result": "failure", "datetime": "2021-04-21T16:43:59.812978-05:00", "error": "device_not_found"}

21 16:44:02 execCommandToAppleTVCALLBACK command:[u'/usr/local/bin/python3', '/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvremote.py', '-i', u'', u'play_pause']
21 16:44:04 in loop #2
21 16:44:05 === listenToDevices  ip:192.168.5.13, (re)starting listener w cmd:[u'/usr/local/bin/python3', '/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py', '-s', u'192.168.5.13', 'push_updates']
21 16:44:05 === listenToDevices  ip:192.168.5.13, (re)started listener
21 16:44:05 === listenToDevices  ip:192.168.5.13, newlines:{"result": "failure", "datetime": "2021-04-21T16:44:05.453897-05:00", "exception": "no service to connect to", "stacktrace": "Traceback (most recent call last):\n  File \"/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py\", line 310, in appstart\n    print(args.output(await _handle_command(args, abort_sem, loop)), flush=True)\n  File \"/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py\", line 195, in _handle_command\n    atv = await connect(config, loop, protocol=Protocol.MRP)\n  File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/__init__.py\", line 63, in connect\n    service = config.main_service(protocol=protocol)\n  File \"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyatv/conf.py\", line 112, in main_service\n    raise exceptions.NoServiceError(\"no service to connect to\")\npyatv.exceptions.NoServiceError: no service to connect to\n"}

21 16:44:14 in loop #3



As always, thanks for taking the time to look into this.

Posted on
Wed Apr 21, 2021 4:31 pm
kw123 offline
User avatar
Posts: 8392
Joined: May 12, 2013
Location: Dallas, TX

Re: Alllllmost there...

How many Apple TV devices do you have?

you can exclude ip numbers from being scanned (eg the .13) in plugin / menu

Karl

Posted on
Wed Apr 21, 2021 8:23 pm
jltnol offline
Posts: 998
Joined: Oct 15, 2013

Re: Alllllmost there...

I really only have 2 real Apple TV devices... one at 192.168.5 134 and one a 192.168.5. 13. Will work to exclude the others.

Posted on
Wed Apr 21, 2021 8:26 pm
kw123 offline
User avatar
Posts: 8392
Joined: May 12, 2013
Location: Dallas, TX

Re: Alllllmost there...

Can you power cycle the .13 Apple TV. ?


Sent from my iPhone using Tapatalk

Posted on
Thu Apr 22, 2021 5:15 pm
jltnol offline
Posts: 998
Joined: Oct 15, 2013

Re: Alllllmost there...

I power cycled the .13 device, had it playing, but the device still shows as device not found. I do find it curious that it found the 2nd AppleTV and created a "Device" with the right IP address, but now "device_not_found".

Posted on
Thu Apr 22, 2021 5:23 pm
kw123 offline
User avatar
Posts: 8392
Joined: May 12, 2013
Location: Dallas, TX

Re: Alllllmost there...

Could you delete dev .13. Then switch on debug and then scan for new devices.
And post plugin.log


Sent from my iPhone using Tapatalk

Posted on
Thu Apr 22, 2021 6:19 pm
kw123 offline
User avatar
Posts: 8392
Joined: May 12, 2013
Location: Dallas, TX

Alllllmost there...

Also is the network slower to the .13? May be there is a time out?


Sent from my iPhone using Tapatalk

Posted on
Thu Apr 22, 2021 9:28 pm
kw123 offline
User avatar
Posts: 8392
Joined: May 12, 2013
Location: Dallas, TX

Re: Alllllmost there...

could you also:
1. open terminal
2. paste:
Code: Select all
python3 '/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py' -s 192.168.5.13 push_updates
(you don't need the path to python when you open a terminal session. python3 should be in PATH)
then change channel on tv switch on / off ... you should see some output like:
Code: Select all
 python3 '/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py' -s 192.168.5.13 push_updates
{"result": "success", "datetime": "2021-04-22T22:25:38.045732-05:00", "power_state": "off"}
{"result": "success", "datetime": "2021-04-22T22:25:38.046832-05:00", "hash": "F2550E9C-9937-46A7-8EF2-C9A06411AA7B", "media_type": "unknown", "device_state": "paused", "title": "CBS 11 News at 10PM", "artist": "CBS 11", "album": null, "genre": null, "total_time": 50400, "position": 47153, "shuffle": "off", "repeat": "off", "app": null, "app_id": "com.google.ios.youtubeunplugged"}
/Library/Application Support/Perceptive Automation/Indigo 7.5/Plugins/appleTV.indigoPlugin/Contents/Server Plugin/atvscript.py:97: DeprecationWarning: The explicit passing of coroutine objects to asyncio.wait() is deprecated since Python 3.8, and scheduled for removal in Python 3.11.
  await asyncio.wait(
{"result": "success", "datetime": "2021-04-22T22:26:05.956418-05:00", "power_state": "on"}
{"result": "success", "datetime": "2021-04-22T22:26:11.035532-05:00", "hash": "E930F477-C54B-49DD-96E9-D08BC8CBB834", "media_type": "unknown", "device_state": "paused", "title": "CBS 11 News at 10PM", "artist": "CBS 11", "album": null, "genre": null, "total_time": 50400, "position": 47153, "shuffle": "off", "repeat": "off", "app": null, "app_id": "com.google.ios.youtubeunplugged"}
{"result": "success", "datetime": "2021-04-22T22:26:11.051205-05:00", "hash": "E930F477-C54B-49DD-96E9-D08BC8CBB834", "media_type": "unknown", "device_state": "playing", "title": "CBS 11 News at 10PM", "artist": "CBS 11", "album": null, "genre": null, "total_time": 50400, "position": 47153, "shuffle": "off", "repeat": "off", "app": null, "app_id": "com.google.ios.youtubeunplugged"}

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests