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

lamarzocco Integration: Setup fail with http error 400 #131180

Open
martingruening opened this issue Nov 21, 2024 · 11 comments
Open

lamarzocco Integration: Setup fail with http error 400 #131180

martingruening opened this issue Nov 21, 2024 · 11 comments

Comments

@martingruening
Copy link

The problem

Steps to reproduce:

  • Add La Marzocco Integration
  • Enter username/password (same as in app / checked before that it works in app)
  • Machine with serial number is shown, no IP address entered
  • Click on ok

Resultat: integration is not working, reporting in the UI "Request to endpoint https://cms.lamarzocco.io/oauth/v2/token failed with status code 400"

Strangely, afterwards the login in the app is not working anymore. Seems like the account has been locked. Password change is then the only way to get it going again.

What version of Home Assistant Core has the issue?

core-2024.11.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

lamarzocco

Link to integration documentation on our website

https://www.home-assistant.io/integrations/lamarzocco

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Debug log:
`2024-11-21 12:35:59.156 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Request to endpoint https://cms.lamarzocco.io/oauth/v2/token failed with status code 400
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/lamarzocco/coordinator.py", line 127, in _async_handle_request
    await func(*args, **kwargs)
  File "/usr/local/lib/python3.12/site-packages/lmcloud/lm_device.py", line 132, in get_config
    raw_config = await self._cloud_client.get_config(self.serial_number)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/lmcloud/client_cloud.py", line 166, in get_config
    return await self._rest_api_call(url=url, method=HTTPMethod.GET)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/lmcloud/client_cloud.py", line 118, in _rest_api_call
    access_token = await self.async_get_access_token()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/lmcloud/client_cloud.py", line 58, in async_get_access_token
    return await self._async_get_access_token()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/lmcloud/client_cloud.py", line 72, in _async_get_access_token
    return await self.__async_get_token(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/lmcloud/client_cloud.py", line 105, in __async_get_token
    raise RequestNotSuccessful(
lmcloud.exceptions.RequestNotSuccessful: Request to endpoint https://cms.lamarzocco.io/oauth/v2/token failed with status code 400`

Additional information

La Marzocco Linea Micra

@home-assistant
Copy link

Hey there @zweckj, mind taking a look at this issue as it has been labeled with an integration (lamarzocco) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of lamarzocco can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign lamarzocco Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


lamarzocco documentation
lamarzocco source
(message by IssueLinks)

@zweckj
Copy link
Contributor

zweckj commented Nov 21, 2024

@martingruening Can you please try what happens if you enter an IP address?

@martingruening
Copy link
Author

martingruening commented Nov 21, 2024 via email

@zweckj
Copy link
Contributor

zweckj commented Nov 21, 2024

that's weird. it should log something on error level in this case (coming from lmcloud)

@martingruening
Copy link
Author

martingruening commented Nov 21, 2024 via email

@zweckj
Copy link
Contributor

zweckj commented Nov 21, 2024

Hm. I'm a bit clueless tbh. I don't have any of those issues. You're machine is correctly added to your account in the app?

@martingruening
Copy link
Author

martingruening commented Nov 21, 2024 via email

@zweckj
Copy link
Contributor

zweckj commented Nov 21, 2024

Oh no wait. For that 403 I got an idea. Try to setup the integration with local IP again, but only after you connected (successfully) to it with the official app. Wait a bit between the official app login and integration setup.

@martingruening
Copy link
Author

martingruening commented Nov 22, 2024

I restarted the app, connected to the machine, switched on the boiler, waited for some time (3 minutes) and then retried the integration setup. Same result with error codes 400 and 403.

My HA instance and the Linea Micra are on different subnets with a router/firewall in between. The firewall rules have been checked multiple times. The Micra can connect to anything via TCP. The HA instance is allowed to connect to port 8081 on the Micra via TCP. My mobile is on a third subnet and has appropriate firewall rules. I can see those connections to port 8081 happening from HA and my mobile phone. I see no blocked connections to/from the Micra IP address. So that should not be the issue, right?

Gateway Firmware is v3.6-RC4 and machine firmware is 1.17

@zweckj
Copy link
Contributor

zweckj commented Nov 22, 2024

It sure sounds like. What I don't understand is why you are the first one having those issues and it seems to be working fine for everybody else (including me).

Bit of technical background: The local 403 is sometimes happening if the local API is stilled locked, which needs a cloud command after machine restart to be unlocked, which the integration currently doesn't give on setup, but that also shouldn't be an issue if you have connected with the app before...

For the cloud block I'm wondering whether they started blocking consecutive login attempts (the integration does setup in cloud only mode but then fail right?), but again why only you then?

@martingruening
Copy link
Author

martingruening commented Nov 22, 2024

I agree - impacting only me is strange. My machine and my account are fairly new (3 days old). Maybe they have changed API settings, but keep compability for older accounts (would seem weird).

http 400 means:
Bad Request: The request was malformed or invalid. Check the syntax and parameters of the request.

So a http 400 in request for the oauth token could mean they have changed authentication somehow for newer user accounts. A check for that would be somebody that has a working setup deleting the old user account and creating a fresh one.

Edit:
I will try to debug the request to https://cms.lamarzocco.io/oauth/v2/token myself. Is the client_id and client_secret the one reported here: https://github.com/rccoleman/lamarzocco or do I have to use mitmproxy to retrieve them for my individual account?

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

No branches or pull requests

2 participants