mariusmotea / diyHue

Philips Hue emulator that is able to control multiple types of lights
Other
627 stars 107 forks source link

Installing HueGateway and MiLight Bridge on Raspberry Pi #114

Closed delta544 closed 6 years ago

delta544 commented 6 years ago

Hi Marius,

as mentioned within the YT comment I opened up a ticket here. Description I want to make controll my Trådfri bulbs (later on Sensors as well) and MiLight bulbs via a Central unit. Also at a later stage I want to add a Z-Wave USB stick in order to controll PowerPlug with PowerMeter function. Currently I am using a Raspberry Pi 3, with a ZigBee (Raspbee) GPIO Module provided by Dresden Elektronik. There are at the moment 2 Trådfri GU10 bulbs and 1 E24 + the Trådfri Gateway and 1 Trådfri Remote control (203.033.17). After your comment within the YT video I checked with DeConz and I can find at least the 2 GU10 Trådfri bulbs In addition I got 2 GU MiLight FUT018 bulbs and I will recieve a WiFi iBox Controller V2 these days. I followed the tutorial from Christopher Mullins to build up a MiLight Bridge by flashing a precompiled firmware to the NodeMCU. This seems to work in general, but when I want to sniff traffic nothing happens, like there is no traffic.

Current status I found your DIY Hue tutorial 2 days ago and tried to follow that one according to the Wiki page, but the service seems to stop after starting it. Also, all mentioned http links do not work. After some research I found your Video on YT and at the moment I think the Wiki is missing the part with the Apache2 and MySQL installation. In addition to that PHP5 does not have a install candidate with the latest Rasbian image.

So, as I said I am totally new to this topic and probably I am wrong but I can not connect the dots between your YT Video, your DIY Hue (RaspBee) and MiLight Gatway and later on used Apps on Android devices.

I will probably need to start over with a new Rasbian installation and go from there. How can I check if the DIY MiLight Gatway works properly? Should the DIY MiLight show network traffic when I use the 'sniffing' option on the webpage? Or will I only see something when these bulbs are connected to a MiLight Remote control and sending commands to them?

kind regards, Andreas

mariusmotea commented 6 years ago

Hi,

What you saw there is legacy, i write this in a comment, so i guess the problem is that you mix the informations. Starting with version 2.0 the solution is based on python, there is just a python script with a default json configuration. First start with default configuration and pair Hue Application from phone hue emulator, then setup deconz and milight hub. If you already install deconz, then be sure it is not running on port 80, because this port is needed for HueEmulator.py (i write in wiki how to run deconz as service on port 8080)

I recommend to start manually HueEmulator.py script sudo ./HueEmulator.py to see the output and the reason why it stop (port 80 already in use by some applications like apache, deconz, etc... config.json file is missing or correupted)

In order to debug your problems paste here the output from HueEmulator.py script (this is the main reason why i ask to run it manually), and provide an url to your config.json file (ex: pastebin) to see what you have inside.

at a later stage I want to add a Z-Wave USB stick in order to controll PowerPlug

This is not supported, for the moment only Raspbee module can be used for zibbee communication.

How can I check if the DIY MiLight Gatway works properly?

First you need to pair the MiLight bulbs with a remote code (choose any code, random). Milight Hub has an internal webgui, From there you can setup the code, channel and bulb type, then turn on the light and in the first 5 seconds you must press pair button. you can use same code, but different channels for your lights. After you have paired the bulbs and you are able to control them from webgui, follow the wiki and access the milight setup page, put there the milight hub ip, code, channel and bulb type and click add. do this for every milight light. Check if you are able to control from hue application.

here you can find useful infromations: https://github.com/mariusmotea/diyHue/issues/20

https://github.com/mariusmotea/diyHue/issues/43 - this can be a little outdated.

Marius.

delta544 commented 6 years ago

Hi Marius,

will try your suggestion later today. But I will start over with a fresh Rasbian installation just to be sure that I did not mess up anything at a earlier stage. For the DIY MiLight Brigdge: Does that mean I put anything I want to the 'Binding' field and see if other MiLight bulbs just answer and 'refuse' these binding request and by doing that I can use that to figure out which address is the correct one? If yes, that would be great.

kind regards, Andreas

mariusmotea commented 6 years ago

Hi,

