diyhue / diyHue

Main diyHue software repo
https://diyhue.org/
Other
1.58k stars 279 forks source link

How to get this work on MacOS Mojave? #6

Closed chrisdata closed 5 years ago

chrisdata commented 5 years ago

Hi, I'm a total newbie and I tried my very best to install but still failed. Here's my log when I perform: python3 HueEmultator3.py

MacBook-Pro:BridgeEmulator chrischua$ python3 HueEmulator3.py File "/usr/local/bin/ip", line 39 print 'Executing: %s' % cmd ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print('Executing: %s' % cmd)? cat: /sys/class/net//address: No such file or directory Traceback (most recent call last): File "HueEmulator3.py", line 61, in <module> dockerMAC = check_output("cat /sys/class/net/$(ip -o addr | grep " + HostIP + " | awk '{print $2}')/address", shell=True).decode('utf-8')[:-1] File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 389, in check_output **kwargs).stdout File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 481, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command 'cat /sys/class/net/$(ip -o addr | grep 192.168.0.134 | awk '{print $2}')/address' returned non-zero exit status 1.

mariusmotea commented 5 years ago

Unfortunetly this require some small customization to run in on MacOS. I recommend to run it in docker container or ubuntu machine in virtual box

chrisdata commented 5 years ago

OK, I finally get it running succesfully on VirtualBox on Mac with Ubuntu. Now it able to find the Emulator in Hue iOS app, but asking to press the Link button, I click on the Activate Web UI from diyhue but it nothing happened, what's wrong?

mariusmotea commented 5 years ago

Hmm, I hope you connect that Ubuntu VM directly to mac network adapter, because it needs his on mac + ip on your network. Try to wipe hue app data, maybe while you play it cache a certificate that need to be deleted.

mariusmotea commented 5 years ago

I forget, be sure you generate the certificate while the network is properly setup because the generated cert is based on mac address of the main interface. So better delete the cert in /opt/hue-emulator/cert.pem, run again the installation script and wipe the hue app data (on iPhone reinstall the app)

chrisdata commented 5 years ago

Thanks! it works now I just rerun the install script and reinstall iOS hue app. Does this emulator work with MacOS Hue Sync app?

mariusmotea commented 5 years ago

yes, you may face one issue if hue entertainment broadcast remain on. Keep in mind that only ESP8266 are in realtime sync, for others you may see a 0.5 sec delay

chrisdata commented 5 years ago

Thanks, I get it all working now but after I reboot my system it seem failed to connect. Especially the link button things. Any easy solution? I'm actually bought several Yeelight V2 RGB bulbs, and few strip plus arriving tomorrow just to mimic Hue bridge so I can use those awesome Hue third-party app like DJLight etc.

mariusmotea commented 5 years ago

Can be multiple reasons, check if something else is listening on the ports used by hue-emulator. Perform the debugging specified in Wiki. Probably you can see what is the issue by executing: cd /opt/hue-emulator && sudo ./HueEmulator3.py. Paste here the error if is not something you can't understand.

chrisdata commented 5 years ago

I typed the cmd you list above and I get a lot of: "GET /api/config HTTP/1.1" 200 -

I was trying use Ambee app on iOS to find the emu bridge, until it prompt me to press the link button, I press on the web UI "Activate" button but it can't add it, and it go back to the searching stage, why's that?

There's no any app using the port 80.

mariusmotea commented 5 years ago

I have no clue what happened but i believe is possible the mac address or something at vm network level changed. Try from you mac (not ubuntu vm) the command curl https://{vm ip}/api/nouser/config -v -k . The verbose will show the CN of the certificate. Check if the prefix and suffix is identical with the mac address of the VM. Also check if the ip from the command output json is the one that the vm is currently using.

chrisdata commented 5 years ago

I checked with the command curl thing on Mac and it all seem working fine. They both have the same MAC address and correct CN & IP no. (in my case which is 192.168.0.133) Here's the verbose: `

Now I able to get my Light DJ app working, but I can't connect with iControlHue app, it used to be fine before, what else can I try?

chrisdata commented 5 years ago

Also a newbie question, how to update the repo in Ubuntu? Thanks

mariusmotea commented 5 years ago

sudo apt update && sudo apt upgrade. For ios app's i cannot provide too much support because i don't use.

chrisdata commented 5 years ago

Sorry I may not say correctly, how to update diyhue repo ? I typed the code it seem update Ubuntu itself?

ghost commented 5 years ago

If you used the easy installer, Delete everything in the /opt/hue-emulator folder apart from cert.pem and the config file. Then re-run the easy install script. If you did a manual install. Delete your existing install, but backup your cert.pem and config. Then reinstall following the same steps you used to install it the first time. After that just replace cert.pem and the config with your backed up versions. For docker just stop and remove the running container, pull the latest image and then container again with the same command you used to start it the first time.

mariusmotea commented 5 years ago

@cheesemarathon the easy installer script preserve config.json and cert.pem files, so only the execution of this script is needed to upgrade the hue emulator code.

ghost commented 5 years ago

Ah! Even easier!

On 14 Dec 2018 8:24 am, "Motea Marius" notifications@github.com wrote:

@cheesemarathon https://github.com/cheesemarathon the easy installer script preserve config.json and cert.pem files, so only the execution of this script is needed to upgrade the hue emulator code.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/diyhue/diyHue/issues/6#issuecomment-447251441, or mute the thread https://github.com/notifications/unsubscribe-auth/APkprCBfizP97xAL-SOzPOSWQXcV941Lks5u42AsgaJpZM4ZLkSH .

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically closed as it has not had any recent activity. Thank you for your contributions.