La Marzocco GS/3 & Linea Mini support

Hi All,

This is probably more a templating question than a LM specific issue, but I thought others might also like a similar notification when coffee machine is at temperature you’ve specified.

Thus far not working until my 10 minute timeout; I trigger an automation when the machine turns on and I’m trying to use a wait trigger to wait until boiler temp is >= target temp…any ideas getting the below working? Or any better solutions to the problem?

I think the issue is how I’m trying to get the state attribute and compare it’s value as greater than or equal to another attribute. All the state_attr examples I can find are more like a boolean is a value, like

is_state_attr(‘water_heater.linea_mini_coffee’, ‘93’)

Current automation yaml:

- id: '1636944805816'
  alias: Coffee Machine at Temp
  description: ''
  trigger:
  - platform: state
    entity_id: switch.linea_mini_main
    to: 'on'
  condition: []
  action:
  - wait_for_trigger:
    - platform: template
      value_template: '{{ is_state_attr(''water_heater.linea_mini_coffee >= water_heater.linea_mini_coffee.temperature'')
        }}'
    timeout: 00:10:00
  - service: notify.mobile_app_ken_s_pixel_5
    data:
      title: Espresso Ready
      message: Boiler has reached 93
  - service: tts.google_translate_say
    data:
      entity_id: media_player.kitchen_display
      message: Espresso Ready
  mode: parallel
  max: 10

There are several problems there. I recommend spending a bit of time reading this. This is more like what you want:

  - wait_for_trigger:
    - platform: template
      value_template: '{{ states("water_heater.linea_mini_coffee")|float >= state_attr("water_heater.linea_mini_coffee", "temperature")|float }}'
    timeout: "00:10:00"
1 Like

Thanks @rccoleman - Was able to get it to work with that and thanks for link to that doc. Have learned a few things about templating that I didn’t understand prior.

@rccoleman great work!

Whenever the pump is running, either for espresso or flushing, I get a constant stream of these:

Z (whoa)

I’m interested in this stream to build my own shot timer. I checked your lmdirect repo but couldn’t find out, how to get it (I can get communication running, get status and so on, but I’m no pro in this low level communcation). Is there a way to detect, whether the pump is running with your provided code?

The library currently only stays connected to do periodic polling and receive the responses, so it won’t reliably receive these unsolicited messages. It would need to stay connected all the time to see the whole Z sequence, and without that I don’t know how you’d get real time feedback and the pump starting and stopping.

Hi, when I try to configure the La Marzocco Expresso integration I get a “Unknown Error” message. I use the Client ID 4_2d2impykbv0g44oc88kogw000s8wgwwgws80ccowkcg0wk8o8w and Client Secret 1m52x65srmysk4owk0ww4ok84sw484ww0gsoo0kc0gs4gcwkko, plus my Username and Password. I have the Linea Mini. Running HA on a dedicated Raspberry Pi 4.

What does the HA log say?

hmm, I checked the logbook right after attempting to Configure just now, no entries. There are entries for a Fan, but not sure what that is about. BTW, I am very new to HA, HACS, etc. Thanks for the help!

The log, not the logbook. Configuration->Settings->Logs

Well, now you know the experience level you are dealing with!!

Error handling request

2:15:23 PM – (ERROR) La Marzocco (custom integration) - message first occurred at 1:49:51 PM and shows up 2 times

Detected integration that accessed discovery_info[‘properties’] instead of discovery_info.properties; this will fail in version 2022.6. Please report issue to the custom component author for lamarzocco using this method at custom_components/lamarzocco/config_flow.py, line 102: raw = discovery_info[“properties”]["_raw"]

1:48:26 PM – (WARNING) helpers/frame.py

Ended unfinished session (id=8 from 2022-01-29 18:14:52.248210)

1:48:06 PM – (WARNING) Recorder

The system could not validate that the sqlite3 database at //config/home-assistant_v2.db was shutdown cleanly

1:48:05 PM – (WARNING) Recorder

I know about that one, and it won’t cause the failure you’re describing. There should be more there, but I just recommend checking your credentials.

Sorry, credentials as in Username and Password in the La Marzocco dialog box, right? Yes, I was careful in typing in my Username and Password for HA. Just to be sure, I logged out of HA and logged back in with my user name and password.

The credentials when configuring the integration. Without additional logs, there’s not much more I can do. Have you used the official app to register your machine? Does that work?

