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

Exception on device discovery in DIY mode #1515

Open
martink-p opened this issue Oct 31, 2024 · 0 comments
Open

Exception on device discovery in DIY mode #1515

martink-p opened this issue Oct 31, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@martink-p
Copy link

martink-p commented Oct 31, 2024

(At least) when in DIY mode an exception is raised due to a key error in the "device" dictionary:

2024-10-31 15:13:28.408 DEBUG (MainThread) [custom_components.sonoff.core.ewelink.local] 100214ec65 <= Local0 | Zeroconf error
Traceback (most recent call last):
File "/config/custom_components/sonoff/core/ewelink/local.py", line 135, in _handler2
self._handler3(deviceid, host, data)
File "/config/custom_components/sonoff/core/ewelink/local.py", line 161, in _handler3
self.dispatcher_send(SIGNAL_UPDATE, msg)
File "/config/custom_components/sonoff/core/ewelink/base.py", line 65, in dispatcher_send
handler(*args, **kwargs)
File "/config/custom_components/sonoff/core/ewelink/__init__.py", line 290, in local_update
device["params"]["sledOnline"] = params["sledOnline"]
KeyError: 'params'

I added some code above line 290 which fixed the issue. Due to the fact I'm not involved in the project, I'm not sure this is the correct set of variables and if it is the only location the fix is required.

if "params" not in device:                                                     
    device["params"] = params                                                  
 elif "sledOnline" in params:                                                   
    device["params"]["sledOnline"] = params["sledOnline"] 

Please check my suggestion.

@AlexxIT AlexxIT added the bug Something isn't working label Jan 16, 2025
@AlexxIT AlexxIT self-assigned this Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants