Comments (2)
It appears from this article that the bulb actually has two sets of LEDs: one set for colors, one set for warm light. (As seen on this image.) I think that you cannot use both sets of LEDs at the same time (at least via Bluetooth), possibly due to prevention of overheating or drawing too much current.
The name 'brightness' is perhaps misleading since RGB and warm light are actually two different (physical) things for this bulb. The brightness of RGB is controlled by setting a darker RGB color. The brightness of warm light is controlled by setting a lower intensity for warm light.
Maybe the API should avoid the word brightness and instead use warm_light_intensity in method turn_on(). The method can also be extended by adding an additional parameter for RGB. Or, the API can be simplified by not accepting any further paramters, forcing the user to call it turn_on() and set_warm_light()/set_color() directly. (The last has my preference.)
By looking at turn_on(), actually, I see that it calls set_color() with a RGB color. Maybe the firmware is smart enough to use the warm light LEDS if all parts of the RGB color are the same.
from magicblue.
Such a feature would be nice indeed. Ideally we would have to read the current color from the bulb but that part is still tricky (see #17).
But we could be able to do that right now by storing the current color in MagicBlueLib.
- Downside : set_brightness would have a strange behaviour before the first call to turn_on, set_warm_light or set_color as the first color would be unknown
- Upside : easy to implement, as setting the brightness basically consists in applying it to each component of the colour. Example (admitting current_color contains the colors list as [red, green, blue]) :
def set_brightness(self, brightness):
"""
Changes current brightness
:param brightness: between 0.0 and 1.0 : brightness ratio
"""
self.set_color([
int(self.current_color[0] * brightness),
int(self.current_color[1] * brightness),
int(self.current_color[2] * brightness)
])
from magicblue.
Related Issues (20)
- Add support for functions (strobe, colors crossfade...etc) HOT 1
- UnboundLocalError: local variable 'addr_type' referenced before assignment HOT 3
- Publish to pypi HOT 2
- Add support for time schedules HOT 1
- Multiple bulbs setup HOT 14
- v8 bulbs can't connect sometimes HOT 5
- Testing the library without the actual bulb (suggestion) HOT 1
- Version 6 compatibility HOT 7
- MagicBlue interactive shell enhancement with python-prompt-toolkit
- API Usage HOT 9
- x86 architecture HOT 6
- Tkinter GUI HOT 3
- Install and run magicblue in Raspbian Stretch (kernel version 4.9) - SOLVED! HOT 3
- Issues using magic blue HOT 3
- bluepy 1.20 is out HOT 2
- Cannot connect from shell HOT 4
- question: other lights HOT 5
- loss of connection after 10-15 minutes HOT 2
- Dependabot couldn't authenticate with https://pypi.python.org/simple/
- b
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magicblue.