Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Feature Requests
  3. delayed startup for mysens-features

delayed startup for mysens-features

Scheduled Pinned Locked Moved Feature Requests
5 Posts 2 Posters 1.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    easy
    wrote on last edited by
    #1

    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

    mfalkviddM 1 Reply Last reply
    0
    • E easy

      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

      mfalkviddM Online
      mfalkviddM Online
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      @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.

      1 Reply Last reply
      0
      • E Offline
        E Offline
        easy
        wrote on last edited by
        #3

        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

        mfalkviddM 1 Reply Last reply
        0
        • E easy

          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

          mfalkviddM Online
          mfalkviddM Online
          mfalkvidd
          Mod
          wrote on last edited by
          #4

          @easy I see. I think putting your code in before() will do what you want.

          1 Reply Last reply
          0
          • E Offline
            E Offline
            easy
            wrote on last edited by
            #5

            great, this it was where i looking for.
            thanks

            1 Reply Last reply
            1
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            11

            Online

            11.7k

            Users

            11.2k

            Topics

            113.1k

            Posts


            Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • MySensors
            • OpenHardware.io
            • Categories
            • Recent
            • Tags
            • Popular