Skip to content

Commit

Permalink
Swap to UserModHA to basic template, suitable for StartMod(core)
Browse files Browse the repository at this point in the history
  • Loading branch information
netmindz committed Apr 23, 2024
1 parent 2c94bda commit 29d86ff
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/User/UserModHA.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ class UserModHA:public SysModule {
// configure light (optional)
light->setName("LEDs");

String options = "Solid";
// for(int i = 0; i < eff->effects.effects.size(); i++) {
// options += ";";
// options += eff->effects.effects.at(i)->name();
// }
fxSelect->setOptions(options.c_str());

ppf("Options: %s\n", options.c_str());

// Optionally you can set retain flag for the HA commands
// light.setRetain(true);

Expand Down Expand Up @@ -102,13 +111,16 @@ class UserModHA:public SysModule {
mqtt->loop();
light->setCurrentBrightness(mdl->getValue("bri"));
light->setCurrentState(mdl->getValue("on"));
int8_t fx = mdl->getValue("fx");
fxSelect->setState(fx + 1);
}

private:
WiFiClient client;
HADevice device;
HAMqtt* mqtt = new HAMqtt(client, device);
HALight* light = new HALight(_INIT(TOSTRING(APP)), HALight::BrightnessFeature | HALight::RGBFeature);
HASelect* fxSelect = new HASelect("fx");
};

extern UserModHA *hamod;

0 comments on commit 29d86ff

Please sign in to comment.