probonopd / ESP8266HueEmulator

Emulate a Philips Hue bridge running on an ESP8266 using the Arduino IDE.
MIT License
411 stars 93 forks source link

I can't compile the code #99

Open Stefankante opened 6 years ago

Stefankante commented 6 years ago

Please advise for any mistake I did. I can't get through this. Thank you so much

WARNING: Category '' in library Digole is not valid. Setting to 'Uncategorized'
In file included from /Volumes/XRAIDDrive/GMMTV/Download/ESP8266HueEmulator-master/ESP8266HueEmulator/ESP8266HueEmulator.ino:19:0:
/Users/thom/Documents/Arduino/libraries/aJson-master-2/aJSON.h:92:6: error: conflicting return type specified for 'virtual int aJsonStream::flush()'
  int flush();
      ^
In file included from /Users/thom/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/Stream.h:26:0,
                 from /Users/thom/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/HardwareSerial.h:31,
                 from /Users/thom/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/Arduino.h:246,
                 from sketch/ESP8266HueEmulator.ino.cpp:1:
/Users/thom/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/Print.h:93:22: error:   overriding 'virtual void Print::flush()'
         virtual void flush() { /* Empty implementation for backward compatibility */ }
                      ^
exit status 1
Error compiling for board WeMos D1 mini Pro.
probonopd commented 6 years ago

Which exact operating and version and which exact Arduino and libraries versions are you using?

We are building on Ubuntu 14.04 using

source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
mkdir -p $HOME/arduino_ide/libraries/
cd $HOME/arduino_ide/libraries/
git clone --branch 2.1.4 https://github.com/Makuna/NeoPixelBus.git
git clone https://github.com/interactive-matter/aJson.git
git clone https://github.com/PaulStoffregen/Time.git
git clone https://github.com/gmag11/NtpClient.git
sed -i -e 's|#define PRINT_BUFFER_LEN 256|#define PRINT_BUFFER_LEN 4096|g'  aJson/aJSON.h
cd -
sed -i -e 's|#include "/secrets.h"|//#include "/secrets.h"|g' ESP8266HueEmulator/ESP8266HueEmulator.ino
sed -i -e 's|//const char|const char|g' ESP8266HueEmulator/ESP8266HueEmulator.ino
build_platform esp8266
Stefankante commented 6 years ago

I'm on OSX Sierra 10.12.6 with Latest Arduino and all libraries just downloaded and install. I'll try to use terminal for your advise.

Stefankante commented 6 years ago

I still can't get through that error after try to wipe any installed library and reinstall as describe in Command line.

probonopd commented 6 years ago

Do you have any chance to build it on Ubuntu 14.04 using the exact steps from above? This is the only configuration I have tested this on. Thanks.

Stefankante commented 6 years ago

I have ever touch anything about linux before. I'll try it. Thanks.

Stefankante commented 6 years ago

I have result! Thank you so much for help. Now I can compile and upload to the WEMOS D1 mini board.

As I have latest version and old version installed for test each time. Turn out that I have to use ESP8266 Board library version 2.3, Other version newer or older didn't compile at all. I tested on both Ubuntu 16 and OSX Sierra.

But as I flash the board. In the beginning it worked after I have some lunch and get back soldering WS2812 for test. It didn't work again. (not related to compile issue.)

Flashing with 3M SPIFFS did work few times before at the beginning and then got #95 issue. Flashed with 1M SPIFFS did work few times as well but then it can be discoverable by HUE app but not connect at all. I read all issue related to this but I have no clue how to solve at all.

narfel commented 6 years ago

I'm probably not helping much, but i can confirm the exact same thing. Had to use 2.3 core to get rid of the return type of flush() error and running subsequently into watchdog resets no matter what SPIFFS i choose. I'm on Linux Mint Mate 18.3, with a WeMos D1 Mini board. The Watchdog resets occur before i could possibly check if SSDP discovery would work, though. Is there a special reason you stay on 2.3?

Stefankante commented 6 years ago

I use this setting in Arduino flash option.

https://ibb.co/hp60bm

Just guess that some issue post stated that memory is not enough. So I decided go no SPIFFS. It's working but with crash which it happened and get exception (28) which made it unusable before after crash.

But with no SPIFFS I get it working after it restart.

https://youtu.be/f3rWZggYqII

probonopd commented 6 years ago

Is there a special reason you stay on 2.3?

I am currently not developing this any further due to lack of time, but I am willing to merge pull requests that improve things - as long as the code still compiles in the continuous builds.

gerardwr commented 6 years ago

Installed this code acc. the README.

Compiling the latest code (Arduino 1.8.4 + ESP8266 version 2.3) gave me many warnings and several compile errors, mainly in the Neopixel code. I tried to solve them but did not succeed.

