namacha / python-magichue Goto Github PK
View Code? Open in Web Editor NEWControl Magic Hue(Magichome) in Python.
License: MIT License
Control Magic Hue(Magichome) in Python.
License: MIT License
Device: GIDEALED 32.8ft Smart WiFi Addressable RGB DreamColor LED Strip Lights
Connecting locally using discover_bulbs()
light.on and light.off working fine
right.rgb and light.mode not working at all
have tried branch 42 as a potential fix, but that is also not working
TIA!
Describe the bug
When I try to get the current RGB value so I can reset it at the end of the program it get's it right te first time, but after that it keeps giving the same value even though I've manually changed the light with the app.
To Reproduce
Code to reproduce the behavior:
import magichue
from bottle import route, run
pr = None
light = magichue.Light('192.168.1.36')
light.mode = magichue.NORMAL
def get_color():
global pr
pr = light.rgb
@route('/flashgreen')
def index():
global pr
get_color()
time.sleep(1)
light.rgb = (0, 0, 0)
time.sleep(0.5)
light.rgb = (0, 255, 0)
time.sleep(0.4)
light.rgb = (0, 0, 0)
time.sleep(0.5)
light.rgb = (0, 255, 0)
time.sleep(0.4)
light.rgb = pr
run(host='localhost', port=4783)
Device
Additional context
I'm very new to Python so it could entirely be that I just made a mistake, if so please point it out.
It could also be that the 'bottle' library is causing issues here because when I make a separate test program where I only print(light.rgb) it works fine.
In my opinion there is no need to have python before a package-name released on PyPi... so my suggestion is to release it under magichue
or pagichue
if you like wording games. Same with the GitHub repo.
print(light.cw)
AttributeError: 'Light' object has no attribute 'cw'
Now access only is use internal data
light._status.cw=0
print(light._status.cw)
Magichue currently does not support candle mode, which was added in the latest firmware update for magic home controllers.
Reproduce the behavior:
Set one magic hue device to candle mode in app
magichue.Light(ip)
fails with KeyError: 95
Device
Hi,
it seems like that setting a color does not "exit" for me. For example, this program halts after setting the color to white:
Python 3.6.3 |Anaconda, Inc.| (default, Dec 5 2017, 17:30:25)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> import magichue
>>> light = magichue.Light('192.168.178.109')
>>> if not light.on:
... light.on = True
...
>>> if light.is_white:
... light.is_white = False
...
>>> light.rgb = (255, 255, 255)
Might be related to #4 ?
Describe the bug
Error on installing on MacOS
--pip install python-magichue
Collecting python-magichue
Using cached https://files.pythonhosted.org/packages/62/3c/d4d70ae822ee63b3682a329cb3e531235db483d93b3922c1e0f5b88c37a6/python-magichue-0.2.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/j5/6108wt4j24scty_gq4zqj1mc0000gn/T/pip-install-rI3olu/python-magichue/setup.py", line 3, in <module>
import magichue
File "magichue/__init__.py", line 1, in <module>
from .magichue import Light
File "magichue/magichue.py", line 6, in <module>
import magichue.modes as modes
ImportError: No module named modes
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/j5/6108wt4j24scty_gq4zqj1mc0000gn/T/pip-install-rI3olu/python-magichue/
Device
Describe the bug
Setting cool white doesn't work, bulb just turns off
To Reproduce
Code to reproduce the behavior:
def setwarm():
light.cw = 0
light.w = 255
light.is_white = True
print(light._get_status_data())
def setcool():
light.cw = 255
light.w = 0
light.is_white = True
print(light._get_status_data())
Device
https://www.amazon.com.au/gp/product/B07D8HTX8M/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1
Additional context
Warm white function works fine, also, I can set the bulb to cool white via the magichome app, and have also verified it works using https://github.com/kirillsimin/magichue and running the cool function in that script
I don't really know if this is really a bug or just a feature, I like to have but when I select a color with light.rgb, the color doesn't jump immediately, but it just fades. I would wish me a function that changes the color instantaniously.
I'm using the #7 fix branch.
Thanks Felix
File "B:\Python\python-magichue-0.1\magichue\test1.py", line 2, in <module> import magichue File "B:\Python\python-magichue-0.1\magichue\magichue.py", line 210 self._status = Status(*rgb, self.w, self.is_white, self.on) SyntaxError: only named arguments may follow *expression
Can not run constructor of Light() when device is is programming mode. The issue is more relevant, because it was normal for me to run device in this mode, reason beeing it is new for this app. By programming mode I mean mode when you connect and reconnect power supply 3 times, and device flashes every color separatly.
To Reproduce
import magichue
bulbs = magichue.discover_bulbs() # returns list of bulb address
print(bulbs[0])
light = magichue.Light(bulbs[0])
Device
Additional context
The reason for this problem is that 'programming mode' (you enter it by reconnecting power supply 3 times) has its own of mode_value = 0x63, wich is not in dictionary, so on call
self.mode = modes._VALUE_TO_MODE[mode_value]
python rises KeyError: 99.
The fix for me was to add this mode to const and dictionary to modes.py, i.e. :
_PROGRAMMING_MODE = 0x63
PROGRAMMING_MODE = Mode(_PROGRAMMING_MODE, 1, 'PROGRAMMING_MODE')
_PROGRAMMING_MODE: PROGRAMMING_MODE,
There are 3 palceses where you need to it, this is only suggestion for fix
Hello,
please release a version with the discover feature... I need that one
from magichue import discover_bulbs
print(discover_bulbs())
Offtopic: shebang is missing in setup.py
and causes error while ./setup.py install
command:
#!/usr/bin/env python3
from setuptools import setup, find_packages
Hey there,
I'm looking for something that can control my Magic Home LED strips via a bash script so I can set Tautulli to turn off/on the lights when I play a move though Plex.
Would this software be able to do that? and do you have any examples of what a script would look like?
Thanks so much :)
Describe the bug
Working:
light.mode
like RAINBOW_CROSSFADE
is workingNot working:
light.rgb
light.hue
CustomMode
is not workingDevice
https://www.amazon.com/Required-Magic-Hue-Equivalent-Compatible/dp/B07VKJ2VW5
Code
#!/usr/bin/env python3
import magichue
from magichue import CustomMode
light = magichue.Light('192.168.1.128')
light.on = True
light.is_white = False
light.mode = CustomMode(
mode = magichue.MODE_GRADUALLY,
speed = 0.5,
colors = \
[
(255, 0, 255),
(0, 0, 255)
]
)
Note: Please introduce Exceptions for color functions that are not working or connections that cannot be established... this library is impossible to debug otherwise
Describe the bug
LocalLight() does not work with v8 bulbs but Light() does
To Reproduce
Code to reproduce the behavior:
led1= LocalLight("<yourip>")
led1.g = 255
led2 = Light("<yourip>")
led1.g = 200
Device
Additional context
status does not get applied when
using LocalLight() w/ v8 bulbs. I believe it has something
to do with how the commands are sent vs Light()
I have 2 v4 magichome bulbs, and 1 v6 magichome bulb. They all used to hang on light.brightness = [value], but the last update fixed the problem for the v4 bulbs. The bulb's brightness changes, but my code gets blocked.
Great package! I'm using it with some RGBW led strips and the magichome WiFi LED strip controller. The strips I use have a warm white led every other one. You can run these warm white LEDs at the same time as the colored LEDs. In that case, the is_white
setting is not needed, since you can separately control color and warm white led levels. I do confirm that I can:
light.is_white=True
light.w=128
light.is_white=False
to change the warm white level. But it would be useful to be able to configure the light object to allow setting color and white LED levels without switching "modes". Thanks for considering.
UPDATE: Interestingly, the light type isn't in your list of types:
>>> light._get_status_data()
(129, 6, 35, 37, 20, 7, 188, 0, 255, 50, 1, 0, 240, 200)
Describe the bug
not working at all unless confirm_receive_on_send is false
To Reproduce
Code to reproduce the behavior:
any function
Device
9W SMART+
Additional context
I might have a faulty light or something
Describe the bug
I inserted my IP into the example code and ran it which yielded the error:
"ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it"
To Reproduce
Code to reproduce the behavior:
import time
import magichue
light = magichue.Light('my ip')
if not light.on:
light.on = True
if not light.is_white:
light.is_white = True
light.rgb = (255, 255, 255)
for hue in range(1000):
print("running")
light.hue = hue / 1000
time.sleep(0.05)
Device
Nexlux LED strip (connected to MagicHome)
I wonder if "Flux LED" just a rebranding of the "MagicLight"? There is this flux_led library that uses the same type of ssdp discovery.
https://github.com/namacha/python-magichue/blob/master/magichue/discover.py#L13-L14
https://github.com/Danielhiversen/flux_led/blob/master/flux_led/__main__.py#L1210
https://github.com/Danielhiversen/flux_led/blob/master/flux_led/__main__.py#L1216
Any possibility of using the microphone to capture sound and make it react to music as in the app?
One of my favorite features of the Magic Home app is the ability to adjust the speed of the mode. The default speed is very fast and I would like to be able to control this speed within my project.
Describe the bug
I cannot discover my led strip using discover_bulbs. It always returns an empty list regardless of how long the timeout is set. But I can still use the bulb if provide the IP address manually.
To Reproduce
Code to reproduce the behavior:
import magichue
from magichue import discover_bulbs, LocalLight
discover_bulbs()
Device
Additional context
Note: Please introduce Exceptions for color functions that are not working or connections that cannot be established... this library is impossible to debug otherwise
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.