Jump to content

MagicHome Node Server


fahrer16

Recommended Posts

I decided to try writing a node server for some inexpensive LED controllers I have that are controllable using the "MagicHome" App on android/iOS. There's a good thread on this forum that goes into the controllers in a lot of detail: http://forum.universal-devices.com/topic/19913-magic-ufo-controller-for-rgbw/page-1?do=findComment&comment=189572

 

This is my first attempt at writing a node server and I don't have much Python experience but I definitely learned quite a bit in the process.  Everything seems to be working pretty well for my setup.  If you decide to give it a try, just let me know if you see any issues.

 

I just have standard RGB controllers (no white/warm white) so I've only implemented RGB for now.

 

Here's the github with a readme that goes over installation: https://github.com/fahrer16/magichome-nodeserver

Link to comment
Share on other sites

  • 3 months later...

An updated version of the MagicHome LED node server is now available for Polyglot v2.  This is a complete rewrite from the original to make use of the flux_led python project and now includes support for Warm White LED's.  I don't have any warm white LED's, so if anybody does, let me know if there are any issues with that functionality.

 

See new github repo here: https://github.com/fahrer16/udi-magichome-poly

Link to comment
Share on other sites

An updated version of the MagicHome LED node server is now available for Polyglot v2.  This is a complete rewrite from the original to make use of the flux_led python project and now includes support for Warm White LED's.  I don't have any warm white LED's, so if anybody does, let me know if there are any issues with that functionality.

 

See new github repo here: https://github.com/fahrer16/udi-magichome-poly

Love to see a device status screen shot!

Link to comment
Share on other sites

This made my day! I think I t’s time for me to jump into the beta! This is outstanding! Thanks for the hard work and sharing! Once I get things up and running I’ll give you a donation.

 

Glad to hear it!  Let me know if you run into any issues.  This is a pretty simple node; the thanks really goes to Einstein.42 for his work on Polyglot v2.

Link to comment
Share on other sites

Glad to hear it! Let me know if you run into any issues. This is a pretty simple node; the thanks really goes to Einstein.42 for his work on Polyglot v2.

It’s people like you who make and share things like this an asset to the ISY community regardless in what capacity. So for that I am thankful.

Link to comment
Share on other sites

I just thought I would give it a try since I have the square style controllers with the white.

 

I am getting the following error:

 

2018-1-5 15:02:34 - info: NS: Starting Local NodeServer MagicHome profile number 10
2018-1-5 15:02:35 - error: NSChild: MagicHome STDERR: Traceback (most recent call last):
File "./magichome.py", line 9, in <module>
from flux_led import BulbScanner, WifiLedBulb
ImportError: No module named 'flux_led'

 

It could be something I did wrong as I just know enough to be dangerous on the Raspberry Pi.

 

No hurry on an answer. 

 

Thanks

Link to comment
Share on other sites

It doesn't look like this node has been added to the nodeserver store yet, so if you cloned the git-hub repository, you probably need to run install.sh manually from the node's directory (./install.sh).  Note, you might need to make the file executable by running "chmod +x install.sh" from the node's directory first.

Link to comment
Share on other sites

It doesn't look like this node has been added to the nodeserver store yet, so if you cloned the git-hub repository, you probably need to run install.sh manually from the node's directory (./install.sh).  Note, you might need to make the file executable by running "chmod +x install.sh" from the node's directory first.

 

Yes you are correct on all accounts.

I did what you said and it started working immediately after deleting and adding again.

 

This should allow me to get rid of a pile of Network Resources.

 

Thanks again for all your work on this.

Link to comment
Share on other sites

  • 1 month later...

Trouble getting this working.

 

I added from the store, set the 'host' config parameter and my bridge was discovered. However, when I send an 'ON' to Zone1 I get the following in the log (and no state change):

2018-02-12 23:14:59,948 ERROR    Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/root/.local/lib/python3.5/site-packages/polyinterface/polyinterface.py", line 602, in _parseInput
    self.nodes[input[key]['address']].runCmd(input[key])
  File "/root/.local/lib/python3.5/site-packages/polyinterface/polyinterface.py", line 510, in runCmd
    fun(self, command)
  File "/root/.polyglot/nodeservers/MiLight/MilightWifiBridge.py", line 386, in turnOn
    if ( self.myMilight.turnOn(self.grpNum) == False ):
  File "./milight_poly.py", line 116, in setOn
    returnValue = self.__sendRequest(MilightWifiBridge.__ON_CMD, zoneId)
  File "/root/.polyglot/nodeservers/MiLight/MilightWifiBridge.py", line 348, in __sendRequest
    startSessionResponse = self.__startSession()
  File "/root/.polyglot/nodeservers/MiLight/MilightWifiBridge.py", line 320, in __startSession
    data, addr = self.__sock.recvfrom(1024)
ConnectionRefusedError: [Errno 111] Connection refused

Any ideas?

Link to comment
Share on other sites

52 minutes ago, MWareman said:

Trouble getting this working.

 

I added from the store, set the 'host' config parameter and my bridge was discovered. However, when I send an 'ON' to Zone1 I get the following in the log (and no state change):


