Giter VIP home page Giter VIP logo

python-magichue's People

Contributors

dimfred avatar drbayer avatar karunstha avatar lexxai avatar namacha avatar secretowo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

python-magichue's Issues

Doesn't get the right RGB value

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

  • Device Information: AliExpress LED Strip. Link: AliExpress

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.

Rename project from python-magichue to magichue

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.

Access to cw missed

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)

Support for candle mode after firmware update

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

  • Magic Home Controller RGB + IR with BLE

Setting color does not exit

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 ?

MacOS install error

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

  • oobest wifibulb e27 6.5W

Cool white not working

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

Color jump on color select

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

Bug: SyntaxError upon importation

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

Bug: Can not run constructor of Light() when device is is programming mode

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

  • Magic home RGBW light script with new chip (not ESP8266)

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

Please release discover feature

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

Question: make a bash script and can it control RGB/RGBW LED strips

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 :)

Color control not working properly

Describe the bug
Working:

  1. Turning bulb on and off
  2. Using light.mode like RAINBOW_CROSSFADE is working
  3. Changing the colors via magic hue app

Not working:

  1. Changing colors using light.rgb
  2. Changing colors using light.hue
  3. Using CustomMode is not working

Device
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

LocalLight() does not work with v8 bulbs

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

  • Device Information: v8 RGBCWWW

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()

hangs on setting light.brightness

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.

RGB&W should work without "is_white"

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)

light not working properly

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

Unable to connect to IP

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)

Music React

Any possibility of using the microphone to capture sound and make it react to music as in the app?

Feature Request: set speed of modes

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.

Cannot discover bulb using discover_bulbs()

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

  • Device Information: bulb name or/and online store link.
  • It is a RGB led strip controller

Additional context

  • Same issue with the library flux_led
  • I do not know how to find the required information, so I would need some help on how to do that for you.

Raise the proper exceptions

Note: Please introduce Exceptions for color functions that are not working or connections that cannot be established... this library is impossible to debug otherwise

#21

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.