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

Closed
martingruening opened this issue Nov 21, 2024 · 37 comments · Fixed by #132016
Closed

lamarzocco Integration: Setup fail with http error 400 #131180

martingruening opened this issue Nov 21, 2024 · 37 comments · Fixed by #132016

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
Member

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
Member

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
Member

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
Member

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
Member

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?

@martingruening
Copy link
Author

martingruening commented Nov 22, 2024

I did this curl -d "@auth.txt" -X POST https://cms.lamarzocco.io/oauth/v2/token

auth.txt contains
grant_type=password&client_id=7_1xwei9rtkuckso44ks4o8s0c0oc4swowo00wgw0ogsok84kosg&client_secret=2mgjqpikbfuok8g4s44oo4gsw0ks44okk4kc4kkkko0c8soc8s&[email protected]&password=notmyrealpassword

Response is

{"error":"user_manually_disabled","error_description":"User was deactivated by admin edit"}

Afterwards I deleted the account in the app, created a new one ([email protected]), assigned the machine to it via the app. I first failed with the response {"error":"invalid_grant","error_description":"Invalid username and password combination"}. After replacing the + sign with the encoded version %2B it worked and I got an access token back.

{"access_token":"LONGTOKENHERE","expires_in":3600,"token_type":"bearer","scope":null,"refresh_token":"ANOTHERLONGTOKENHERE"}

So the problem with my account now seems to be solved. The integration still produces the same behaviour. There must be something different happening between my curl-command and the token request in lmcloud that makes the request fail. A nice first improvement could be to report the error_description back in HA when the token request fails.

@zweckj
Copy link
Member

zweckj commented Nov 22, 2024

{"error":"user_manually_disabled","error_description":"User was deactivated by admin edit"}

that's interesting. I'm trying to add a logout after each login, to avoid sending consecutive logins with #131240. But admin edit sounds wild.

@zweckj
Copy link
Member

zweckj commented Nov 22, 2024

Could be that it's just an encoding problem. If there's still a "+" in your username, the integration does not encode that.
Edit: Have you tried putting your username in encoded version in the integration setup?

@martingruening
Copy link
Author

martingruening commented Nov 22, 2024

Could be that it's just an encoding problem. If there's still a "+" in your username, the integration does not encode that.

A plus sign is valid in any email address, so the lmcloud client should encode that properly. When I use user%[email protected] as the user name in the integration, then the connection fails immediately. When I enter a plain + sign as part of the username I can proceed to the next step where I can select the machine, but then the integration still fails requesting an oauth token.

I have now switched my username to [email protected] to avoid any encoding problems. I immediately managed to get an oauth token via curl using that user. The app is connected as well. The integration lets me choose the machine and then the behaviour is the same (HTTP error 400). Strange - would be great to expose the error and error_description fields from the failed token request in lmcloud in the HA debug log.

@zweckj
Copy link
Member

zweckj commented Nov 22, 2024

I did add it to the library, but you will get those changes earliest in the next HA beta on wednesday.
It would be easier tbh if you could install the library and test from there. If you could install pylamarzocco (name changed) through pip and run the following small Python script, that would help a lot in getting an actual fix in the next release

import asyncio
from pylamarzocco.client_cloud import LaMarzoccoCloudClient

async def main():
    cloud_client = LaMarzoccoCloudClient(username, password)
    fleet = await cloud_client.get_customer_fleet()
    config = await cloud_client.get_config(serial_number)

asyncio.run(main())

@martingruening
Copy link
Author

>>> username = "[email protected]"
>>> password = "PASSWORD"
>>> serial_number = "MR025146"
>>> import asyncio
>>> from pylamarzocco.client_cloud import LaMarzoccoCloudClient
>>>
>>> async def main():
...     cloud_client = LaMarzoccoCloudClient(username, password)
...     fleet = await cloud_client.get_customer_fleet()
...     config = await cloud_client.get_config(serial_number)
...
>>> asyncio.run(main())
>>>

No error message shown.

@zweckj
Copy link
Member

zweckj commented Nov 22, 2024

import asyncio
from pylamarzocco.client_cloud import LaMarzoccoCloudClient

async def main():
    cloud_client = LaMarzoccoCloudClient(username, password)
    fleet = await cloud_client.get_customer_fleet()
    config = await cloud_client.get_config(serial_number)
    cloud_client = LaMarzoccoCloudClient(username, password)
    fleet = await cloud_client.get_customer_fleet()
    config = await cloud_client.get_config(serial_number)

asyncio.run(main())

Thanks for helping! Let's see if two consecutive login attempts change something

@martingruening
Copy link
Author

Sure, I am happy to get your support too. Runs slightly longer, no error message.

@zweckj
Copy link
Member

zweckj commented Nov 22, 2024

import asyncio
from pylamarzocco.client_cloud import LaMarzoccoCloudClient
from pylamarzocco.client_local import LaMarzoccoLocalClient

serial_number = "LM000000000"
username = "username"
password = "password"
host = "192.168.1.42"

async def main():
    cloud_client = LaMarzoccoCloudClient(username, password)
    try:
        fleet = await cloud_client.get_customer_fleet()
        config = await cloud_client.get_config(serial_number)
    except Exception as ex:
        print(ex)
        exit(1)
    else:
        print(config)
    cloud_client = LaMarzoccoCloudClient(username, password)
    try:
        fleet = await cloud_client.get_customer_fleet()
        config = await cloud_client.get_config(serial_number)
    except Exception as ex:
        print(ex)
        exit(1)
    else:
        print(config)
    local_client = LaMarzoccoLocalClient(host, fleet[serial_number].communication_key)
    try:
        config = await local_client.get_config()
    except Exception as ex:
        print(ex)
        exit(1)
    else:
        print(config)

asyncio.run(main())

now I REALLY don't know what's going on. This should print your machine's status 3 times to the console. I'm not interested in that content, I just wanna see if it's able to get it.

@martingruening
Copy link
Author

>>> asyncio.run(main())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "<stdin>", line 10, in main
  File "/usr/lib/python3.11/dataclasses.py", line 1273, in asdict
    raise TypeError("asdict() should be called on dataclass instances")
TypeError: asdict() should be called on dataclass instances

@zweckj
Copy link
Member

zweckj commented Nov 23, 2024

sorry, mixed up the functions, fixed the script above

@martingruening
Copy link
Author

martingruening commented Nov 23, 2024