Sorry, is this the additional logs info:

2022-01-29 19:49:26 ERROR (MainThread) [aiohttp.server] Error handling request

Traceback (most recent call last):

File “/usr/local/lib/python3.9/site-packages/lmdirect/connection.py”, line 90, in retrieve_machine_info

await client.fetch_token(

File “/usr/local/lib/python3.9/site-packages/authlib/integrations/httpx_client/oauth2_client.py”, line 131, in _fetch_token

return self.parse_response_token(resp.json())

File “/usr/local/lib/python3.9/site-packages/authlib/oauth2/client.py”, line 380, in parse_response_token

self.handle_error(error, description)

File “/usr/local/lib/python3.9/site-packages/authlib/integrations/httpx_client/oauth2_client.py”, line 80, in handle_error

raise OAuthError(error_type, error_description)

authlib.integrations.base_client.errors.OAuthError: invalid_grant: Invalid username and password combination

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File “/usr/local/lib/python3.9/site-packages/lmdirect/connection.py”, line 156, in _connect

self._machine_info = await self.retrieve_machine_info(

File “/usr/local/lib/python3.9/site-packages/lmdirect/connection.py”, line 97, in retrieve_machine_info

raise AuthFail(“Authorization failure”) from err

lmdirect.connection.AuthFail: Authorization failure

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File “/config/custom_components/lamarzocco/config_flow.py”, line 44, in validate_input

machine_info = await lm.connect()

File “/usr/local/lib/python3.9/site-packages/lmdirect/init.py”, line 123, in connect

return await self._connect()

File “/usr/local/lib/python3.9/site-packages/lmdirect/connection.py”, line 160, in _connect

raise ConnectionFail(

lmdirect.connection.ConnectionFail: Exception retrieving machine info: Authorization failure

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py”, line 435, in _handle_request

resp = await request_handler(request)

File “/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py”, line 504, in _handle

resp = await handler(request)

File “/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py”, line 117, in impl

return await handler(request)

File “/usr/src/homeassistant/homeassistant/components/http/security_filter.py”, line 60, in security_filter_middleware

return await handler(request)

File “/usr/src/homeassistant/homeassistant/components/http/forwarded.py”, line 98, in forwarded_middleware

return await handler(request)

File “/usr/src/homeassistant/homeassistant/components/http/request_context.py”, line 28, in request_context_middleware

return await handler(request)

File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 78, in ban_middleware

return await handler(request)

File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 181, in auth_middleware

return await handler(request)

File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 137, in handle

result = await result

File “/usr/src/homeassistant/homeassistant/components/config/config_entries.py”, line 157, in post

return await super().post(request, flow_id)

File “/usr/src/homeassistant/homeassistant/components/http/data_validator.py”, line 62, in wrapper

result = await method(view, request, *args, **kwargs)

File “/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py”, line 110, in post

result = await self._flow_mgr.async_configure(flow_id, data)

File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 252, in async_configure

result = await self._async_handle_step(flow, cur_step[“step_id”], user_input)

File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 325, in _async_handle_step

result: FlowResult = await getattr(flow, method)(user_input)

File “/config/custom_components/lamarzocco/config_flow.py”, line 135, in async_step_confirm

return await self._try_create_entry(data)

File “/config/custom_components/lamarzocco/config_flow.py”, line 67, in _try_create_entry

machine_info = await validate_input(self.hass, data)

File “/config/custom_components/lamarzocco/config_flow.py”, line 50, in validate_input

except LaMarzocco.AuthFail:

AttributeError: type object ‘LaMarzocco’ has no attribute ‘AuthFail’

Seems clear enough:

authlib.integrations.base_client.errors.OAuthError: invalid_grant: Invalid username and password combination

One last question I hope. How do I delete the La Marzocco integration in HA so I can start over? Thanks again for your time!

Same as with any integration:

But if it was never set up correctly, then it’s not there to delete and nothing to clean up. Removing the code via HACS or whatever method you used won’t help here.

Hi, still trying here. I reinstalled Home Assistant, installed and configured HACS. Found and downloaded the La Marzocco integration. Entered Client ID and Client Secret, Username and Password, same error of invalid username and password.

My question is: which username and password? Home Assistant, or GitHub?

Thanks again for your time.

Your La Marzocco account. Sign up using the official app.