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. Troubleshooting
  3. Comminucation without controller

Comminucation without controller

Scheduled Pinned Locked Moved Troubleshooting
12 Posts 2 Posters 3.6k Views 1 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.
  • C C.r.a.z.y.

    Sometimes i forgot to plug usb serial and my sensors, relays stoped after 2-3 times what they do normaly. Is there any way if these nodes stop working than reboot itself? Or any idea to keep working?

    C Offline
    C Offline
    C.r.a.z.y.
    wrote on last edited by
    #2

    How can i get "fail" to a String from serial monitor?

    send: 51-51-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0

    1 Reply Last reply
    0
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #3

      You get a fail if no hw-ack is received from the recipient.

      C 1 Reply Last reply
      0
      • hekH hek

        You get a fail if no hw-ack is received from the recipient.

        C Offline
        C Offline
        C.r.a.z.y.
        wrote on last edited by
        #4

        @hek Thank you but my goal is to keep it working when there is no controller. My light will not be on or off if there is no controller so i want to add a some code like this;
        "
        re = String(message.sensor);
        if (re.indexOf("fail") >=0)
        {
        asm volatile (" jmp 0"); //reboot
        }
        "

        hekH 1 Reply Last reply
        0
        • C C.r.a.z.y.

          @hek Thank you but my goal is to keep it working when there is no controller. My light will not be on or off if there is no controller so i want to add a some code like this;
          "
          re = String(message.sensor);
          if (re.indexOf("fail") >=0)
          {
          asm volatile (" jmp 0"); //reboot
          }
          "

          hekH Offline
          hekH Offline
          hek
          Admin
          wrote on last edited by
          #5

          @C.r.a.z.y.

          Sorry, I don't understand what your setup looks like or what your´re trying to archive.

          C 1 Reply Last reply
          0
          • hekH hek

            @C.r.a.z.y.

            Sorry, I don't understand what your setup looks like or what your´re trying to archive.

            C Offline
            C Offline
            C.r.a.z.y.
            wrote on last edited by
            #6

            @hek I am using Relay with Button sketch. When there is no controller-no hw-ack, my lights work 2-3 more times and i got "fail" then i can't change the lights state manually.

            When i see "fail" i have to restart the nano.

            1 Reply Last reply
            0
            • hekH Offline
              hekH Offline
              hek
              Admin
              wrote on last edited by
              #7

              The hw ack is handled by the library/radio itself. Controller is not involved.

              So, what is your button sketch communicating with?

              1 Reply Last reply
              0
              • C Offline
                C Offline
                C.r.a.z.y.
                wrote on last edited by
                #8

                This Sketch works 1 on and 1 off when there is no controller;

                repeater started, id 0
                send: 0-0-0-0 s=255,c=0,t=18,pt=0,l=5,st=fail:1.4.1
                send: 0-0-0-0 s=255,c=3,t=6,pt=1,l=1,st=fail:0
                send: 0-0-0-0 s=255,c=3,t=11,pt=0,l=5,st=fail:Relay
                send: 0-0-0-0 s=255,c=3,t=12,pt=0,l=3,st=fail:1.0
                send: 0-0-0-0 s=1,c=0,t=3,pt=0,l=5,st=fail:1.4.1
                **send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
                send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
                **


                "#include <MySensor.h>
                "#include <SPI.h>
                "#include <Bounce2.h>

                "#define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
                "#define NUMBER_OF_RELAYS 1 // Total number of attached relays
                "#define RELAY_ON 1 // GPIO value to write to turn on attached relay
                "#define RELAY_OFF 0 // GPIO value to write to turn off attached relay
                "#define CHILD_ID 1

                "#define TRIGGER_PIN 7 // Arduino pin tied to trigger pin on the ultrasonic sensor.
                unsigned long SLEEP_TIME = 700; // Sleep time between reads (in milliseconds)

                MySensor gw;
                //int hey =50;

                int dist;
                int kac;
                int value;
                int oldValue=0;
                bool state;
                Bounce debouncer = Bounce();
                Bounce debouncer2 = Bounce();
                MyMessage msg(CHILD_ID, V_LIGHT);

                void setup()
                {
                gw.begin(incomingMessage, AUTO, true);
                gw.sendSketchInfo("Relay", "1.0");
                for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
                gw.present(sensor, S_LIGHT);
                pinMode(pin, OUTPUT);
                state = gw.loadState(CHILD_ID);
                digitalWrite(pin, state?RELAY_ON:RELAY_OFF);
                }
                debouncer.attach(TRIGGER_PIN);
                debouncer2.attach(RELAY_1);
                debouncer.interval(5); debouncer2.interval(5);
                }

                void loop()
                {
                gw.process();
                debouncer.update();
                dist = debouncer.read();
                debouncer2.update();
                kac = debouncer2.read();

                if (dist == 0) 
                 {
                    if(kac==0  ) //MANUAL ON-OFF
                     {   
                     digitalWrite(RELAY_1, HIGH );  // gw.send(msg.set(1));   
                     delay(1000); //  gw.sleep(SLEEP_TIME); 
                     }
                    else  //MANUAL ON-OFF
                     {  
                      digitalWrite(RELAY_1, LOW );   // gw.send(msg.set(0));   
                       delay(1000);//  gw.sleep(SLEEP_TIME); 
                     }
                 }
                 
                 //NORMAL PROCESS FOR MYSENSORS.h
                  if (dist != oldValue && dist==0) {
                
                   gw.send(msg.set(state?false:true), true); // Send new state and request ack back
                   } 
                
                   oldValue = dist;
                  }
                

                void incomingMessage(const MyMessage &message) {
                if (message.type==V_LIGHT) {
                // digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
                gw.saveState(message.sensor, message.getBool());
                Serial.print("Incoming change for sensor:");
                Serial.print(message.sensor);
                Serial.print(", New status: ");
                Serial.println(message.getBool());
                }

                }

                1 Reply Last reply
                0
                • hekH Offline
                  hekH Offline
                  hek
                  Admin
                  wrote on last edited by
                  #9

                  Wierd. even if the node loses it's parent it should retry finding a new each time you press the "button" and send a new state.

                  1 Reply Last reply
                  0
                  • hekH Offline
                    hekH Offline
                    hek
                    Admin
                    wrote on last edited by
                    #10

                    There has been a few edge-case bugfixes done recently on github/master.
                    Could you just download latest and try the again to check if it has been fixed already?

                    1 Reply Last reply
                    0
                    • hekH Offline
                      hekH Offline
                      hek
                      Admin
                      wrote on last edited by
                      #11

                      repeater started, id 0

                      You cannot use id=0 for a repeater node.
                      Id 0 is reserved for gateway.

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        C.r.a.z.y.
                        wrote on last edited by
                        #12

                        New master file didn't make difference. When i see "fail" i can't change the state with original RelayWithButtonActuator sketch.

                        Ok id is not "0" now.

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


                        19

                        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