2018-02-12 23:14:59,948 ERROR    Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/root/.local/lib/python3.5/site-packages/polyinterface/polyinterface.py", line 602, in _parseInput
    self.nodes[input[key]['address']].runCmd(input[key])
  File "/root/.local/lib/python3.5/site-packages/polyinterface/polyinterface.py", line 510, in runCmd
    fun(self, command)
  File "/root/.polyglot/nodeservers/MiLight/MilightWifiBridge.py", line 386, in turnOn
    if ( self.myMilight.turnOn(self.grpNum) == False ):
  File "./milight_poly.py", line 116, in setOn
    returnValue = self.__sendRequest(MilightWifiBridge.__ON_CMD, zoneId)
  File "/root/.polyglot/nodeservers/MiLight/MilightWifiBridge.py", line 348, in __sendRequest
    startSessionResponse = self.__startSession()
  File "/root/.polyglot/nodeservers/MiLight/MilightWifiBridge.py", line 320, in __startSession
    data, addr = self.__sock.recvfrom(1024)
ConnectionRefusedError: [Errno 111] Connection refused

Any ideas?

Wrong thread? It looks like you are using the MiLight not Magichome? ? 

Link to comment
Share on other sites

  • 3 months later...
  • 3 weeks later...

I picked up some led bulbs that are controllable by the MagicHome controller. Not bad bulbs and only about $20.

They have separate led's for the warm color which is fairly nice.

I can control everything except the warm led's, they don't show up in the node.

Think you could get these working sometime?

https://www.magiclightbulbs.com/collections/wifi-bulbs/products/wifi-mini-rbg-soft-white

Thanks for all your hard work!

Link to comment
Share on other sites

14 hours ago, markv58 said:

I picked up some led bulbs that are controllable by the MagicHome controller. Not bad bulbs and only about $20.

They have separate led's for the warm color which is fairly nice.

I can control everything except the warm led's, they don't show up in the node.

Think you could get these working sometime?

https://www.magiclightbulbs.com/collections/wifi-bulbs/products/wifi-mini-rbg-soft-white

Thanks for all your hard work!

ahhhhh. won't ship out of the US! Thanks!

 

Price is right but lumens are a little low for most applications.

 

Thanks!

Link to comment
Share on other sites

On 6/5/2018 at 9:04 AM, markv58 said:

I picked up some led bulbs that are controllable by the MagicHome controller. Not bad bulbs and only about $20.

They have separate led's for the warm color which is fairly nice.

I can control everything except the warm led's, they don't show up in the node.

Think you could get these working sometime?

https://www.magiclightbulbs.com/collections/wifi-bulbs/products/wifi-mini-rbg-soft-white

Thanks for all your hard work!

When adding to the ISY, what node type do the bulbs show up as (either "MagicHome RGB LED" or "MagicHome RGBW LED").  Warm White support should be included but it's only if the bulb reports it has that capability.  That being said, I haven't tested the warm white functionality myself because I don't have any bulbs capable of warm white.

This node server is using a python project to implement control of the bulbs.  If you could, please run the following from a terminal on the box running polyglot.  The required python packages should be installed because you're already running the node server.

python -m flux_led -sSti

Let me know what the output is for one of the bulbs you're interested in.

Link to comment
Share on other sites

flux_led was not installed.

After installing, re-boot, delete the light then re-discover, it still shows as a MagicHome RGB LED. It shows in the MagicHome app as RGB +Warm white.

The center of the color picker has the WW and CW buttons when the light is chosen. The cool white is achieved using the RGB led's but the WW has its own separate led"s.

633021254_ScreenShot2018-06-06at5_43_00PM.png.54d41ab3470097f7f0fbb4705f8f473b.png

Link to comment
Share on other sites

@markv58, the second bit in the raw state you pasted is the bulb type.  That corresponds to 0x44 in hex, which isn't included in the list of bulbs that are rgbw capable in the underlying flux_led project on github.  As a test, you could try updating the underlying flux_led code on your local machine to test with that bulb.  If it works out we could submit a pull request to have the project owner make it permanent.

"pip3 show flux_led" will show you the location of that package.  Then in the flux_led folder, edit the __main__.py file to include a new line after line 699 in the "update_state" function:

rx[1] == 0x44 or

Let me know if that works out.  You might need to delete the node in the ISY so that it gets re-added as an RGBW bulb.

Link to comment
Share on other sites

That did the trick!

Setting White to anything other than 0 overrides any RGB settings and turns on the WW led's in the light.

If you "Set color to" Warm White it uses RGB to attempt that.

Definitely workable,

Thank you!

Link to comment
Share on other sites

  • 2 weeks later...
19 hours ago, markv58 said:

I am having to double-tap on and off to get devices to update. It's random devices at any given time but all are affected.

 

Screen Shot 2018-06-16 at 2.30.53 PM.png

The magichome bulbs don't broadcast their status when they change.  The node server queries the bulb for its status immediately after issuing a command but it looks like the new status is not necessarily available immediately.  When issuing the second command the status has been updated so the node server sees it when querying that second time.  Alternatively, the status would get updated in ISY on the next poll, but that could be a little while.

I updated the node server to version 2.0.3 to wait a second before querying the bulb after issuing a command.  One second might feel a little sluggish so the delay time can optionally be overridden with any float value by specifying a key of "delay" in the polyglot node server's custom configuration.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.5k
    • Total Posts
      367.6k
×
×
  • Create New...