delayed startup for mysens-features
-
hi,
i want to build an mqtt controlled led dimmer (4 cannel).
so i have an mysens mqtt gateway which is 24/7 running.now i build an actor node wich controls the led´s and has an mysens connection.
(in my case an arduino-nano with an nrf24 & pca9685)BUT...
the actor will only be powered if the light is switched on.- lightswitch -> ac power to powersupply -> dc power to arduino -> arduino boots up...
so i cant wait till mysens is registered to the gateay till the led´s will be powered.
(in my cas this is an delay about 4s)i will flash the arduino without bootloader and an feature that i can register the node at the gateway delayed. after the led are up-dimming after power on.
the connetion to mqtt (over mysens) will only be used to dimm the led´s not for switching on or off.
so i need an bit to start the init procedure for the mysens features.
thanks
easy
-
@easy welcome to the MySensors community!
I think you can use the same strategy as the Rotary coder dimmer example. It stores the last dimmer value in eeprom, and reads the value at startup.
Edit: I noticed that the example does not set the dimming level at startup though. You'll need to modify setup() to set the LED dimmer to the right value after the value has been fetched from EEPROM.
-
thanks, but sorry that is not what i want...
in my light controlers the led´s will fade to the ON value. (for examble 0-60% in 0,7 seconds)
(..or fade to any new changed value..)
for this fading i need time. at start i need loop for ca. 0,7s.actualy i found an dity way...
in the lib-file "MySensorsCore.cpp" i found this:
// Call sketch setup() (if defined) if (setup) { CORE_DEBUG(PSTR("MCO:BGN:STP\n")); // setup callback setup(); }
and changed to this:
// Call sketch setup() (if defined) //if (setup) { CORE_DEBUG(PSTR("MCO:BGN:STP\n")); // setup callback setup(); //}
aditional i put the fade on for the led´s to the setup() void.
into an while-loop wich is controlled by the millis() value.
after an time 1,5s i set an variable and the setup() will be jumped over for next call.after this the mysensors can connect.
and then the leds can be controlled over mqtt.can some one tell me an clean way, without changing the lib´s ?
thanks
easy
-
@easy I see. I think putting your code in before() will do what you want.
-
great, this it was where i looking for.
thanks
Suggested Topics
-
Controlling Blinds.com RF Dooya Motors with Arduino and Vera
My Project • 24 Mar 2014, 13:27 • petewill 12 Aug 2023, 16:39 -
ESPnow as transport layer
Feature Requests • 13 days ago • MasMat 13 days ago -
PJON on RS485
Feature Requests • 11 Apr 2022, 06:58 • hypnosiss 23 days ago -
ESP32 with builtin Ethernet as Gateway - f.e. WT32-ETH01
Feature Requests • 15 Mar 2023, 15:01 • gryzli133 15 Mar 2023, 21:25 -
Raspberry MQTT GW over TLS with rfm69
Feature Requests • 14 Sept 2022, 15:11 • Tico 16 Sept 2022, 07:23 -
wireless gateway
Feature Requests • 8 Jun 2023, 14:05 • Thomaswortman 8 Jun 2023, 14:05