pyatv
pyatv copied to clipboard
push_updates with volume modifications (from lib or from other means) for homepods
What feature would you like?
receiving {"volume":20.5} in atvscript push_updates when the volume has been modified from any means (lib, +/- buttons on top, airplay, ...) on HomePods at least (i know volume management on apple tv is strange).
could be a part of the playing json or separated like power_state, as you wish
Describe the solution you'd like
each time the volume is changed, a line should appear in push_updates
Any other information to share?
no
2022-07-18 11:06:34 DEBUG [pyatv.auth.hap_channel]: Received data (Data=9a0062ee848be542ac812c780c0b4fcc99dd991c7e3cfc8dd2a37c277cc8434310c42c4d38be770a81b75242ad140f6352049b1d40cd483a4cd23e073d3f3433c8db628197d79d264acc2cbc8943e5cd70d057ba661bfe6c0a9f02e66ec625b3f2ce9e4f6a9d6b332ade662f026a3f01292ffea09c28682291dd48b69a2f154375e320848faa8cd03c687f614db0e7911561f4a8b2ee956cc84d5558ce0540f9b959bd7112659683be48bada)
2022-07-18 11:06:34 DEBUG [pyatv.protocols.airplay.mrp_connection]: << Receive: Protobuf: type: VOLUME_DID_CHANGE_MESSAGE
[volumeDidChangeMessage] {
volume: 0.34999996
outputDeviceUID: "04CEE8C5-5F08-4873-B962-D633D8CBBCA8"
}
uniqueIdentifier: "2C933AF9-9DF5-4458-841D-F538EBB0EDB4"
2022-07-18 11:06:34 DEBUG [pyatv.core.protocol]: Dispatching message with type 52 to <bound method MrpAudio._volume_did_change of <pyatv.protocols.mrp.MrpAudio object at 0x7f882757fdf0>>
2022-07-18 11:06:34 DEBUG [pyatv.auth.hap_channel]: Sending data (Encrypted=2000fd12762ec8a13764462f26859818a6728dcee6a7f943b7be49590f5e702cfb19b9ed19a7819ac115809c8924b8558d76)
2022-07-18 11:06:34 DEBUG [pyatv.protocols.mrp]: Volume changed to 35.0
2022-07-18 11:06:34 DEBUG [pyatv.core.protocol]: Dispatching message with type UpdatedState.Volume to <bound method RaopAudio._volume_changed of <pyatv.protocols.raop.RaopAudio object at 0x7f8827512430>>
2022-07-18 11:06:34 DEBUG [pyatv.protocols.raop]: Protocol MRP changed volume to 35.000000
2022-07-18 11:06:35 DEBUG [pyatv.core.protocol]: Sending periodic heartbeat 12 (AirPlay:192.168.1.163)
2022-07-18 11:06:35 DEBUG [pyatv.support.http]: Sending RTSP/1.0 message: b'POST /feedback RTSP/1.0\r\nUser-Agent: AirPlay/540.31\r\nCSeq: 15\r\nDACP-ID: 4294D8ECC8D2DD07\r\nActive-Remote: 810778196\r\nClient-Instance: 4294D8ECC8D2DD07\r\n\r\n'
2022-07-18 11:06:35 DEBUG [pyatv.support.http]: Received: b'RTSP/1.0 200 OK\r\nDate: Mon, 18 Jul 2022 09:06:35 GMT\r\nContent-Length: 55\r\nContent-Type: application/x-apple-binary-plist\r\nServer: AirTunes/615.12.1\r\nCSeq: 15\r\n\r\nbplist00\xd1\x01\x02Wstreams\xa0\x08\x0b\x13\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14'
2022-07-18 11:06:35 DEBUG [pyatv.support.http]: Got RTSP response: HttpResponse(protocol='RTSP', version='1.0', code=200, message='OK', headers={'date': 'Mon, 18 Jul 2022 09:06:35 GMT', 'content-length': '55', 'content-type': 'application/x-apple-binary-plist', 'server': 'AirTunes/615.12.1', 'cseq': '15'}, body=b'bplist00\xd1\x01\x02Wstreams\xa0\x08\x0b\x13\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14'):
I currently don't have an external interface for volume changes that I can use, would have to come up with something for that first.
i see you output that volume changed in mrp and raop, can't you put that message on atvscript/atvremote push_updates ?
atvscript
is an application built using pyatv
as a library. I can only use whatever the library exposes. The simplest solution is to extend the Playing interface, but that isn't very pretty. Second solution is to add a new listener interface to Audio
, which I guess is the correct solution at this time. My intention is however to replace listeners with a more flexible callback based system (#1301), but that's not ready yet. I've been refraining from adding more listeners as that means more breaking changes further down the road. But that might be a minor problem anyways... I can take a look at adding a new listener, it's not hard. Home Assistant would benefit from this as well.
yes, sadly my knowledge about the asyncio loop in python are not enough to code my own python daemon (i've followed your tutorial but i can't add my input calls from my system and all that to the asyncio ....
so i still depend on these "newbe" interfaces... but anyway that's a nice way from now ;) i spawn 2 processes by apple tv in nodejs and now it works fine ;) i just have to manage some crash and stuffs ;)
Since I would like this in Home Assistant, I've added a listener interface to Audio
in PR #1975.