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. Development
  3. battery level doesn't appear ?

battery level doesn't appear ?

Scheduled Pinned Locked Moved Development
25 Posts 6 Posters 7.4k Views 4 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.
  • F flylowgofast

    my loop(){}

    // the loop routine runs over and over again forever:
    void loop() {
    
      // Process incoming messages (like config from server)
      gw.process();  
    
      //---------------Lecture des ouvertures de porte------------------
      doorOpenOffState = digitalRead(HALLOFFICEDOOR); // lecture à chaque cycle (urgence)
      if (doorOpenOffState != doorOpenOffChange){
        gw.send(msgDoorOffice.setSensor(OFFICEDOOR).set(doorOpenOffState));
        doorOpenOffChange = doorOpenOffState;
      }
    
      doorOpenBedState = digitalRead(HALLBEDROOMDOOR); // lecture à chaque cycle (urgence)
      if (doorOpenBedState != doorOpenBedChange){
        gw.send(msgDoorBedroom.setSensor(BEDROOMDOOR).set(doorOpenBedState));
        doorOpenBedChange = doorOpenBedState;
      }
      
      if (digitalRead(ECLEXT) != oldInterExt){
        oldInterExt = !oldInterExt;
        eclState = !eclState;
        gw.send(msgLightSwitch.set(eclState));
      }
    
      //---------------Envoi du niveau de batterie !! pour rester eveillé------------------
      /*if ((millis() - myTime) > 10000) { // toutes les dix secondes
        myTime = millis();
        gw.sendBatteryLevel(97,1);
      } else {
        if ((millis() - myTime) < 0) {
          myTime = millis();
        }
      }*/
      gw.sendBatteryLevel(97,1);
    
    // ---------------Traitement volet 1-----------------
      analogUpV1 = analogRead(UPV1);
      if ((analogUpV1 <25) && !manOnV1) { //analogUp proche de zéro et ancienne valeur niveau haut (en l'air)
        digitalWrite(TRIAC5, HIGH);
        digitalWrite(TRIAC2, LOW);
        triacTempoV1 = millis();
        triacManPriorityV1 = true;
        manOnV1 = true;
        memoStopV1 = false;
      } else {
        analogDownV1 = analogRead(DOWNV1);
        if ((analogDownV1 <25) && !manOnV1) { //proche de zéro
          digitalWrite(TRIAC5, LOW);
          digitalWrite(TRIAC2, HIGH);
          triacTempoV1 = millis();
          triacManPriorityV1 = true;
          manOnV1 = true;
          memoStopV1 = false;
        } else {
          if (analogUpV1 > 800 && analogDownV1 > 800 && !memoStopV1){ // les deux fils en l'air
            digitalWrite(TRIAC5, LOW);
            digitalWrite(TRIAC2, LOW);
            triacManPriorityV1 = false;
            manOnV1 = false;
            memoStopV1 = true;
          } else {
            if (!triacManPriorityV1){
              if (shutterOff1State && shutterOff2State) {
                shutterOff1State = false;
                shutterOff2State = false;
                digitalWrite(TRIAC5, LOW);
                digitalWrite(TRIAC2, LOW);
              } else {
                if (shutterOff1State) {
                  shutterOff1State = false;
                  digitalWrite(TRIAC5, HIGH);
                  digitalWrite(TRIAC2, LOW);
                  triacTempoV1 = millis();
                } else {
                  if (shutterOff2State) {
                    shutterOff2State = false;
                    digitalWrite(TRIAC5, LOW);
                    digitalWrite(TRIAC2, HIGH);
                    triacTempoV1 = millis();
                  }
                }
              }
            }
          }
        }
      }
      if (((triacTempoV1 + TEMPOOPENV1) < millis())) {
        digitalWrite(TRIAC5, LOW);
        digitalWrite(TRIAC2, LOW);
        triacManPriorityV1 = false;
      }
    
    // --------------------------Traitement volet 2------------------------
      analogUpV2 = analogRead(UPV2);
      if ((analogUpV2 <25) && !manOnV2) { //analogUp proche de zéro et ancienne valeur niveau haut (en l'air)
        digitalWrite(TRIAC3, HIGH);
        digitalWrite(TRIAC4, LOW);
        triacTempoV2 = millis();
        triacManPriorityV2 = true;
        manOnV2 = true;
        memoStopV2 = false;
      } else {
        analogDownV2 = analogRead(DOWNV2);
        if ((analogDownV2 <25) && !manOnV2) { //proche de zéro
          digitalWrite(TRIAC3, LOW);
          digitalWrite(TRIAC4, HIGH);      
          triacTempoV2 = millis();
          triacManPriorityV2 = true;
          manOnV2 = true;
          memoStopV2 = false;
        } else {
          if (analogUpV2 > 800 && analogDownV2 > 800 && !memoStopV2){ // les deux fils en l'air
            digitalWrite(TRIAC3, LOW);
            digitalWrite(TRIAC4, LOW);        
            //triac3 = false;
            //triac4 = false;
            triacManPriorityV2 = false;
            manOnV2 = false;
            memoStopV2 = true;
          } else {
            if (!triacManPriorityV2){
              if (shutterBed1State && shutterBed2State) {
                shutterBed1State = false;
                shutterBed2State = false;
                digitalWrite(TRIAC3, LOW);
                digitalWrite(TRIAC4, LOW);            
              } else {
                if (shutterBed1State) {
                  shutterBed1State = false;
                  digitalWrite(TRIAC3, HIGH);
                  digitalWrite(TRIAC4, LOW);              
                  triacTempoV2 = millis();
                } else {
                  if (shutterBed2State) {
                    shutterBed2State = false;
                    digitalWrite(TRIAC3, LOW);
                    digitalWrite(TRIAC4, HIGH);                
                    triacTempoV2 = millis();
                  }
                }
              }
            }
          }
        }
      }
      if (((triacTempoV2 + TEMPOOPENV2) < millis())) {
        digitalWrite(TRIAC3, LOW);
        digitalWrite(TRIAC4, LOW);      
        triacManPriorityV2 = false;
      }
    }
    
    F Offline
    F Offline
    flopp
    wrote on last edited by
    #16

    @flylowgofast
    Look ok

    1 Reply Last reply
    0
    • F flylowgofast

      hello,
      here is logs from gateway

      2;4;1;1;3;70;0;3;0;9;send: 0-0-2-2 s=4,c=1,t=3,pt=0,l=1,sg=0,st=fail:7
      Finished
      0;0;3;0;18;PINGFinished
      2;4;1;1;3;70;0;3;0;9;send: 0-0-2-2 s=4,c=1,t=3,pt=0,l=1,sg=0,st=fail:7
      0;0;3;0;9;read: 1-1-0 s=255,c=3,t=0,pt=1,l=1,sg=0:97
      0;0;3;0;9;send: 0-0-1-1 s=255,c=3,t=0,pt=1,l=1,sg=0,st=ok:97
      1;255;3;0;0;97
      Finished
      0;0;3;0;18;PING0;0;3;0;9;read: 65-65-0 s=255,c=3,t=0,pt=1,l=1,sg=0:99
      0;0;3;0;9;send: 0-0-65-65 s=255,c=3,t=0,pt=1,l=1,sg=0,st=fail:99
      65;255;3;0;0;99
      0;0;3;0;9;read: 1-1-0 s=255,c=3,t=0,pt=1,l=1,sg=0:97
      0;0;3;0;9;send: 0-0-1-1 s=255,c=3,t=0,pt=1,l=1,sg=0,st=ok:97
      1;255;3;0;0;97
      Finished
      

      Is there a documentation to understand better ?

      thanks

      A Offline
      A Offline
      AWI
      Hero Member
      wrote on last edited by
      #17

      @flylowgofast for information on the logs take a look at the debug topic

      1 Reply Last reply
      0
      • F Offline
        F Offline
        flylowgofast
        wrote on last edited by
        #18

        My real problem is not to send battery level. I try to do that because after 24 or 48 hours my node stop sending messages . So, I hoped that was a way to make it awake !

        A F 2 Replies Last reply
        0
        • F flylowgofast

          My real problem is not to send battery level. I try to do that because after 24 or 48 hours my node stop sending messages . So, I hoped that was a way to make it awake !

          A Offline
          A Offline
          AWI
          Hero Member
          wrote on last edited by
          #19

          @flylowgofast From what I read from your sketch you seem to do some high voltage / current switching. Especially the radio doesn't like all kinds of electronic disturbances (emc etc.) To avoid lockups you need to pay special attention/separate power supplies (if you haven't done already).

          1 Reply Last reply
          0
          • F Offline
            F Offline
            flylowgofast
            wrote on last edited by
            #20

            Hello AWI,

            Thanks for your reply, yes my node trigs 5 triacs. I use snubber, regulator, capacitor. And ond the other hand, all commands to the node work properly ? just battery level doesn't work and after several hours NRF24L01 stop to work.
            I would like to reset NRF24L01 but with MySensors we don't have direct access to it anymore. Perhaps there is a way to reset the sketch globaly ?

            thanks for your help

            1 Reply Last reply
            0
            • F flylowgofast

              My real problem is not to send battery level. I try to do that because after 24 or 48 hours my node stop sending messages . So, I hoped that was a way to make it awake !

              F Offline
              F Offline
              flopp
              wrote on last edited by flopp
              #21

              @flylowgofast said:

              My real problem is not to send battery level. I try to do that because after 24 or 48 hours my node stop sending messages . So, I hoped that was a way to make it awake !

              It would have been nice if you had wrote this in your first post.:disappointed:
              So everyone could focus on the main problem

              1 Reply Last reply
              0
              • F Offline
                F Offline
                flylowgofast
                wrote on last edited by
                #22

                Hello @flopp ,

                Sorry I was myself focus on this second problem that's interesting to solve too ?
                At the end twice aren't solve ! :disappointed:

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  flylowgofast
                  wrote on last edited by
                  #23

                  Hello all,

                  At the end, I choose to do a software reset every 24 hours. This solution is very bad for me but it works !!

                  bye

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    sundberg84
                    Hardware Contributor
                    wrote on last edited by
                    #24

                    @flylowgofast One simple thing can be to move the radio away a bit and see if that helps. Its as AWI said probably interferance power-radio.

                    Controller: Proxmox VM - Home Assistant
                    MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                    MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                    RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                    F 1 Reply Last reply
                    0
                    • S sundberg84

                      @flylowgofast One simple thing can be to move the radio away a bit and see if that helps. Its as AWI said probably interferance power-radio.

                      F Offline
                      F Offline
                      flylowgofast
                      wrote on last edited by
                      #25

                      Hello @sundberg84,
                      I already considered this idea but my node have been running perfectly for two days before failed. So I think, power consideration are not the problem. I can trigg on and off my shutters many and many times without problem.

                      1 Reply Last reply
                      0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      35

                      Online

                      12.0k

                      Users

                      11.2k

                      Topics

                      113.4k

                      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