After I removed the specific Neopixel code from the sketch the sketch compiled and ran OK.

The Hue emulator on ESP8266 is recognised by the IOS Hue Gen 1 App as a valid bridge witch 2 lights. Switching the lights in the App ON/OFF and setting RGB levels result in corresponding messages in the Arduino Serial Monitor.

So the Hue emulation part of the latest code works.

I added some calls to the Adafruit-Neopixel library and, using the IOS App can now switch the Neopixels connected to the ESP8266 ON and OFF.

Also tried the latest IOS Hue App (Gen 2?). Connecting the App to the bridge was initiated (messages flying in the Serial monitor) but in the ESP8266 crashed, and remained crashing when booted. I assume some flash locations were damaged, maybe due to buffer overruns?

ppsagarnaga commented 6 years ago

@Stefankante Thank you, I tried with the no SPIFFS setting for my generic ESP8266 and it worked with Phillips HUE Gen 1 app. But with Phillips HUE Gen 2 app it crashes the ESP trying to save the setting from the 2 lamps as @gerardwr said. Any workaround for making work with gen 2 app? Oh one more thing!... I tried with Razer synapse 3 beta (they added a phillips hue integration) it detects the emulator but it ask to update with gen 2 app.

gerardwr commented 6 years ago

Today I recompiled my already running sketch from a few days ago and it threw this error and stopped compiling:

On Mac Os X, Arduino 1.8.4, Arduino-ESP 2.3.0.

sketch/SSDP.cpp:257:5: note: in expansion of macro 'IP2STR'
     IP2STR(&ip), _port,

After I changed the lwIP setting from V2 to Prebuild it compiled fine.

schermafbeelding 2018-02-04 om 12 32 51

Be warned!

mariusmotea commented 6 years ago

Razer implemented Hue Entertainment protocol that is secondary listening service in new Hue Bridge. Is based on udp steaming encrypted with dtls 1.2 psk. This is the reason why is asking for upgrade.

ppsagarnaga commented 6 years ago

Yes, you're right. I reached to the razer insider forums. Sadly it works only with bridge v2 and the new protocol.

gerardwr commented 6 years ago

The sketch in the ZIP file below compiles and runs OK for me on Mac Os X, Arduino 1.8.4, Arduino-ESP 2.3.0, ESP8266 board Wemos D1 Mini

The bridge is now discovered OK and the 2 lamps can be controlled nicely by the following Apps:

Bridge can not be used by:

Let us know how it goes if you try it. If you get the original version from @probonopd running let us know, I will be happy to dump my version for the original one.

ESP8266HueEmulator_Neopixel_stripped_beta.zip

gibman commented 6 years ago

A word of warning for those compiling against ESP lib 2.3.

Look at my conclusion at the end of the page here. https://github.com/probonopd/ESP8266HueEmulator/issues/105

gibman commented 6 years ago

For those wanting to compile against 2.4.0 or even the latest master from git repository follow this:

Delete both the SSDP.h and SSDP.cpp files, as they are now part of the 2.4.0 package.

In ESP8266HueEmulator.ino

//#include "SSDP.h"

include


Edit aJSON.h //int flush(); virtual void flush();


and edit aJSON.cpp / int aJsonStream::flush() { int in = this->getch(); while(in != EOF) { in = this->getch(); } return EOF; }/

void aJsonStream::flush() { int in = this->getch(); while(in != EOF) { in = this->getch(); } // return EOF; }


I've compiled this on windows 10 using latest arduino IDE 1.9.0 beta + ESP lib 2.4.0 latest master source

gerardwr commented 6 years ago

@gibman

I can confirm that compiling my sketch in Arduino 1.8.4 + 2.4.0 succeeds after your suggested changes.

NOTE 1 : The LightService.ccp tab also references SSDP.h, so I made this additional change there:

//#include "SSDP.h"
#include <ESP8266SSDP.h>

NOTE 2 : I had to select lwIP 1.4, lwIP V2 caused a looping wdt reset

schermafbeelding 2018-02-15 om 12 13 02

Thx for sharing.

debsahu commented 6 years ago

Can someone create a PR and/or add to readme/wiki? aJson needs fixing as well.

plabonhasan commented 6 years ago

hello dear can u help me? uplode is error

C:\Users\hasan\Music\ESP8266HueEmulator-master\ESP8266HueEmulator\ESP8266HueEmulator.ino:15:21: fatal error: secrets.h: No such file or directory

include

piotrekcrash commented 6 years ago

include "/secrets.h" // Delete this line and populate the following

//const char* ssid = "****"; //const char* password = "****";

Like described in code, delete this line with secrets.h import and enable lines with your wifi user and password