diff --git a/code/espurna/light.ino b/code/espurna/light.ino index 76593998..d4ab10b3 100644 --- a/code/espurna/light.ino +++ b/code/espurna/light.ino @@ -43,10 +43,6 @@ struct channel_t { }; std::vector _light_channel; -bool _light_dirty = false; -bool _light_state = false; -bool _light_use_transitions = false; -unsigned int _light_transition_time = LIGHT_TRANSITION_TIME; bool _light_has_color = false; bool _light_use_white = false; bool _light_use_cct = false; diff --git a/code/espurna/rpnrules.ino b/code/espurna/rpnrules.ino index 39cab2ac..1e6dac5d 100644 --- a/code/espurna/rpnrules.ino +++ b/code/espurna/rpnrules.ino @@ -21,13 +21,12 @@ unsigned long _rpn_last = 0; // ----------------------------------------------------------------------------- -bool _rpnWebSocketOnReceive(const char * key, JsonVariant& value) { +bool _rpnWebSocketOnKeyCheck(const char * key, JsonVariant& value) { return (strncmp(key, "rpn", 3) == 0); } -void _rpnWebSocketOnSend(JsonObject& root) { +void _rpnWebSocketOnConnected(JsonObject& root) { - root["rpnVisible"] = 1; root["rpnSticky"] = getSetting("rpnSticky", 1).toInt(); root["rpnDelay"] = getSetting("rpnDelay", RPN_DELAY).toInt(); JsonArray& rules = root.createNestedArray("rpnRules"); @@ -296,8 +295,10 @@ void rpnSetup() { // Websockets #if WEB_SUPPORT - wsOnSendRegister(_rpnWebSocketOnSend); - wsOnReceiveRegister(_rpnWebSocketOnReceive); + wsRegister() + .onVisible([](JsonObject& root) { root["rpnVisible"] = 1; }) + .onConnected(_rpnWebSocketOnConnected) + .onKeyCheck(_rpnWebSocketOnKeyCheck); #endif // MQTT