-
-
Notifications
You must be signed in to change notification settings - Fork 563
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
Add light specs for yeelight #1163
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1163 +/- ##
==========================================
+ Coverage 76.61% 77.90% +1.28%
==========================================
Files 77 79 +2
Lines 9155 9222 +67
Branches 756 762 +6
==========================================
+ Hits 7014 7184 +170
+ Misses 1958 1853 -105
- Partials 183 185 +2
Continue to review full report at Codecov.
|
@rytilahti Could you give some advice with 1 and 2 |
So, we could only initialize it only once inside the module. Think about a situation with 10 yeelight bulbs, calling the static method would cause file I/O & parsing for each and every instance. This would also skip those if the Yeelight module never gets initialized. Here's what I think could work:
Does that make sense to you?
Better use |
I`m not satisfied but agree I/O for home assistant(or any other CD card user) more important than RAM. Hope in the future SSD will be cost nothing and all off us start to use it (and size must be like CD card) :) @rytilahti Please look current state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of small changes and this is good to go.
value["background_light"], | ||
value["supports_color"], | ||
) | ||
YeelightSpecHelper._models[key] = info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even when improbable that someone adds a duplicate entry to the file, I'd check here if the key already exists and raise an exception if so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this but as I understand yaml.safe_load
ignore key duplicates. I tried to add duplicate and wouldnt catch exception :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, it's a dictionary already so new values will override the existing one. Let's do the following: remove the duplicate handling (no need to check for the key & raise the exception) and let's merge this then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Kirmas! 🎉
This is base support for spec file & uses it to provide information about supported models. Second PR based on #1094 (review)