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

Shelly Gen 2 Authentication #63621

Closed
figadore opened this issue Jan 7, 2022 · 9 comments · Fixed by #69753
Closed

Shelly Gen 2 Authentication #63621

figadore opened this issue Jan 7, 2022 · 9 comments · Fixed by #69753

Comments

@figadore
Copy link

figadore commented Jan 7, 2022

The problem

Duplicate of #60455, which was closed and locked, so I'm not sure where to go to track/follow progress on this bug (it does feel like a bug to me, but let me know if I should create a feature request instead, and how I should think about bugs vs feature requests for ambiguous issues like this one).
Re: #60455 (comment) I need this feature, and I'd like to contribute, so any additional information on the current status would be useful. Is this already being tracked somewhere else?

What version of Home Assistant Core has the issue?

2021.12.8

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

shelly

Link to integration documentation on our website

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

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: components/shelly/__init__.py:217
First occurred: 15:36:46 (1 occurrences)
Last logged: 15:36:46

Error setting up entry ShellyPlus1PM-A8032ABE140C for shelly
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/shelly/__init__.py", line 106, in async_setup_entry
    return await async_setup_rpc_entry(hass, entry)
  File "/usr/src/homeassistant/homeassistant/components/shelly/__init__.py", line 217, in async_setup_rpc_entry
    device = await RpcDevice.create(
  File "/usr/local/lib/python3.9/site-packages/aioshelly/rpc_device.py", line 58, in create
    await instance.initialize()
  File "/usr/local/lib/python3.9/site-packages/aioshelly/rpc_device.py", line 93, in initialize
    await asyncio.gather(
  File "/usr/local/lib/python3.9/site-packages/aioshelly/rpc_device.py", line 129, in update_config
    self._config = await self._wsrpc.call("Shelly.GetConfig")
  File "/usr/local/lib/python3.9/site-packages/aioshelly/wsrpc.py", line 234, in call
    raise JSONRPCError(code, msg)
aioshelly.exceptions.JSONRPCError: (401, '{"auth_type": "digest", "nonce": 1638023806, "nc": 1, "realm": "shellyplus1pm-a8032abe140c", "algorithm": "SHA-256"}')

Additional information

No response

@probot-home-assistant
Copy link

shelly documentation
shelly source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @balloob, @bieniu, @thecode, @chemelli74, mind taking a look at this issue as it has been labeled with an integration (shelly) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@thecode
Copy link
Member

thecode commented Jan 7, 2022

As you already linked to a comment which states from the docs that it is currently not implemented you should understand that it is not a bug. Unfortunately Shelly choose an authentication method which does not have python implementations so it makes it complicated (at least that was the state last time I checked, I will check again).
If you would like to contribute you are welcome to work on this feature by creating a PR with the implantation here: https://github.com/home-assistant-libs/aioshelly, I will do my best to help.

@figadore
Copy link
Author

My understanding from the shelly docs is that this will need to digest auth, something like this, and the updates would need to take place in aioshelly/rpc_device.py. Does that all sound right?

@thecode
Copy link
Member

thecode commented Jan 26, 2022

Would need to be implemented in wsrpc similar to the example you linked but using websockets not http

@figadore
Copy link
Author

fixed in home-assistant-libs/aioshelly#209

@Yamakaky
Copy link

Nice! When can we expect to have it in live?

@casellini
Copy link

Great. Looking forward to have it live.

@figadore
Copy link
Author

figadore commented May 4, 2022

included in 2022.5.0

@github-actions github-actions bot locked and limited conversation to collaborators Jun 3, 2022
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.

7 participants