core icon indicating copy to clipboard operation
core copied to clipboard

Error while setting up coinbase platform for sensor

Open pgomersbach opened this issue 1 year ago • 4 comments

The problem

When adding a wallet balance in the coinbase integration the wallet is not added. This occurs regardless of which wallet is chosen. Exchange rates do work correctly.

What version of Home Assistant Core has the issue?

core-2024.9.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Coinbase

Link to integration documentation on our website

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

Diagnostics information

home-assistant_coinbase_2024-09-17T08-59-18.117Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Attempting to set up EUR account sensor with v3 API
2024-09-17 12:11:47.284 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up coinbase platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/coinbase/sensor.py", line 88, in async_setup_entry
    entities.append(AccountSensor(instance, currency))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/coinbase/sensor.py", line 130, in __init__
    float(account[API_ACCOUNT_AMOUNT])
ValueError: could not convert string to float: '0.00515969893.71772555'

Additional information

No response

pgomersbach avatar Sep 17 '24 10:09 pgomersbach

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

Code owner commands

Code owners of coinbase 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 coinbase 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)


coinbase documentation coinbase source (message by IssueLinks)

home-assistant[bot] avatar Sep 17 '24 10:09 home-assistant[bot]

I also get an error when trying to set up the integration. "API credentials rejected by Coinbase due to an invalid API key." (Translated with Deepl)

JustAmply avatar Sep 18 '24 10:09 JustAmply

@JustAmply It looks like you're not using the correct API credentials. Please make sure you're running the latest version of Home Assistant as support for v3 API credentials was added recently. Full instructions can be found here.

TomBrien avatar Sep 22 '24 07:09 TomBrien

@pgomersbach I can't reproduce this with either crypto to fiat wallets. The output looks like the Coinbase API messed up which happens more often than it should.

TomBrien avatar Sep 22 '24 07:09 TomBrien

@JustAmply It looks like you're not using the correct API credentials. Please make sure you're running the latest version of Home Assistant as support for v3 API credentials was added recently. Full instructions can be found here.

You are right, the API credentials i was given by Coinbase were faulty. The API key somehow was in the format cdp_XXXXXXXXXX instead of organizations/XXXXX/apiKeys/XXXXX. After regenerating them it works, thanks Tom!

JustAmply avatar Sep 23 '24 15:09 JustAmply

API key was in the format cdp_XXXXXXXXXX instead of organizations/XXXXX/apiKeys/XXXXX. Thanks, solved!

pgomersbach avatar Sep 24 '24 17:09 pgomersbach