>>> asyncio.run(main())
{'version': 'v1', 'preinfusionModesAvailable': ['ByDoseType'], 'machineCapabilities': [{'family': 'MICRA', 'groupsNumber': 1, 'coffeeBoilersNumber': 1, 'hasCupWarmer': False, 'steamBoilersNumber': 1, 'teaDosesNumber': 1, 'machineModes': ['BrewingMode', 'StandBy'], 'schedulingType': 'smartWakeUpSleep'}], 'machine_sn': 'Sn2406030216', 'machine_hw': '0', 'isPlumbedIn': False, 'isBackFlushEnabled': False, 'standByTime': 0, 'tankStatus': True, 'groupCapabilities': [{'capabilities': {'groupType': 'AV_Group', 'groupNumber': 'Group1', 'boilerId': 'CoffeeBoiler1', 'hasScale': False, 'hasFlowmeter': True, 'numberOfDoses': 1}, 'doses': [{'groupNumber': 'Group1', 'doseIndex': 'DoseA', 'doseType': 'PulsesType', 'stopTarget': 0}], 'doseMode': {'groupNumber': 'Group1', 'brewingType': 'PulsesType'}}], 'machineMode': 'StandBy', 'teaDoses': {'DoseA': {'doseIndex': 'DoseA', 'stopTarget': 0}}, 'boilers': [{'id': 'SteamBoiler', 'isEnabled': True, 'target': 128, 'current': 110}, {'id': 'CoffeeBoiler1', 'isEnabled': True, 'target': 94, 'current': 82}], 'boilerTargetTemperature': {'SteamBoiler': 128, 'CoffeeBoiler1': 94}, 'preinfusionMode': {'Group1': {'groupNumber': 'Group1', 'preinfusionStyle': 'PreinfusionByDoseType'}}, 'preinfusionSettings': {'mode': 'Disabled', 'Group1': [{'groupNumber': 'Group1', 'doseType': 'DoseA', 'preWetTime': 5, 'preWetHoldTime': 5}]}, 'clock': '2024-11-23T11:06:47', 'wakeUpSleepEntries': [{'id': 'E4Qn9AK', 'days': ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'], 'steam': True, 'enabled': True, 'timeOn': '5:45', 'timeOff': '9:30'}], 'smartStandBy': {'mode': 'LastBrewing', 'minutes': 30, 'enabled': True}, 'firmwareVersions': [{'name': 'machine_firmware', 'fw_version': '1.17'}, {'name': 'gateway_firmware', 'fw_version': 'v3.6-rc4'}]}

Config output repeats three times, cut down to one here. Code run on two different systems, of them my HA host to rule out firewall issues. Both deliver same result. Integration stills fails with HTTP error 400. The request for the oauth token seems to get malformed. Debugging the HTTP POST Call for oauth token or the passed parameters to the function seems to be necessary.

@zweckj
Copy link
Member

zweckj commented Nov 23, 2024

that's really weird. We'll need to wait for the beta next Wednesday and the improved debug logging I guess.

@zweckj
Copy link
Member

zweckj commented Nov 28, 2024

Beta is out, you could try again.

@martingruening
Copy link
Author

Tried it. Checked before on command line that config retrieval works with the above code, then tried the HA integration. It somehow now autodiscovers the machine:

2024-12-01 08:16:52.056 DEBUG (MainThread) [homeassistant.components.lamarzocco.config_flow] Discovered La Marzocco machine mr025146 through DHCP at address 192.168.181.77

The error is still HTTP 400:

pylamarzocco.exceptions.RequestNotSuccessful: Request to endpoint https://cms.lamarzocco.io/oauth/v2/token failed with status code 400response: {"error":"invalid_client","error_description":"The client credentials are invalid"}

But this code works

import asyncio
from pylamarzocco.clients.cloud import LaMarzoccoCloudClient
from pylamarzocco.clients.local import LaMarzoccoLocalClient

serial_number = "MR025146"
username = "[email protected]"
password = "PASSWORD"
host = "192.168.181.77"

async def main():
    cloud_client = LaMarzoccoCloudClient(username, password)
    try:
        fleet = await cloud_client.get_customer_fleet()
        config = await cloud_client.get_config(serial_number)
    except Exception as ex:
        print(ex)
        exit(1)
    else:
        print(fleet)
        print(config)

asyncio.run(main())

Results in

>>> asyncio.run(main())
{'MR025146': LaMarzoccoDeviceInfo(serial_number='MR025146', name='Micra', communication_key='f95824d356a5dfb63d8aebdaf8a508549a578142bd5f7aa4807f591649c31482', model='Micra')}
{'version': 'v1', 'preinfusionModesAvailable': ['ByDoseType'], 'machineCapabilities': [{'family': 'MICRA', 'groupsNumber': 1, 'coffeeBoilersNumber': 1, 'hasCupWarmer': False, 'steamBoilersNumber': 1, 'teaDosesNumber': 1, 'machineModes': ['BrewingMode', 'StandBy'], 'schedulingType': 'smartWakeUpSleep'}], 'machine_sn': 'Sn2406030216', 'machine_hw': '0', 'isPlumbedIn': False, 'isBackFlushEnabled': False, 'standByTime': 0, 'tankStatus': True, 'groupCapabilities': [{'capabilities': {'groupType': 'AV_Group', 'groupNumber': 'Group1', 'boilerId': 'CoffeeBoiler1', 'hasScale': False, 'hasFlowmeter': True, 'numberOfDoses': 1}, 'doses': [{'groupNumber': 'Group1', 'doseIndex': 'DoseA', 'doseType': 'PulsesType', 'stopTarget': 0}], 'doseMode': {'groupNumber': 'Group1', 'brewingType': 'PulsesType'}}], 'machineMode': 'BrewingMode', 'teaDoses': {'DoseA': {'doseIndex': 'DoseA', 'stopTarget': 0}}, 'boilers': [{'id': 'SteamBoiler', 'isEnabled': True, 'target': 128, 'current': 128}, {'id': 'CoffeeBoiler1', 'isEnabled': True, 'target': 94, 'current': 97}], 'boilerTargetTemperature': {'SteamBoiler': 128, 'CoffeeBoiler1': 94}, 'preinfusionMode': {'Group1': {'groupNumber': 'Group1', 'preinfusionStyle': 'PreinfusionByDoseType'}}, 'preinfusionSettings': {'mode': 'Disabled', 'Group1': [{'groupNumber': 'Group1', 'doseType': 'DoseA', 'preWetTime': 5, 'preWetHoldTime': 5}]}, 'clock': '2024-12-01T08:16:37', 'wakeUpSleepEntries': [{'id': 'E4Qn9AK', 'days': ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'], 'steam': True, 'enabled': True, 'timeOn': '5:45', 'timeOff': '9:30'}], 'smartStandBy': {'mode': 'LastBrewing', 'minutes': 30, 'enabled': True}, 'firmwareVersions': [{'name': 'machine_firmware', 'fw_version': '1.17'}, {'name': 'gateway_firmware', 'fw_version': 'v3.6-rc4'}]}
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f49b574fcb0>
Unclosed connector
connections: ['deque([(<aiohttp.client_proto.ResponseHandler object at 0x7f49b5753a70>, 7476006.585139505)])', 'deque([(<aiohttp.client_proto.ResponseHandler object at 0x7f49b5753e30>, 7476006.851638583)])']
connector: <aiohttp.connector.TCPConnector object at 0x7f49b57751c0>

I can send you my username and password if you want to debug yourself using my account?

@zweckj
Copy link
Member

zweckj commented Dec 1, 2024

I can send you my username and password if you want to debug yourself using my account?

Don't want to go there 😅

pylamarzocco should (debug) log your account details in both cases. Do you see any difference in your account/password between those two?

@zweckj
Copy link
Member

zweckj commented Dec 1, 2024

Also, just so we are on the same page:

  • you configure the integration
  • it fails on config entry setup then?

@martingruening
Copy link
Author

It autodetect the Micra, I added it to the system by entering username and password. Integration is then added. In the UI it says 'Errror while communicating with the API'.

All I can see in the log is

2024-12-01 12:04:18.595 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7f19d6eea450>,) inside the event loop by integration 'lamarzocco' at homeassistant/components/lamarzocco/config_flow.py, line 83: cloud_client = LaMarzoccoCloudClient( (offender: /usr/local/lib/python3.13/site-packages/httpx/_config.py, line 149: context.load_verify_locations(cafile=cafile)), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+lamarzocco%22
2024-12-01 12:04:48.211 DEBUG (MainThread) [homeassistant.components.lamarzocco] Initializing local API
2024-12-01 12:04:48.212 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Init WebSocket in background task
2024-12-01 12:04:48.582 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Request to endpoint https://cms.lamarzocco.io/oauth/v2/token failed with status code 400response: {"error":"invalid_client","error_description":"The client credentials are invalid"}
2024-12-01 12:04:48.586 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Finished fetching lamarzocco data in 0.374 seconds (success: False)
2024-12-01 12:04:53.848 DEBUG (MainThread) [homeassistant.components.lamarzocco] Initializing local API
2024-12-01 12:04:53.848 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Init WebSocket in background task
2024-12-01 12:04:54.129 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Request to endpoint https://cms.lamarzocco.io/oauth/v2/token failed with status code 400response: {"error":"invalid_client","error_description":"The client credentials are invalid"}
2024-12-01 12:04:54.130 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Finished fetching lamarzocco data in 0.281 seconds (success: False)
2024-12-01 12:05:04.504 DEBUG (MainThread) [homeassistant.components.lamarzocco] Initializing local API
2024-12-01 12:05:04.505 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Init WebSocket in background task
2024-12-01 12:05:04.673 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Request to endpoint https://cms.lamarzocco.io/oauth/v2/token failed with status code 400response: {"error":"invalid_client","error_description":"The client credentials are invalid"}
2024-12-01 12:05:04.675 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Finished fetching lamarzocco data in 0.169 seconds (success: False)

@zweckj
Copy link
Member

zweckj commented Dec 1, 2024

This one is really bugging me 😅

  • No debug logs at all frompylamarzocco?
  • While the integration is configured check /homeassistant/.storage/core.config_entries You should find a block for lamarzocco and in it your credentials. Does anything look funny there?

@zweckj
Copy link
Member

zweckj commented Dec 1, 2024

Forget that, I have another theory: Maybe another of your integrations is injecting something to the shared http client (which is not used during configuration). Are you comfortable using SSH on your instance?

@martingruening
Copy link
Author

  • Sorry, I had to configure the debug logging for pylamarzocco and restart. Log is below.
  • I can find the config entry, but nothing funny there. Matches debug log from pylamarzocco.
2024-12-01 13:19:41.088 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Finished fetching lamarzocco data in 0.399 seconds (success: False)
2024-12-01 13:19:46.569 DEBUG (MainThread) [homeassistant.components.lamarzocco] Initializing local API
2024-12-01 13:19:46.569 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Init WebSocket in background task
2024-12-01 13:19:46.766 DEBUG (MainThread) [pylamarzocco.lm_device] Got 403 from local API, sending token request to cloud
2024-12-01 13:19:46.766 DEBUG (MainThread) [pylamarzocco.client_cloud] Getting new access token, data: {'username': '[email protected]', 'password': 'PASSWD', 'grant_type': 'password', 'client_id': '7_1xwei9rtkuckso44ks4o8s0c0oc4swowo00wgw0ogsok84kosg', 'client_secret': '2mgjqpikbfuok8g4s44oo4gsw0ks44okk4kc4kkkko0c8soc8s'}
2024-12-01 13:19:46.867 DEBUG (MainThread) [homeassistant.components.lamarzocco.coordinator] Request to endpoint https://cms.lamarzocco.io/oauth/v2/token failed with status code 400response: {"error":"invalid_client","error_description":"The client credentials are invalid"}

What I can tell:

  • Credentials are correct. They work in the app. After I have enabled the integration for some time my account seems to get locked and I have to reset the password three times in a row to get the app back to signing in.

I am happy to use the integrated console to debugging.

@zweckj
Copy link
Member

zweckj commented Dec 1, 2024

You got two options:

  • either checkout https://github.com/zweckj/lamarzocco and copy the lamarzocco folder from custom_components folder to your custom components FROM THE new-client-test branch (like you would manually install a custom component)
  • open a terminal on your HA instance and run
cd /config
curl -o- -L https://gist.githubusercontent.com/bdraco/43f8043cb04b9838383fd71353e99b18/raw/core_integration_pr | bash /dev/stdin -d lamarzocco -p 132016

in both cases restart and try again

@martingruening
Copy link
Author

I can confirm that it works now with 2024.12. Thanks for the support!

@zweckj
Copy link
Member

zweckj commented Dec 4, 2024

That's great to hear. Could you please download diagnostics for lamarzocco, I would like to try to figure out which integration might’ve been interfering there

@martingruening
Copy link
Author

I'm not really sure what you mean with 'diagnostics for lamarzocco'. Would you please so kind to specifiy what kind of information you are interested in?

@zweckj
Copy link
Member

zweckj commented Dec 8, 2024

Nevermind, that downloads only your custom components. Basically I'd be interested which other integrations you have configured.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants