nickknissen / hass-monta

Monta Home Assistant custom component
MIT License
24 stars 1 forks source link

update readme #52

Closed Neesgaard closed 8 months ago

Neesgaard commented 8 months ago

Checklist

Is your feature request related to a problem? Please describe.

Frist thanks for good work

Can you update readme with clean up. i have install the hass, removet files form ha. add them again make new keys in Monta portal. And can not config the hass again, i think i not have clean all up from the first install.

Describe the solution you'd like

update readme

Describe alternatives you've considered

nope

Additional context

nope

nickknissen commented 8 months ago

I am not sure i get what you are trying accomplish. Maybe you could elaborate on what your end goal is?

When you remove the integration the associated devices, entities and settings should be removed from home assistant.

Neesgaard commented 8 months ago

I'm trying to get integration working again.

I have had it installed and it has been working. but had it removed as there was an issue with stop charging.

When I try to configure it again, I get a 401 error. but the same key works in monta's public api site. It seems that the token from the first installation is hiding somewhere that I can't find.

So I'm not sure I cleaned up properly.

thanks for your time.

nickknissen commented 8 months ago

When the integration is remove the client id/secret should also be remove.

Are you getting a 401 on the setup? If thats the case you should se errors on the home assistant log.

If there is no details from monta in the log try add the following to your configuration.yaml.

logger:
  default: info
  logs:
    custom_components.monta: debug
Neesgaard commented 8 months ago

i get this in the log

2024-01-17 21:37:23.821 DEBUG (MainThread) [custom_components.monta.api] [auth/refresh] Response header: <CIMultiDictProxy('Date': 'Wed, 17 Jan 2024 20:37:22 GMT', 'Content-Type': 'application/json', 'Content-Length': '155', 'Connection': 'keep-alive', 'request-id': 'fddcd964-e1b5-4460-bfb9-353096xxxxxxx', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains')>
2024-01-17 21:37:23.821 DEBUG (MainThread) [custom_components.monta.api] [auth/refresh] Response status: 401
2024-01-17 21:37:23.821 DEBUG (MainThread) [custom_components.monta] Finished fetching monta data in 2.461 seconds (success: False)
2024-01-17 21:37:23.821 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Monta account 34723' for monta integration could not authenticate: Invalid credentials

this request-id': 'fddcd964-e1b5-4460-bfb9-353096xxxxxxx' is not exists in Monta and not this i use in setup.

thanks for your time

nickknissen commented 8 months ago

The request id is something monta uses to track api request, not used for client id/secret as far as I know.

Cloud you try to generate a new set of credentials, just to make sure its nothing wrong with the current set.

Neesgaard commented 8 months ago

yes, I can

it gives the same thing

if i test key here https://docs.public-api.monta.com/reference/get-access-token-with-client-credentials i get 200

So it's as if someone or knows some old keys

nickknissen commented 8 months ago

@Neesgaard What version are you running?

When you setup the integration. Do you see Client id/client secret is wrong.

image

Neesgaard commented 8 months ago

Hi I run version v 1.3.0 and HA in version 2024.1.5 no i see this image image image

Neesgaard commented 8 months ago

I found this in the log, maybe it can help for debugging

2024-01-22 23:29:13.574 DEBUG (MainThread) [custom_components.monta.api] [auth/refresh] Response header: <CIMultiDictProxy('Date': 'Mon, 22 Jan 2024 22:29:13 GMT', 'Content-Type': 'application/json', 'Content-Length': '155', 'Connection': 'keep-alive', 'request-id': 'bf1dd28b-a366-49f3-8423-9e2bef185891', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains')>
2024-01-22 23:29:13.574 DEBUG (MainThread) [custom_components.monta.api] [auth/refresh] Response status: 401
2024-01-22 23:29:13.575 DEBUG (MainThread) [custom_components.monta] Finished fetching monta data in 2.926 seconds (success: False)
2024-01-22 23:29:13.575 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Monta account 34723' for monta integration could not authenticate: Invalid credentials
2024-01-22 23:29:13.678 INFO (MainThread) [homeassistant.setup] Setting up androidtv_remote
2024-01-22 23:29:13.679 INFO (MainThread) [homeassistant.setup] Setup of domain androidtv_remote took 0.0 seconds
2024-01-22 23:29:13.777 INFO (MainThread) [homeassistant.setup] Setting up easee
2024-01-22 23:29:13.779 INFO (MainThread) [homeassistant.setup] Setup of domain easee took 0.0 seconds
2024-01-22 23:29:13.796 INFO (MainThread) [pyeasee.easee] Easee python library version: 0.7.55
2024-01-22 23:29:13.803 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 762, in _async_init_reauth
await hass.config_entries.flow.async_init(
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 888, in async_init
flow, result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 916, in _async_init
result = await self._async_handle_step(flow, flow.init_step, data)
nickknissen commented 8 months ago

@Neesgaard Could you test the new pre release? v1.3.1
There is a bug where the refresh token is stored between installations and causes problems when using a new client id/secret

Neesgaard commented 8 months ago

@nickknissen is work :-) Good job