The pair process with milight bulbs is this: Milight remotes have unique codes and by pairing one bulb with one remote you tell to that bulb to react only when receive a signal from that remote id with exactly the same channel that was selected during pair process. With milight hub you can emulate any remote you want because you can manually specify the remote code. Once you pair successfully one bulb with milight hub you will have all the details to complete the milight form from HueEmulator.

delta544 commented 6 years ago

Hi Marius,

regarding the starting of the HueEmulator script by folloing the Wiki page I figoured out that the script which is calling HueEmulator.py has 2 typos: startscr

Regarding deConz: Installing wasn´t an issue by following the Instructions from Dresden Elektronik. I modified the configuration according your Wiki page, but when starting the HueEmulator I am not sure if deConz is started properly. Because open http://HueGateway:8080 leads to an empty page. Only when I start deConz from the GUI it will open http://HueGatewayIP:8080 Nevertheless: Android App will find a HueGateway at the IP of the Raspberry. But it will not find any Tradfri Bulbs. Within deConz WebUI it will find them: deconzwebui

Regarding MiLight Hub: I entered a random device ID into the WebUI: randdeviceid Afterwards I enabled the sniffing and used the 'Pairing' Button, which got me these results: sniffing My MiLight GU10 bulbs are classified as FUT018 RGBW But They can not be controlled by the WebUI, which makes me thinking that they are not paired correctly.

Will also add a Puttylog when running HueEmualtor.py manually. There are some 404 errors but I can not relate them to a specific problem. 04_12_2017_192.168.10.17_205626.log

Basically it seems to work, but my devices can not be controlled by HueApp or DIY MiLight Hub.

Hopefully I could shed some light into my issue.

kind regards, Andreas

mariusmotea commented 6 years ago

Nice that you added print screens.

Update with my deconz: image

update2: my deconz systemd file

pi@raspberrypi:~ $ cat /etc/systemd/system/deconz.service 
[Unit]
Description=deCONZ: ZigBee gateway -- REST API
Wants=deconz-init.service deconz-update.service

[Service]
User=pi                                                                                                                                                                                      
ExecStart=/usr/bin/deCONZ -platform minimal --http-port=8080 --upnp=0                                                                                                                        
Restart=on-failure                                                                                                                                                                           
StartLimitInterval=600                                                                                                                                                                       
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_KILL CAP_SYS_BOOT CAP_SYS_TIME                                                                                                                  

[Install]                                                                                                                                                                                    
WantedBy=multi-user.target                                                                                                                                                                   
pi@raspberrypi:~ $      

start the service with systemctl start deconz, but before it will ask to reload systemd with a command because of file change, execute it.

update 3: don't sniff with milight hub, this function si to detect remote codes, but i guess you don't have any remote to generate traffic.

delta544 commented 6 years ago

Hi Marius,

currently my Trådfri GU10 bulbs are connected to a original Trådfri Gateway, I will try later to configure them within the HUE app. Regarding the MiLight: Since these are also GU10 there is probably no way to modify them and convert them into WiFi bulbs like you did with the E27. So, I ordered a MiLight Gateway which will arrive probably today or tomorrow. So I will configure the Gateway with the MiLight Hub, that should be possible right?

kind regards, Andreas

mariusmotea commented 6 years ago

currently my Trådfri GU10 bulbs are connected to a original Trådfri Gateway, I will try later to configure them within the HUE app.

bulbs can be connected to both Tradfri Gateway of Raspbee, but remotes must be connected to Raspbee in order to have extra futures (multiple remotes/sensors per room, etc). Ikea push a new firmware that brake compatibility with Tradfri gateway. I push a new update to solve this, one user manage to use it, but is not properly tested.

Since these are also GU10 there is probably no way to modify them and convert them into WiFi bulbs like you did with the E27.

maybe not impossible, but much harder because lack of the space

So, I ordered a MiLight Gateway which will arrive probably today or tomorrow. So I will configure the Gateway with the MiLight Hub, that should be possible right?

this may work, but is not the proper way (app => emulator => hub => hub => bulb). If your problem is the bulb reset, then you will not be able to pair with MiLight Gateway also. Will work only if milight hub circuit is not working.

delta544 commented 6 years ago

Hi Marius,

OK, finally I got my MiLight gateway and after sniffing the traffic from the GateWay I got the correct device ID. After that my DIY Milight Gateway startet to work. - So this is solved.

Regarding the Tradfri I haven´t unpaired them yet, but will do that probably on Sunday since I am a bit busy at the moment. Will keep you posted.

kind regards, Andreas