Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A new way to read/write Aqara device resources #242

Open
stackia opened this issue Mar 22, 2024 · 3 comments
Open

A new way to read/write Aqara device resources #242

stackia opened this issue Mar 22, 2024 · 3 comments

Comments

@stackia
Copy link
Contributor

stackia commented Mar 22, 2024

Hi @niceboygithub , recently I found a new way to read/write gateway hubs by utilizing /tmp/miio_agent.socket.

There is a ha_agent process that actually act as an IPC message broker for all other processes (ha_master / ha_basis / ha_driven / ppcs / vidicon / etc.). ha_agent creates an unix seqpacket socket /tmp/miio_agent.socket that anyone can connect without authentication / encryption. So it's possible for us to write our own program to send/receive to/from /tmp/miio_agent.socket.

And luckily it's very easy to find the message format / available commands from the logs of ha_master / ha_driven / ha_lanbox.

I made a small utility (aqara-agent2mqtt) to expose the miio_agent.socket to MQTT. (Because I just have a patched G3, all these work are only tested on G3.)

With auto.control command, we can almost control everything, including IR ("8.0.2092": "{\"mode\":0,\"len\":311,\"ircode\":\"...\"}"), PTZ ("14.88.85": "{\"x\":0,\"y\":0}") and many non-zigbee resources that are previously not available in zigbee/send topic! By listening to auto.report, we can get real-time resources updates too.

We can even read/write/subscribe other unpatched gateways in the same LAN with lanbox.control command! (though LAN subscription works with some caveats)

I'm currently working on updating the HA integration to use these new capabilities.

Because I only have a G3, I probably need some hands to help test if that works on other devices.

@niceboygithub
Copy link
Owner

I know that.

@niceboygithub
Copy link
Owner

AlexxIT/openmiio_agent#5

@niceboygithub
Copy link
Owner

I have more interest in that to trigger an IR learn and get the learned IR code. Do you have any idea how to do it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants