sidoh / esp8266_milight_hub

Replacement for a Milight/LimitlessLED hub hosted on an ESP8266

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Editing the Interface

KitKat-ok opened this issue · comments

How can I change the web interface? changing the index.html doesnt seem to do anything

It needs to be compiled. There's a script that does it here, although you'll need to install node and npm:

https://github.com/sidoh/esp8266_milight_hub/blob/master/.build_web.py

ultimately everything winds up in this compiled progmem string, which is what's served from the web interface:

https://github.com/sidoh/esp8266_milight_hub/blob/master/dist/index.html.gz.h

going to close this since it was a question, but feel free to keep the discussion going if you have followups.

I get an error when I try to execute it @sidoh
Traceback (most recent call last): File "/esp8266_milight_hub/.build_web.py", line 8, in <module> Import("env") ^^^^^^ NameError: name 'Import' is not defined

It's run as a part of the platformio build. I don't think you can run it directly. You'll need to compile and upload a firmware image with something like platformio run -e d1_mini -t upload. That should build the web image.

Oh it works now thanks. I have another question how can I set the state of a bulb like turn it on or off in the arduino code ??

I cant get it to work can you explain it a bit further? @sidoh

The rough flow is something like this:

const uint16_t deviceId = 1234;
const uint8_t groupId = 1;
// config is a MiLightRemoteConfig. there are constants available. For example, FUT096Config is for rgbw
auto config = FUT096Config;

milightClient->prepare(&config, deviceId, groupId);
// call any methods on milightClient to change state:
milightClient->updateStatus(MiLightStatus::ON);
milightClient->updateBrightness(255);