I tried to modify the code a bit to make it work and I believe that I managed. One problem is that you are using MRP credentials, not the correct HSGID. It should be on the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX or 0xXXXXXXXXXXXXXXXX if you used the pair command. If you have home sharing enabled you can get the hsgid with atvremote scan though.
You get some additional debug logs if you stick this at the top somewhere:
import logging
logging.basicConfig(level=logging.DEBUG)
Would recommend that you check out the latest pre-release of 0.4.x as well. It has changed a lot, but it also contains support for tvOS and will come with new features (which 0.3.x will not get).
In manual mode, everything is controlled through the command line, but with a long delay.
Here is the kind of commands I'm sending. I'd like to do this through code and manage faster
atvremote --id 08:66:98:AC:10:36 --protocol mrp --mrp-credentials 6325deee7d2b44a5fd8664b346cb91d69c977e4e18916280580888dcb03ddff4:379805b69b983c9cc5b00f2f3664db8c778253402dd06fa587e71bd7ce387d4a:65373165323065662d393764332d343030622d613564392d653434376136656531353130:38643865316263322d396535342d343734302d623735392d623630316366626462656663 right
I don’t understand how exactly to use MRP in python code.
SeeTouch:Downloads seetouch$ atvremote --version
atvremote 0.4.0a13
By default a scan is performed to find the device (it is needed in order to find the unique identifier). I recommend that you utilize support for unicast scanning to speed this up. With atvremote you just specify -s <ip>. You can skip --protocol as well, atvremote will figure that one out.
I feel that I need better examples for this, but I recommend that you have a look at the documentation to get a better idea. Mainly:
https://postlund.github.io/pyatv//documentation/concepts/
https://postlund.github.io/pyatv//development/scan_pair_and_connect/
The other pages under Development are good to read as well. But give me a sec and I'll give you an example.
SeeTouch:Downloads seetouch$ atvremote scan
Name: Office AppleTV
Address: 10.0.1.2
Identifiers:
Here is a simple example that should work for you:
#!/usr/bin/python
import asyncio
import logging
import pyatv
from pyatv.const import Protocol
async def main(loop):
device_id = 'CD45B219-6639-4926-99FA-86D5FE919B22'
ip_address = '10.0.1.2
creds = '6325deee7d2b44a5fd8664b346cb91d69c977e4e18916280580888dcb03ddff4:379805b69b983c9cc5b00f2f3664db8c778253402dd06fa587e71bd7ce387d4a:65373165323065662d393764332d343030622d613564392d653434376136656531353130:38643865316263322d396535342d343734302d623735392d623630316366626462656663'
result = await pyatv.scan(loop, identifier=device_id, hosts=[ip_address])
if not result:
logging.error('device not found')
return
config = result[0]
config.set_credentials(Protocol.MRP, creds)
atv = await pyatv.connect(result[0], loop)
try:
await atv.remote_control.up()
finally:
await atv.close()
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
asyncio.get_event_loop().run_until_complete(
main(asyncio.get_event_loop()))
Thank you very much I'll try right now in my case
I'll send you feedback
Thank you very much for your help))) Now this is working. Tomorrow I'll try to make working build for normal use)))
Great 👍 Good luck!
Hello. Thanks one more for your help. I would like to ask about keyboard entry functional. Do you plan to make it?
Tomorrow I'll try to control nine of ATV's. Keep you in touch.
Yeah, keyboard support will be added at some point (#145). But I have other issue with higher priority and cannot give any timeframe on that for now.
Cool, that's a big test! Hope it works well for you! :+1:
Testing was finished with good controls for my client. Now the pyatv working on 50m super yacht in Monaco!!!)))
I have one question. How can I try a play/pause with one button without feedback?
That sounds pretty cool! 😎 Great work!
I'm not entirely sure what you mean? Do you want a button on a web page the triggers play/pause?
I have interface and send the http requests to the my server and don't uderstand how to make one commant for play/pause toggle. But right now this is ok.
Right, there is no such command yet. I have been thinking about adding it so I can support that in Home Assistant as well. I'll see if I can add it in the next few days or so.
Thank you!
Are you willing and able to also add support for the menu button and maybe even direction buttons?
@vandalon It is already supported via the remote entity.
@vandalon It is already supported via the remote entity.
That's awesome, thanks! is there also documentation on what buttons are supported with what names?
@vandalon The documentation is quite scarce at the moment. I will improve that when I write new documentation for Home Assistant. But in the meanwhile you can look at the RemoteControl Interface here:
Buttons are named exactly like the methods, e.g. up, left or menu. The set_-methods doesn't work this way though.
@5eeT0uc4 I have added play_pause in #484 now (not merged). Do you have any possibility to verify if it works before merging?
Hello
I could try on next week.
Thank you very much.
Отправлено с iPhone
3 марта 2020 г., в 10:45, Pierre Ståhl notifications@github.com
написал(а):
@5eeT0uc4 https://github.com/5eeT0uc4 I have added play_pause in #484
https://github.com/postlund/pyatv/pull/484 now (not merged). Do you have
any possibility to verify if it works before merging?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/postlund/pyatv/issues/426?email_source=notifications&email_token=AKETFZDOG4X5GEKYJQH4IF3RFSYSPA5CNFSM4KQR5K62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENSN3LA#issuecomment-593812908,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKETFZG5QZELCLWNTYAYTRLRFSYSPANCNFSM4KQR5K6Q
.
Hello. Sorry for delay. I checked on my AppleTV in my Office. Play_pause are working.
No worries! Great to have it ACK'ed 😄