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

2 subscriptions the second is atome #6

Closed
adamantis06 opened this issue Jan 26, 2022 · 9 comments
Closed

2 subscriptions the second is atome #6

adamantis06 opened this issue Jan 26, 2022 · 9 comments
Labels
enhancement New feature or request

Comments

@adamantis06
Copy link

I have 2 subscriptions to totalEnergie and only second one have atome key
in this code and the package (pyKeyAtome) we have things like this :
user_reference = login_value["subscriptions"][0]["reference"]

in my case subscription 0 don't have atome key can we imagine a parameter ?

@jugla
Copy link
Owner

jugla commented Jan 26, 2022

Hello,
Thanks for your issue --> I was wondering how to handle several subscriptions.
We can add a parameter, of course.
For user reference , there is an array. But I wonder , what is given back for live consumption ...

@adamantis06
Copy link
Author

I test with postman and for live consumption we must pass user reference in url then we have always 1 result.
In my case it is the wrong user reference in url.

@jugla
Copy link
Owner

jugla commented Jan 26, 2022

Thanks
In pykeyatome, I will add a parameter to select the user id.
If you want to try, in your local directory pykeyatome ( https://github.com/jugla/pyKeyAtome/blob/master/pykeyatome/client.py )
at line 79 , change [0] by [1] in user_reference = response_json["subscriptions"][0]["reference"]

==> it will ask for your second subscription

@jugla jugla added the enhancement New feature or request label Jan 26, 2022
@jugla
Copy link
Owner

jugla commented Jan 29, 2022

Please can you test the version V4.0.0 ?
Add thouht UI or in configuration.yaml the atome_linky_number.
You want the first linky choose 1, 2nd 2 and so on.

If you need several linky key just make the declaration several times

Thanks in advance

@adamantis06
Copy link
Author

I tried this morning and I got a small concatenation error it seems.
If I put 1 it works as before (so not in my case) and if I put 2 concatenation error

Cette erreur provient d'une intégration personnalisée

Logger: aiohttp.server
Source: custom_components/keyatome/config_flow.py:61
Integration: KeyAtome Linky (documentation, issues)
First occurred: 07:30:43 (3 occurrences)
Last logged: 08:21:29

Error handling request
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/keyatome/config_flow.py", line 61, in async_step_user
user_input[CONF_USERNAME]
TypeError: can only concatenate str (not "int") to str

@adamantis06
Copy link
Author

It's ok i modified in config_flow line 61 just add str() for convert int to string and it work !!!!

Thanks

@jugla
Copy link
Owner

jugla commented Jan 29, 2022

great !!!
Thanks a lot for the correction.

@jugla
Copy link
Owner

jugla commented Jan 29, 2022

I've created the release 4.0.1 to solve string conversion

@jugla
Copy link
Owner

jugla commented Jan 29, 2022

NB : I've created release 4.1.0 to improve sensor name.

@jugla jugla closed this as completed Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants