Skip to main content

A Python implementation of the local La Marzocco API

Project description

lmdirect

Local API access to network-connected La Marzocco espresso machines

This is a prototype library for interacting with the local network API of a La Marzocco espresso machine. It's still in the beginning stages, but currently it's able to retrieve configuration and status information from the machine and turn it on/off. I've reverse-engineered this from decoding the network traffic between the mobile app and the machine, so it's incomplete, imperfect, and may have significant bugs. It works on my La Marzocco GS/3, but I can't guarantee that you'll have a similar experience with yours.

You take any and all risks from using this on your machine!

Preparation & Installation

Using this library is an advanced exercise. You'll need to do the following:

  • Find the client_id and client_secret for your machine by following these instructions.
  • You'll need the username & password that you used to register with La Marzocco when you set up remote access, and the username is most likely the email address that you used for registration.

Once you have the client ID, client secret, username, and passowrd, construct a file called config.json with these contents and put it in the directory along with test.py. filename and key are only required if you run parse.py.

{
    "filename": "dose_tea.json",
    "key": "long-key-string",
    "host": "ip_addr",
    "port": "1774",
    "client_id": "long_string",
    "client_secret": "another_long_string",
    "username": "email_address",
    "password": "password"
}

Running the test app

Now, run python test.py and you should get a prompt that looks like this:

1=Power <on/off>, 2=Status, 3=Coffee Temp <temp>, 4=Steam Temp <temp>, 5=PB <on/off>, 6=Auto on/off <0=global or day> <on/off>, 7=Dose <sec>, 8=Tea Dose <sec>, 8=PB times <on off>:

The app requests all status & config information every 20 seconds, so you should see the values change when the state of the machine changes.

The machine can only accept a single connection at a time, but the library keeps the connection open long enough only to send commands and receive the responses. Both the mobile app and this library will attempt to reconnect if the port is in use, but you may need to wait a bit while using the mobile app for it to try again.

API

The package's external API can be found in __init__.py. request_status() will automatically connect to the machine, retrieve lots of status and configuration information, and build a dict that can be retrieved by calling the current_status() API. Several properties are available for direct access and there's a set of services that allow the user to change machine settings. Users can register for a callback when new data is received.

Notes

The raw API is comprised of "read" messages that start with "R", "write" messages that start with "W", and "streaming" messages that start with "Z". Following the initial letter, all messages have a 16-bit address and 16-bit length followed by data to write or that was read. In essence, the API is just a peek/poke API into the memory space of the machine, and the machine updates the contents when changes are made on the machine and reacts to writes that occur.

The entire message is sent in ASCII-encoded hex, encrypted, base-64 encoded, and framed between "@" and "%" characters.

You can find an extensive set of interesting memory regions and their maps in msgs.py here: https://github.com/rccoleman/lmdirect/tree/master/lmdirect.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lmdirect-0.9.0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

lmdirect-0.9.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file lmdirect-0.9.0.tar.gz.

File metadata

  • Download URL: lmdirect-0.9.0.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.13

File hashes

Hashes for lmdirect-0.9.0.tar.gz
Algorithm Hash digest
SHA256 31f4122fbb863bcd6ddbb4abf314ec41f586e508832f90911da41c92c08d6026
MD5 f656d4d0bbea2054645a3f1b18c1c56e
BLAKE2b-256 a801c1f6ac7eef00cca50ae48016c2eb4f1ec6e432d50e147de3de5d75762947

See more details on using hashes here.

File details

Details for the file lmdirect-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: lmdirect-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.13

File hashes

Hashes for lmdirect-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90e550e79b0a88318e0f07a0f808d9017507de5cf21468659aca36c5b47a101b
MD5 f5da125af54992fc1cfcd1856d6dfaa4
BLAKE2b-256 cda6f0c66f1052abb6066fdde63e67e5214c0284a4c6ba921885a6160e282a7a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page