theavey / roxbury

A class to control LG Music Flow speakers
Apache License 2.0
0 stars 0 forks source link

message format issue #1

Open kaohlive opened 4 years ago

kaohlive commented 4 years ago

Hi I am porting your python work to node.js

I am stuck at the point that I send messages encrypted and I get a response. When I decrypt the message it holds {"msg": "MSG_PARSING_ERROR"} If I messup the encryption I get different bad results (no result mostly). So I believe my encryption is working. The message I send is before encryption: {'msg': 'MUTE_SET', 'data': {'mute': true}}

So I hope you have more info somewhere on how these music flow devices work. This is a multiroom speaker (SJ9) and it might require additional data or something.

hope you can help.

theavey commented 4 years ago

Hey, I haven't looked at this in a little bit, but the message looks like the one I would be sending. Have you gotten other commands to work? If not, the syntax could just be totally different.

I got some of the syntax from the temescal package, some from Android Music Flow apps I found online, and some from capturing packets between my phone's app and the soundbar.

My (Python) method does work for setting mute for me, and if I send a message it doesn't understand, I also get "MSG_PARSING_ERROR". I also don't know much about node, but I would suppose it's possible that character encoding (ASCII vs. UTF-8, etc.) or padding or some other annoying implementation detail could be the issue.

theavey commented 4 years ago

@kaohlive, any update on this? If not, I plan to close this issue

kaohlive commented 4 years ago

no not really, but you do not need to keep it open surely. i have lots of trouble sniffing the messages since the app stops discovery when i put any type of sniffing in place. and since i use switches on the network i also cant detect it from lan attached devices.

Sent from Outlook Mobilehttps://aka.ms/blhgte


From: Thomas Heavey notifications@github.com Sent: Friday, May 15, 2020 10:49:22 PM To: theavey/roxbury roxbury@noreply.github.com Cc: kaohlive kaoh@kaoh.nl; Mention mention@noreply.github.com Subject: Re: [theavey/roxbury] message format issue (#1)

@kaohlivehttps://github.com/kaohlive, any update on this? If not, I plan to close this issue

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/theavey/roxbury/issues/1#issuecomment-629476616, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABYL6XM52LHXSQ6CCL7RIK3RRWTFFANCNFSM4L7THWXQ.

mafredri commented 3 years ago

@kaohlive the payload you're sending does look correct for Music Flow, so can't really say what's wrong there. If you want, you could try my project and see if it produces different results: https://github.com/mafredri/musicflow. I also have a folder with research (essentially packet captures), in case that would be of help.

It's also possible to use the protocol without encryption (e.g. mufloctl -key '' -iv '' -addr=...). (The header changes, 0x0 vs 0x10.)

PS. Not looking to plug my project, and it's not really finished either, just something I've been working on and off for a few years. So if @theavey wants the link removed that's totally fine 👍🏻. (It does compile to wasm btw, my idea was to make it a homebridge plugin at some point but haven't gotten around to it.)

theavey commented 3 years ago

Don't mind at all. I don't make anything off this, just wanted to be helpful posting my code.

Didn't realize you can do it unencrypted. I think I recall having tried that without success, but might have done it wrong.

I had thoughts to integrate with Home Assistant, but found my life was good enough without it so never got around to it.

mafredri commented 3 years ago

Heh, I discovered it by accident during setup packet capture and set out to figure out how it worked 😅. For unencrypted to work you'd still need the header, but other than that it follows the same principle. Could be that your unit doesn't support it, mayhaps?

In case you're interested in looking into it further:

https://github.com/theavey/roxbury/blob/5e6a043d20cfa0948270e1426e5aa9c9d702470f/roxbury/roxbury.py#L65

Here we'd use bytearray([0x00, 0x00, 0x00, 0x00, lengthOfJSON]) instead and write the plain-text JSON. By the way, the rest of the header can also be used for the length, for payloads larger than 255 we'd use bytes[1:5] to store the payload length as big endian.

I've actually been eyeing Home Assistant, would be cool if yours made it in 😎.

kaohlive commented 3 years ago

Thanks for those links. Same here, life is good without it, so I also have the project frozen right now. But its interesting to pick it up again to see if I can make something work.


From: Mathias Fredriksson @.> Sent: Monday, April 26, 2021 7:46 PM To: theavey/roxbury @.> Cc: kaohlive @.>; Mention @.> Subject: Re: [theavey/roxbury] message format issue (#1)

Heh, I discovered it by accident during setup packet capture and set out to figure out how it worked 😅. For unencrypted to work you'd still need the header, but other than that it follows the same principle. Could be that your unit doesn't support it, mayhaps?

In case you're interested in looking into it further:

https://github.com/theavey/roxbury/blob/5e6a043d20cfa0948270e1426e5aa9c9d702470f/roxbury/roxbury.py#L65

Here we'd use bytearray([0x00, 0x00, 0x00, 0x00, lengthOfJSON]) instead and write the plain-text JSON. By the way, the rest of the header can also be used for the length, for payloads larger than 255 we'd use bytes[1:5] to store the payload length as big endian.

I've actually been eyeing Home Assistant, would be cool if yours made it in 😎.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/theavey/roxbury/issues/1#issuecomment-827028154, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABYL6XME2Q6YYNETLV5QVQ3TKWRIHANCNFSM4L7THWXQ.