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. My Project
  3. Irrigation Controller (up to 16 valves with Shift Registers)

Irrigation Controller (up to 16 valves with Shift Registers)

Scheduled Pinned Locked Moved My Project
371 Posts 56 Posters 248.8k Views 52 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.
  • HuczasH Huczas

    @petewill
    Yes, I've tested this and it's working well!
    Link to the hackerspace - HackerSpace Warsaw, they are on irc - where I talk with them, #hackerspace-pl at freenode servers.

    petewillP Offline
    petewillP Offline
    petewill
    Admin
    wrote on last edited by
    #249

    @Huczas Oh, ok. I thought it was a forum post. Thanks for the update. I will work to get this updated.

    My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

    1 Reply Last reply
    0
    • HuczasH Huczas

      @petewill
      Yes, I've tested this and it's working well!
      Link to the hackerspace - HackerSpace Warsaw, they are on irc - where I talk with them, #hackerspace-pl at freenode servers.

      petewillP Offline
      petewillP Offline
      petewill
      Admin
      wrote on last edited by
      #250

      @Huczas the code has been updated in the 2.0 GitHub branch. The wiring diagram has also been updated. Thanks for the fix!

      My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

      HuczasH 1 Reply Last reply
      1
      • petewillP petewill

        @Huczas the code has been updated in the 2.0 GitHub branch. The wiring diagram has also been updated. Thanks for the fix!

        HuczasH Offline
        HuczasH Offline
        Huczas
        wrote on last edited by
        #251

        @petewill as I sad before - pull up 1k resistor and wire it to Arduino pin 6 - I mean

        pull up - connect to power,
        so should be 1k resistor connected with power source(that make sence with pull up) and also with pin 6. Like below:
        0_1477751319151_Przechwytywanie.PNG

        petewillP 1 Reply Last reply
        0
        • HuczasH Huczas

          @petewill as I sad before - pull up 1k resistor and wire it to Arduino pin 6 - I mean

          pull up - connect to power,
          so should be 1k resistor connected with power source(that make sence with pull up) and also with pin 6. Like below:
          0_1477751319151_Przechwytywanie.PNG

          petewillP Offline
          petewillP Offline
          petewill
          Admin
          wrote on last edited by
          #252

          @Huczas Ah, missed that. I fixed it.

          My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bsivley
            wrote on last edited by
            #253

            I just finished building this but when I go to upload the code to my arduino i get this error

            'byte clock [8]' redeclared as different kind of symbol

            what does this mean ?

            thanks

            petewillP 1 Reply Last reply
            0
            • B bsivley

              I just finished building this but when I go to upload the code to my arduino i get this error

              'byte clock [8]' redeclared as different kind of symbol

              what does this mean ?

              thanks

              petewillP Offline
              petewillP Offline
              petewill
              Admin
              wrote on last edited by
              #254

              @bsivley Are you using the libraries from the MySensors github page (https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries)? I just compiled it without any errors. What version of the Arduino IDE are you using? What version of MySensors are you using?

              My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

              Andrej_ABA 1 Reply Last reply
              0
              • petewillP petewill

                @bsivley Are you using the libraries from the MySensors github page (https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries)? I just compiled it without any errors. What version of the Arduino IDE are you using? What version of MySensors are you using?

                Andrej_ABA Offline
                Andrej_ABA Offline
                Andrej_AB
                wrote on last edited by
                #255

                @petewill Hi, Please can you advise what version Arduino IDE you are using for this sketch?

                rechin304R 1 Reply Last reply
                0
                • Andrej_ABA Andrej_AB

                  @petewill Hi, Please can you advise what version Arduino IDE you are using for this sketch?

                  rechin304R Offline
                  rechin304R Offline
                  rechin304
                  wrote on last edited by
                  #256
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • Andrej_ABA Offline
                    Andrej_ABA Offline
                    Andrej_AB
                    wrote on last edited by
                    #257

                    Hi, Maybe somebody can help me with this issue? Managed to upload code for irrigation controller with Arduino IDE 1.6.12 but can't pair with Vera controller.

                    petewillP 1 Reply Last reply
                    0
                    • Andrej_ABA Andrej_AB

                      Hi, Maybe somebody can help me with this issue? Managed to upload code for irrigation controller with Arduino IDE 1.6.12 but can't pair with Vera controller.

                      petewillP Offline
                      petewillP Offline
                      petewill
                      Admin
                      wrote on last edited by
                      #258

                      @Andrej_AB I'm using 1.6.12 but I haven't changed my node to 2.0 yet.
                      What is the issue you are having with pairing? Do you see the presentation messages on your gateway? Do you have other nodes successfully paired with your Vera?

                      My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

                      Andrej_ABA 1 Reply Last reply
                      0
                      • petewillP petewill

                        @Andrej_AB I'm using 1.6.12 but I haven't changed my node to 2.0 yet.
                        What is the issue you are having with pairing? Do you see the presentation messages on your gateway? Do you have other nodes successfully paired with your Vera?

                        Andrej_ABA Offline
                        Andrej_ABA Offline
                        Andrej_AB
                        wrote on last edited by
                        #259

                        @petewill Hi, All my other nodes have successfully paired with Vera, but irrigation controller node can't pair with Vera, I have started inclusion mode on Vera, one minute passed 0 devices found.
                        Please see attached picture.
                        0_1480325874006_Vera inclusion.png

                        0_1480325904307_irrigation node.png

                        petewillP 1 Reply Last reply
                        0
                        • Andrej_ABA Andrej_AB

                          @petewill Hi, All my other nodes have successfully paired with Vera, but irrigation controller node can't pair with Vera, I have started inclusion mode on Vera, one minute passed 0 devices found.
                          Please see attached picture.
                          0_1480325874006_Vera inclusion.png

                          0_1480325904307_irrigation node.png

                          petewillP Offline
                          petewillP Offline
                          petewill
                          Admin
                          wrote on last edited by
                          #260

                          @Andrej_AB It looks like it's communicating ok because it's getting the time. Have you ever had a mysenors node #5 in your Vera previously and deleted it? Could it be that the Vera thinks it's already there? What happens if you clear your eeprom on your irrigation controller then manually assign a different ID and then try to pair it again?

                          My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

                          Andrej_ABA 1 Reply Last reply
                          0
                          • petewillP petewill

                            @Andrej_AB It looks like it's communicating ok because it's getting the time. Have you ever had a mysenors node #5 in your Vera previously and deleted it? Could it be that the Vera thinks it's already there? What happens if you clear your eeprom on your irrigation controller then manually assign a different ID and then try to pair it again?

                            Andrej_ABA Offline
                            Andrej_ABA Offline
                            Andrej_AB
                            wrote on last edited by
                            #261

                            @petewill said:

                            @Andrej_AB It looks like it's communicating ok because it's getting the time. Have you ever had a mysenors node #5 in your Vera previously and deleted it? Could it be that the Vera thinks it's already there? What happens if you clear your eeprom on your irrigation controller then manually assign a different ID and then try to pair it again?

                            Also thinking about it, eprom was cleaned and manually assigned new ID but still can't pair with Vera.
                            Today I tried upload sketch from My sensors library 1.5.4 and node was successfully paired with Vera, then tried again last sketch and again can't pair.

                            petewillP 1 Reply Last reply
                            0
                            • Andrej_ABA Andrej_AB

                              @petewill said:

                              @Andrej_AB It looks like it's communicating ok because it's getting the time. Have you ever had a mysenors node #5 in your Vera previously and deleted it? Could it be that the Vera thinks it's already there? What happens if you clear your eeprom on your irrigation controller then manually assign a different ID and then try to pair it again?

                              Also thinking about it, eprom was cleaned and manually assigned new ID but still can't pair with Vera.
                              Today I tried upload sketch from My sensors library 1.5.4 and node was successfully paired with Vera, then tried again last sketch and again can't pair.

                              petewillP Offline
                              petewillP Offline
                              petewill
                              Admin
                              wrote on last edited by
                              #262

                              @Andrej_AB Can you post the full log from your sensor? The device is never getting presented in what you've posted so far. I don't have enough time to dig in to the code to know if this will help but can you try moving

                              void presentation()  
                              { 
                                sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
                                for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                {
                                  present(i, S_LIGHT);
                                }
                              }
                              

                              so it's above

                              void setup()
                              

                              I still haven't updated my irrigation controller to 2.0 yet so I haven't tested any of the code.

                              My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

                              Andrej_ABA 1 Reply Last reply
                              0
                              • petewillP petewill

                                @Andrej_AB Can you post the full log from your sensor? The device is never getting presented in what you've posted so far. I don't have enough time to dig in to the code to know if this will help but can you try moving

                                void presentation()  
                                { 
                                  sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
                                  for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                  {
                                    present(i, S_LIGHT);
                                  }
                                }
                                

                                so it's above

                                void setup()
                                

                                I still haven't updated my irrigation controller to 2.0 yet so I haven't tested any of the code.

                                Andrej_ABA Offline
                                Andrej_ABA Offline
                                Andrej_AB
                                wrote on last edited by
                                #263

                                @petewill Finally managed to pair node with Vera controller, many thanks to @petewill for assistance with this issue.

                                //
                                #define NUMBER_OF_VALVES 6  // Change this to set your valve count up to 16.
                                #define VALVE_RESET_TIME 7500UL   // Change this (in milliseconds) for the time you need your valves to hydraulically reset and change state
                                #define RADIO_ID 7  // Set this to fix your Radio ID or use Auto```
                                1 Reply Last reply
                                0
                                • impertusI Offline
                                  impertusI Offline
                                  impertus
                                  wrote on last edited by m26872
                                  #264

                                  hey @petewill

                                  finally i am done making the controller. but when i want to upload the code i get the error..

                                  
                                  C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void setup()':
                                  
                                  Vanding:112: error: 'lcd' was not declared in this scope
                                  
                                     lcd.begin(16, 2); //(16 characters and 2 line display)
                                  
                                     ^
                                  
                                  C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void loop()':
                                  
                                  Vanding:255: error: 'lcd' was not declared in this scope
                                  
                                         lcd.clear();
                                  
                                         ^
                                  
                                  C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void displayMenu()':
                                  
                                  Vanding:388: error: 'lcd' was not declared in this scope
                                  
                                       lcd.clear();
                                  
                                       ^
                                  
                                  Vanding:399: error: 'lcd' was not declared in this scope
                                  
                                       lcd.print(F("."));
                                  
                                       ^
                                  
                                  C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void updateDisplay()':
                                  
                                  Vanding:589: error: 'lcd' was not declared in this scope
                                  
                                           lcd.setCursor(0, 0);
                                  
                                           ^
                                  
                                  C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void fastClear()':
                                  
                                  Vanding:750: error: 'lcd' was not declared in this scope
                                  
                                     lcd.setCursor(0, 0);
                                  
                                     ^
                                  
                                  C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void updateClock()':
                                  
                                  Vanding:762: error: 'lcd' was not declared in this scope
                                  
                                       lcd.setCursor(15, 0);
                                  
                                       ^
                                  
                                  C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void goGetValveTimes()':
                                  
                                  Vanding:791: error: 'lcd' was not declared in this scope
                                  
                                       lcd.setCursor(15, 0);
                                  
                                       ^
                                  
                                  exit status 1
                                  'lcd' was not declared in this scope
                                  

                                  do you have some help 4 me??

                                  dbemowskD 2 Replies Last reply
                                  0
                                  • impertusI impertus

                                    hey @petewill

                                    finally i am done making the controller. but when i want to upload the code i get the error..

                                    
                                    C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void setup()':
                                    
                                    Vanding:112: error: 'lcd' was not declared in this scope
                                    
                                       lcd.begin(16, 2); //(16 characters and 2 line display)
                                    
                                       ^
                                    
                                    C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void loop()':
                                    
                                    Vanding:255: error: 'lcd' was not declared in this scope
                                    
                                           lcd.clear();
                                    
                                           ^
                                    
                                    C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void displayMenu()':
                                    
                                    Vanding:388: error: 'lcd' was not declared in this scope
                                    
                                         lcd.clear();
                                    
                                         ^
                                    
                                    Vanding:399: error: 'lcd' was not declared in this scope
                                    
                                         lcd.print(F("."));
                                    
                                         ^
                                    
                                    C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void updateDisplay()':
                                    
                                    Vanding:589: error: 'lcd' was not declared in this scope
                                    
                                             lcd.setCursor(0, 0);
                                    
                                             ^
                                    
                                    C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void fastClear()':
                                    
                                    Vanding:750: error: 'lcd' was not declared in this scope
                                    
                                       lcd.setCursor(0, 0);
                                    
                                       ^
                                    
                                    C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void updateClock()':
                                    
                                    Vanding:762: error: 'lcd' was not declared in this scope
                                    
                                         lcd.setCursor(15, 0);
                                    
                                         ^
                                    
                                    C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void goGetValveTimes()':
                                    
                                    Vanding:791: error: 'lcd' was not declared in this scope
                                    
                                         lcd.setCursor(15, 0);
                                    
                                         ^
                                    
                                    exit status 1
                                    'lcd' was not declared in this scope
                                    

                                    do you have some help 4 me??

                                    dbemowskD Offline
                                    dbemowskD Offline
                                    dbemowsk
                                    wrote on last edited by
                                    #265

                                    @impertus Can you post your entire sketch?

                                    Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                                    Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                                    1 Reply Last reply
                                    0
                                    • impertusI impertus

                                      hey @petewill

                                      finally i am done making the controller. but when i want to upload the code i get the error..

                                      
                                      C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void setup()':
                                      
                                      Vanding:112: error: 'lcd' was not declared in this scope
                                      
                                         lcd.begin(16, 2); //(16 characters and 2 line display)
                                      
                                         ^
                                      
                                      C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void loop()':
                                      
                                      Vanding:255: error: 'lcd' was not declared in this scope
                                      
                                             lcd.clear();
                                      
                                             ^
                                      
                                      C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void displayMenu()':
                                      
                                      Vanding:388: error: 'lcd' was not declared in this scope
                                      
                                           lcd.clear();
                                      
                                           ^
                                      
                                      Vanding:399: error: 'lcd' was not declared in this scope
                                      
                                           lcd.print(F("."));
                                      
                                           ^
                                      
                                      C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void updateDisplay()':
                                      
                                      Vanding:589: error: 'lcd' was not declared in this scope
                                      
                                               lcd.setCursor(0, 0);
                                      
                                               ^
                                      
                                      C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void fastClear()':
                                      
                                      Vanding:750: error: 'lcd' was not declared in this scope
                                      
                                         lcd.setCursor(0, 0);
                                      
                                         ^
                                      
                                      C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void updateClock()':
                                      
                                      Vanding:762: error: 'lcd' was not declared in this scope
                                      
                                           lcd.setCursor(15, 0);
                                      
                                           ^
                                      
                                      C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void goGetValveTimes()':
                                      
                                      Vanding:791: error: 'lcd' was not declared in this scope
                                      
                                           lcd.setCursor(15, 0);
                                      
                                           ^
                                      
                                      exit status 1
                                      'lcd' was not declared in this scope
                                      

                                      do you have some help 4 me??

                                      dbemowskD Offline
                                      dbemowskD Offline
                                      dbemowsk
                                      wrote on last edited by
                                      #266

                                      @impertus Those errors have to do with this line:

                                      
                                      // Set the pins on the I2C chip used for LCD connections:
                                      //                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
                                      LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address to 0x27
                                      

                                      This is where the declaration happens. If this is commented or fails, you will get the errors you described. Do you have the correct LCD libraries installed for this?

                                      Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                                      Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                                      impertusI 1 Reply Last reply
                                      0
                                      • dbemowskD dbemowsk

                                        @impertus Those errors have to do with this line:

                                        
                                        // Set the pins on the I2C chip used for LCD connections:
                                        //                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
                                        LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address to 0x27
                                        

                                        This is where the declaration happens. If this is commented or fails, you will get the errors you described. Do you have the correct LCD libraries installed for this?

                                        impertusI Offline
                                        impertusI Offline
                                        impertus
                                        wrote on last edited by m26872
                                        #267

                                        @dbemowsk i just copy/paste from the site.

                                        witch library should i use?

                                        i have added mysensors-master to IDE

                                        edit i could see i have out comment the line. Now i get this error

                                        Vanding:92: error: 'POSITIVE' was not declared in this scope
                                        
                                         LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address to 0x27
                                        
                                                                                             ^
                                        
                                        C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void setup()':
                                        
                                        Vanding:116: error: no matching function for call to 'LiquidCrystal_I2C::begin(int, int)'
                                        
                                           lcd.begin(16, 2); //(16 characters and 2 line display)
                                        
                                                          ^
                                        
                                        C:\Users\crame\Desktop\Vanding\Vanding.ino:116:18: note: candidate is:
                                        
                                        In file included from C:\Users\crame\Desktop\Vanding\Vanding.ino:1:0:
                                        
                                        C:\Program Files (x86)\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master/LiquidCrystal_I2C.h:76:7: note: void LiquidCrystal_I2C::begin()
                                        
                                          void begin();
                                        
                                               ^
                                        
                                        C:\Program Files (x86)\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master/LiquidCrystal_I2C.h:76:7: note:   candidate expects 0 arguments, 2 provided
                                        
                                        exit status 1
                                        'POSITIVE' was not declared in this scope
                                        

                                        the sketch.

                                        #include <LiquidCrystal_I2C.h>
                                        
                                        
                                        
                                        // Enable debug prints
                                        //#define MY_DEBUG
                                        
                                        // Enable and select radio type attached
                                        #define MY_RADIO_NRF24
                                        //#define MY_RADIO_RFM69
                                        
                                        //#define MY_NODE_ID 1  // Set this to fix your Radio ID or use Auto
                                        
                                        #include <Wire.h>
                                        #include <TimeLib.h>
                                        #include <SPI.h>
                                        #include <MySensors.h>
                                        #include <LiquidCrystal.h>
                                        #include <LiquidCrystal_I2C.h>
                                        
                                        
                                        #define NUMBER_OF_VALVES 8  // Change this to set your valve count up to 16.
                                        #define VALVE_RESET_TIME 7500UL   // Change this (in milliseconds) for the time you need your valves to hydraulically reset and change state
                                        
                                        #define SKETCH_NAME "MySprinkler"
                                        #define SKETCH_VERSION "2.0"
                                        //
                                        #define CHILD_ID_SPRINKLER 0
                                        //
                                        #define ACTIVE_LOW // comment out this line if your relays are active high
                                        //
                                        #define DEBUG_ON   // comment out to supress serial monitor output
                                        //
                                        #ifdef ACTIVE_LOW
                                        #define BITSHIFT_VALVE_NUMBER ~(1U << (valveNumber-1))
                                        #define ALL_VALVES_OFF 0xFFFF
                                        #else
                                        #define BITSHIFT_VALVE_NUMBER (1U << (valveNumber-1))
                                        #define ALL_VALVES_OFF 0U
                                        #endif
                                        //
                                        #ifdef DEBUG_ON
                                        #define DEBUG_PRINT(x)   Serial.print(x)
                                        #define DEBUG_PRINTLN(x) Serial.println(x)
                                        #else
                                        #define DEBUG_PRINT(x)
                                        #define DEBUG_PRINTLN(x)
                                        #define SERIAL_START(x)
                                        #endif
                                        //
                                        typedef enum {
                                          STAND_BY_ALL_OFF, RUN_SINGLE_ZONE, RUN_ALL_ZONES, CYCLE_COMPLETE, ZONE_SELECT_MENU
                                        }
                                        SprinklerStates;
                                        //
                                        SprinklerStates state = STAND_BY_ALL_OFF;
                                        SprinklerStates lastState;
                                        byte menuState = 0;
                                        unsigned long menuTimer;
                                        byte countDownTime = 10;
                                        //
                                        int allZoneTime [NUMBER_OF_VALVES + 1];
                                        int valveSoloTime [NUMBER_OF_VALVES + 1];
                                        int valveNumber;
                                        int lastValve;
                                        unsigned long startMillis;
                                        const int ledPin = 5;
                                        const int waterButtonPin = 3;
                                        bool buttonPushed = false;
                                        bool showTime = true;
                                        bool clockUpdating = false;
                                        bool recentUpdate = true;
                                        const char *dayOfWeek[] = {
                                          "Null", "Sunday ", "Monday ", "Tuesday ", "Wednesday ", "Thursday ", "Friday ", "Saturday "
                                        };
                                        // Name your Zones here or use Vera to edit them by adding a name in Variable3...
                                        String valveNickName[17] = {
                                          "All Zones", "Zone 1", "Zone 2", "Zone 3", "Zone 4", "Zone 5", "Zone 6", "Zone 7", "Zone 8", "Zone 9", "Zone 10", "Zone 11", "Zone 12", "Zone 13", "Zone 14", "Zone 15", "Zone 16"
                                        };
                                        //
                                        time_t lastTimeRun = 0;
                                        //Setup Shift Register...
                                        const int latchPin = 8;
                                        const int clockPin = 4;
                                        const int dataPin  = 7;
                                        const int outputEnablePin = 6;
                                        //
                                        byte clock[8] = {0x0, 0xe, 0x15, 0x17, 0x11, 0xe, 0x0}; // fetching time indicator
                                        byte raindrop[8] = {0x4, 0x4, 0xA, 0xA, 0x11, 0xE, 0x0,}; // fetching Valve Data indicator
                                        // Set the pins on the I2C chip used for LCD connections:
                                        //                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
                                        LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address to 0x27
                                        //
                                        MyMessage msg1valve(CHILD_ID_SPRINKLER, V_LIGHT);
                                        MyMessage var1valve(CHILD_ID_SPRINKLER, V_VAR1);
                                        MyMessage var2valve(CHILD_ID_SPRINKLER, V_VAR2);
                                        
                                        bool receivedInitialValue = false;
                                        //
                                        void setup()
                                        {
                                          DEBUG_PRINTLN(F("Initialising..."));
                                          pinMode(latchPin, OUTPUT);
                                          pinMode(clockPin, OUTPUT);
                                          pinMode(dataPin, OUTPUT);
                                          pinMode(ledPin, OUTPUT);
                                          pinMode(outputEnablePin, OUTPUT);
                                          digitalWrite (outputEnablePin, LOW);
                                          pinMode(waterButtonPin, INPUT_PULLUP);
                                          //pinMode(waterButtonPin, INPUT);
                                          attachInterrupt(digitalPinToInterrupt(waterButtonPin), PushButton, RISING); //May need to change for your Arduino model
                                          digitalWrite (ledPin, HIGH);
                                          DEBUG_PRINTLN(F("Turning All Valves Off..."));
                                          updateRelays(ALL_VALVES_OFF);
                                          //delay(5000);
                                          lcd.begin(16, 2); //(16 characters and 2 line display)
                                          lcd.clear();
                                          lcd.backlight();
                                          lcd.createChar(0, clock);
                                          lcd.createChar(1, raindrop);
                                          //
                                          //check for saved date in EEPROM
                                          DEBUG_PRINTLN(F("Checking EEPROM for stored date:"));
                                          delay(500);
                                          if (loadState(0) == 0xFF) // EEPROM flag
                                          {
                                            DEBUG_PRINTLN(F("Retreiving last run time from EEPROM..."));
                                            for (int i = 0; i < 4 ; i++)
                                            {
                                              lastTimeRun = lastTimeRun << 8;
                                              lastTimeRun = lastTimeRun | loadState(i + 1); // assemble 4 bytes into an ussigned long epoch timestamp
                                            }
                                          }
                                        
                                          DEBUG_PRINTLN(F("Sensor Presentation Complete"));
                                          //
                                          digitalWrite (ledPin, LOW);
                                          DEBUG_PRINTLN(F("Ready..."));
                                          //
                                          lcd.setCursor(0, 0);
                                          lcd.print(F(" Syncing Time  "));
                                          lcd.setCursor(15, 0);
                                          lcd.write(byte(0));
                                          lcd.setCursor(0, 1);
                                          int clockCounter = 0;
                                          while (timeStatus() == timeNotSet && clockCounter < 21)
                                          {
                                            requestTime();
                                            DEBUG_PRINTLN(F("Requesting time from Gateway:"));
                                            wait(1000);
                                            lcd.print(".");
                                            clockCounter++;
                                            if (clockCounter > 16)
                                            {
                                              DEBUG_PRINTLN(F("Failed initial clock synchronization!"));
                                              lcd.clear();
                                              lcd.print(F("  Failed Clock  "));
                                              lcd.setCursor(0, 1);
                                              lcd.print(F(" Syncronization "));
                                              wait(2000);
                                              break;
                                            }
                                          }
                                          //
                                          lcd.clear();
                                          //Update valve data when first powered on
                                          for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                          {
                                            lcd.print(F(" Updating  "));
                                            lcd.setCursor(0, 1);
                                            lcd.print(F(" Valve Data: "));
                                            lcd.print(i);
                                            bool flashIcon = false;
                                            DEBUG_PRINT(F("Calling for Valve "));
                                            DEBUG_PRINT(i);
                                            DEBUG_PRINTLN(F(" Data..."));
                                            while (!receivedInitialValue)
                                            {
                                              lcd.setCursor(15, 0);
                                              flashIcon = !flashIcon;
                                              flashIcon ? lcd.write(byte(1)) : lcd.print(F(" "));
                                              request(i, V_VAR1);
                                              wait(500);
                                            }
                                            receivedInitialValue = false;
                                            while (!receivedInitialValue)
                                            {
                                              lcd.setCursor(15, 0);
                                              flashIcon = !flashIcon;
                                              flashIcon ? lcd.write(byte(1)) : lcd.print(F(" "));
                                              request(i, V_VAR2);
                                              wait(500);
                                            }
                                            receivedInitialValue = false;
                                            while (!receivedInitialValue)
                                            {
                                              lcd.setCursor(15, 0);
                                              flashIcon = !flashIcon;
                                              flashIcon ? lcd.write(byte(1)) : lcd.print(F(" "));
                                              request(i, V_VAR3);
                                              wait(500);
                                            }
                                          }
                                          lcd.clear();
                                        }
                                        
                                        
                                        void presentation()  
                                        { 
                                          sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
                                          for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                          {
                                            present(i, S_LIGHT);
                                          }
                                        }
                                        
                                        //
                                        void loop()
                                        {
                                          updateClock();
                                          updateDisplay();
                                          goGetValveTimes();
                                          //
                                          if (buttonPushed)
                                          {
                                            menuTimer = millis();
                                            DEBUG_PRINTLN(F("Button Pressed"));
                                            if (state == STAND_BY_ALL_OFF)
                                            {
                                              state = ZONE_SELECT_MENU;
                                              menuState = 0;
                                            }
                                            else if (state == ZONE_SELECT_MENU)
                                            {
                                              menuState++;
                                              if (menuState > NUMBER_OF_VALVES)
                                              {
                                                menuState = 0;
                                              }
                                            }
                                            else
                                            {
                                              state = STAND_BY_ALL_OFF;
                                            }
                                            buttonPushed = false;
                                          }
                                          if (state == STAND_BY_ALL_OFF)
                                          {
                                            slowToggleLED ();
                                            if (state != lastState)
                                            {
                                              updateRelays(ALL_VALVES_OFF);
                                              DEBUG_PRINTLN(F("State Changed... all Zones off"));
                                              for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                              {
                                                wait(50);
                                                send(msg1valve.setSensor(i).set(false), false);
                                              }
                                              lcd.clear();
                                              lcd.setCursor(0,0);
                                              lcd.print(F("** Irrigation **"));
                                              lcd.setCursor(0,1);
                                              lcd.print(F("**   Halted   **"));
                                              wait(2000);
                                              lastValve = -1;
                                            }
                                          }
                                          //
                                          else if (state == RUN_ALL_ZONES)
                                          {
                                            if (lastValve != valveNumber)
                                            {
                                              for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                              {
                                                if (i == 0 || i == valveNumber)
                                                {
                                                  send(msg1valve.setSensor(i).set(true), false);
                                                }
                                                else
                                                {
                                                  send(msg1valve.setSensor(i).set(false), false);
                                                }
                                              }
                                            }
                                            lastValve = valveNumber;
                                            fastToggleLed();
                                            if (state != lastState)
                                            {
                                              valveNumber = 1;
                                              updateRelays(ALL_VALVES_OFF);
                                              DEBUG_PRINTLN(F("State Changed, Running All Zones..."));
                                            }
                                            unsigned long nowMillis = millis();
                                            if (nowMillis - startMillis < VALVE_RESET_TIME)
                                            {
                                              updateRelays(ALL_VALVES_OFF);
                                            }
                                            else if (nowMillis - startMillis < (allZoneTime[valveNumber] * 60000UL))
                                            {
                                              updateRelays(BITSHIFT_VALVE_NUMBER);
                                            }
                                            else
                                            {
                                              DEBUG_PRINTLN(F("Changing Valves..."));
                                              updateRelays(ALL_VALVES_OFF);
                                              startMillis = millis();
                                              valveNumber++;
                                              if (valveNumber > NUMBER_OF_VALVES)
                                              {
                                                state = CYCLE_COMPLETE;
                                                startMillis = millis();
                                                lastValve = -1;
                                                lastTimeRun = now();
                                                saveDateToEEPROM(lastTimeRun);
                                                for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                                {
                                                  send(msg1valve.setSensor(i).set(false), false);
                                                }
                                                DEBUG_PRINT(F("State = "));
                                                DEBUG_PRINTLN(state);
                                              }
                                            }
                                          }
                                          //
                                          else if (state == RUN_SINGLE_ZONE)
                                          {
                                            fastToggleLed();
                                            if (state != lastState)
                                            {
                                              for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                              {
                                                if (i == 0 || i == valveNumber)
                                                {
                                                  send(msg1valve.setSensor(i).set(true), false);
                                                }
                                                else
                                                {
                                                  send(msg1valve.setSensor(i).set(false), false);
                                                }
                                              }
                                              DEBUG_PRINTLN(F("State Changed, Single Zone Running..."));
                                              DEBUG_PRINT(F("Zone: "));
                                              DEBUG_PRINTLN(valveNumber);
                                            }
                                            unsigned long nowMillis = millis();
                                            if (nowMillis - startMillis < VALVE_RESET_TIME)
                                            {
                                              updateRelays(ALL_VALVES_OFF);
                                            }
                                            else if (nowMillis - startMillis < (valveSoloTime [valveNumber] * 60000UL))
                                            {
                                              updateRelays(BITSHIFT_VALVE_NUMBER);
                                            }
                                            else
                                            {
                                              updateRelays(ALL_VALVES_OFF);
                                              for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                              {
                                                send(msg1valve.setSensor(i).set(false), false);
                                              }
                                              state = CYCLE_COMPLETE;
                                              startMillis = millis();
                                              DEBUG_PRINT(F("State = "));
                                              DEBUG_PRINTLN(state);
                                            }
                                            lastTimeRun = now();
                                          }
                                          else if (state == CYCLE_COMPLETE)
                                          {
                                            if (millis() - startMillis < 30000UL)
                                            {
                                              fastToggleLed();
                                            }
                                            else
                                            {
                                              state = STAND_BY_ALL_OFF;
                                            }
                                          }
                                          else if (state == ZONE_SELECT_MENU)
                                          {
                                            displayMenu();
                                          }
                                          lastState = state;
                                        }
                                        //
                                        void displayMenu(void)
                                        {
                                          static byte lastMenuState = -1;
                                          static int lastSecond;
                                          if (menuState != lastMenuState)
                                          {
                                            lcd.clear();
                                            lcd.setCursor(0, 0);
                                            lcd.print(valveNickName[menuState]);
                                            lcd.setCursor(0, 1);
                                            lcd.print(F("Starting"));
                                            DEBUG_PRINT(valveNickName[menuState]);
                                            Serial.print(F(" Starting Shortly"));
                                          }
                                          int thisSecond = (millis() - menuTimer) / 1000UL;
                                          if (thisSecond != lastSecond && thisSecond < 8)
                                          {
                                            lcd.print(F("."));
                                            Serial.print(".");
                                          }
                                          lastSecond = thisSecond;
                                          if (millis() - menuTimer > 10000UL)
                                          {
                                            startMillis = millis();
                                            if (menuState == 0)
                                            {
                                              valveNumber = 1;
                                              state = RUN_ALL_ZONES;
                                            }
                                            else
                                            {
                                              valveNumber = menuState;
                                              state = RUN_SINGLE_ZONE;
                                            }
                                          }
                                          else
                                          {
                                        
                                          }
                                          lastMenuState = menuState;
                                        }
                                        //
                                        void updateRelays(int value)
                                        {
                                          digitalWrite(latchPin, LOW);
                                          shiftOut(dataPin, clockPin, MSBFIRST, highByte(value));
                                          shiftOut(dataPin, clockPin, MSBFIRST, lowByte(value));
                                          digitalWrite(latchPin, HIGH);
                                        }
                                        //
                                        void PushButton() //interrupt with debounce
                                        {
                                          static unsigned long last_interrupt_time = 0;
                                          unsigned long interrupt_time = millis();
                                          if (interrupt_time - last_interrupt_time > 200)
                                          {
                                            buttonPushed = true;
                                          }
                                          last_interrupt_time = interrupt_time;
                                        }
                                        //
                                        void fastToggleLed()
                                        {
                                          static unsigned long fastLedTimer;
                                          if (millis() - fastLedTimer >= 100UL)
                                          {
                                            digitalWrite(ledPin, !digitalRead(ledPin));
                                            fastLedTimer = millis ();
                                          }
                                        }
                                        //
                                        void slowToggleLED ()
                                        {
                                          static unsigned long slowLedTimer;
                                          if (millis() - slowLedTimer >= 1250UL)
                                          {
                                            digitalWrite(ledPin, !digitalRead(ledPin));
                                            slowLedTimer = millis ();
                                          }
                                        }
                                        //
                                        void receive(const MyMessage &message)
                                        {
                                          bool zoneTimeUpdate = false;
                                          if (message.isAck())
                                          {
                                            DEBUG_PRINTLN(F("This is an ack from gateway"));
                                          }
                                          for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                          {
                                            if (message.sensor == i)
                                            {
                                              if (message.type == V_LIGHT)
                                              {
                                                int switchState = atoi(message.data);
                                                if (switchState == 0)
                                                {
                                                  state = STAND_BY_ALL_OFF;
                                                  DEBUG_PRINTLN(F("Recieved Instruction to Cancel..."));
                                                }
                                                else
                                                {
                                                  if (i == 0)
                                                  {
                                                    state = RUN_ALL_ZONES;
                                                    valveNumber = 1;
                                                    DEBUG_PRINTLN(F("Recieved Instruction to Run All Zones..."));
                                                  }
                                                  else
                                                  {
                                                    state = RUN_SINGLE_ZONE;
                                                    valveNumber = i;
                                                    DEBUG_PRINT(F("Recieved Instruction to Activate Zone: "));
                                                    DEBUG_PRINTLN(i);
                                                  }
                                                }
                                                startMillis = millis();
                                              }
                                              else if (message.type == V_VAR1)
                                              {
                                                int variable1 = atoi(message.data);// RUN_ALL_ZONES time
                                                DEBUG_PRINT(F("Recieved variable1 valve:"));
                                                DEBUG_PRINT(i);
                                                DEBUG_PRINT(F(" = "));
                                                DEBUG_PRINTLN(variable1);
                                                if (variable1 != allZoneTime[i])
                                                {
                                                  allZoneTime[i] = variable1;
                                        
                                                  zoneTimeUpdate = true;
                                                }
                                                receivedInitialValue = true;
                                              }
                                              else if (message.type == V_VAR2)
                                              {
                                                int variable2 = atoi(message.data);// RUN_SINGLE_ZONE time
                                                DEBUG_PRINT(F("Recieved variable2 valve:"));
                                                DEBUG_PRINT(i);
                                                DEBUG_PRINT(F(" = "));
                                                DEBUG_PRINTLN(variable2);
                                                if (variable2 != valveSoloTime[i])
                                                {
                                                  valveSoloTime[i] = variable2;
                                                  zoneTimeUpdate = true;
                                                }
                                                receivedInitialValue = true;
                                              }
                                              else if (message.type == V_VAR3)
                                              {
                                                String newMessage = String(message.data);
                                                if (newMessage.length() == 0) 
                                                {
                                                  DEBUG_PRINT(F("No Name Recieved for zone "));
                                                  DEBUG_PRINTLN(i);
                                                  break;
                                                }
                                                if (newMessage.length() > 16)
                                                {
                                                  newMessage.substring(0, 16);
                                                }
                                                valveNickName[i] = "";
                                                valveNickName[i] += newMessage;
                                                DEBUG_PRINT(F("Recieved new name for zone "));
                                                DEBUG_PRINT(i);
                                                DEBUG_PRINT(F(" and it is now called: "));
                                                DEBUG_PRINTLN(valveNickName[i]);
                                              }
                                              receivedInitialValue = true;
                                            }
                                          }
                                          if (zoneTimeUpdate)
                                          {
                                            //
                                            DEBUG_PRINTLN(F("New Zone Times Recieved..."));
                                            for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                            {
                                              if (i != 0)
                                              {
                                                DEBUG_PRINT(F("Zone "));
                                                DEBUG_PRINT(i);
                                                DEBUG_PRINT(F(" individual time: "));
                                                DEBUG_PRINT(valveSoloTime[i]);
                                                DEBUG_PRINT(F(" group time: "));
                                                DEBUG_PRINTLN(allZoneTime[i]);
                                                recentUpdate = true;
                                              }
                                            }
                                          }
                                          else
                                          {
                                            recentUpdate = false;
                                          }
                                        }
                                        //
                                        void updateDisplay()
                                        {
                                          static unsigned long lastUpdateTime;
                                          static bool displayToggle = false;
                                          //static byte toggleCounter = 0;
                                          static SprinklerStates lastDisplayState;
                                          if (state != lastDisplayState || millis() - lastUpdateTime >= 3000UL)
                                          {
                                            displayToggle = !displayToggle;
                                            switch (state) {
                                              case STAND_BY_ALL_OFF:
                                                //
                                                fastClear();
                                                lcd.setCursor(0, 0);
                                                if (displayToggle)
                                                {
                                                  lcd.print(F("  System Ready "));
                                                  if (clockUpdating)
                                                  {
                                                    lcd.setCursor(15, 0);
                                                    lcd.write(byte(0));
                                                  }
                                                  lcd.setCursor(0, 1);
                                                  lcd.print(hourFormat12() < 10 ? F(" ") : F(""));
                                                  lcd.print(hourFormat12());
                                                  lcd.print(minute() < 10 ? F(":0") : F(":"));
                                                  lcd.print(minute());
                                                  lcd.print(isAM() ? F("am") : F("pm"));
                                                  lcd.print(month() < 10 ? F(" 0") : F(" "));
                                                  lcd.print(month());
                                                  lcd.print(day() < 10 ? F("/0") : F("/"));
                                                  lcd.print(day());
                                                  lcd.print(F("/"));
                                                  lcd.print(year() % 100);
                                                }
                                                else
                                                {
                                                  lcd.print(F("  Last Watered "));
                                                  if (clockUpdating)
                                                  {
                                                    lcd.setCursor(15, 0);
                                                    lcd.write(byte(0));
                                                  }
                                                  lcd.setCursor(0, 1);
                                                  lcd.print(dayOfWeek[weekday(lastTimeRun)]);
                                                  lcd.setCursor(11, 1);
                                                  lcd.print(month(lastTimeRun) < 10 ? F(" ") : F(""));
                                                  lcd.print(month(lastTimeRun));
                                                  lcd.print(day(lastTimeRun) < 10 ? F("/0") : F("/"));
                                                  lcd.print(day(lastTimeRun));
                                                }
                                                break;
                                              case RUN_SINGLE_ZONE:
                                                //
                                                fastClear();
                                                lcd.setCursor(0, 0);
                                                if (displayToggle)
                                                {
                                                  lcd.print(F("Single Zone Mode"));
                                                  lcd.setCursor(0, 1);
                                                  lcd.print(F(" Zone:"));
                                                  if (valveNumber < 10) lcd.print(F("0"));
                                                  lcd.print(valveNumber);
                                                  lcd.print(F(" Active"));
                                                }
                                                else
                                                {
                                                  lcd.print(F(" Time Remaining "));
                                                  lcd.setCursor(0, 1);
                                                  if (valveSoloTime[valveNumber] == 0)
                                                  {
                                                    lcd.print(F(" No Valve Time "));
                                                  }
                                                  else
                                                  {
                                                    unsigned long timeRemaining = (valveSoloTime[valveNumber] * 60) - ((millis() - startMillis) / 1000);
                                                    lcd.print(timeRemaining / 60 < 10 ? "   0" : "   ");
                                                    lcd.print(timeRemaining / 60);
                                                    lcd.print("min");
                                                    lcd.print(timeRemaining % 60 < 10 ? " 0" : " ");
                                                    lcd.print(timeRemaining % 60);
                                                    lcd.print("sec  ");
                                                  }
                                                }
                                                break;
                                              case RUN_ALL_ZONES:
                                                //
                                                fastClear();
                                                lcd.setCursor(0, 0);
                                                if (displayToggle)
                                                {
                                                  lcd.print(F(" All-Zone  Mode "));
                                                  lcd.setCursor(0, 1);
                                                  lcd.print(F(" Zone:"));
                                                  if (valveNumber < 10) lcd.print(F("0"));
                                                  lcd.print(valveNumber);
                                                  lcd.print(F(" Active "));
                                                }
                                                else
                                                {
                                                  lcd.print(F(" Time Remaining "));
                                                  lcd.setCursor(0, 1);
                                                  int timeRemaining = (allZoneTime[valveNumber] * 60) - ((millis() - startMillis) / 1000);
                                                  lcd.print((timeRemaining / 60) < 10 ? "   0" : "   ");
                                                  lcd.print(timeRemaining / 60);
                                                  lcd.print("min");
                                                  lcd.print(timeRemaining % 60 < 10 ? " 0" : " ");
                                                  lcd.print(timeRemaining % 60);
                                                  lcd.print("sec  ");
                                                }
                                                break;
                                              case CYCLE_COMPLETE:
                                                //
                                                if (displayToggle)
                                                {
                                                  lcd.setCursor(0, 0);
                                                  lcd.print(F(" Watering Cycle "));
                                                  lcd.setCursor(0, 1);
                                                  lcd.print(F("    Complete    "));
                                                }
                                                else
                                                {
                                                  int totalTimeRan = 0;
                                                  for (int i = 1; i < NUMBER_OF_VALVES + 1; i++)
                                                  {
                                                    totalTimeRan += allZoneTime[i];
                                                  }
                                                  lcd.setCursor(0, 0);
                                                  lcd.print(F(" Total Time Run "));
                                                  lcd.setCursor(0, 1);
                                                  lcd.print(totalTimeRan < 10 ? "   0" : "   ");
                                                  lcd.print(totalTimeRan);
                                                  lcd.print(" Minutes   ");
                                                }
                                              default:
                                                // what of ZONE_SELECT_MENU?
                                                break;
                                            }
                                            lastUpdateTime = millis();
                                          }
                                          lastDisplayState = state;
                                        }
                                        void receiveTime(time_t newTime)
                                        {
                                          DEBUG_PRINTLN(F("Time value received and updated..."));
                                          int lastSecond = second();
                                          int lastMinute = minute();
                                          int lastHour = hour();
                                          setTime(newTime);
                                          if (((second() != lastSecond) || (minute() != lastMinute) || (hour() != lastHour)) || showTime)
                                          {
                                            DEBUG_PRINTLN(F("Clock updated...."));
                                            DEBUG_PRINT(F("Sensor's time currently set to:"));
                                            DEBUG_PRINT(hourFormat12() < 10 ? F(" 0") : F(" "));
                                            DEBUG_PRINT(hourFormat12());
                                            DEBUG_PRINT(minute() < 10 ? F(":0") : F(":"));
                                            DEBUG_PRINT(minute());
                                            DEBUG_PRINTLN(isAM() ? F("am") : F("pm"));
                                            DEBUG_PRINT(month());
                                            DEBUG_PRINT(F("/"));
                                            DEBUG_PRINT(day());
                                            DEBUG_PRINT(F("/"));
                                            DEBUG_PRINTLN(year());
                                            DEBUG_PRINTLN(dayOfWeek[weekday()]);
                                            showTime = false;
                                          }
                                          else
                                          {
                                            DEBUG_PRINTLN(F("Sensor's time did NOT need adjustment greater than 1 second."));
                                          }
                                          clockUpdating = false;
                                        }
                                        void fastClear()
                                        {
                                          lcd.setCursor(0, 0);
                                          lcd.print(F("                "));
                                          lcd.setCursor(0, 1);
                                          lcd.print(F("                "));
                                        }
                                        //
                                        void updateClock()
                                        {
                                          static unsigned long lastVeraGetTime;
                                          if (millis() - lastVeraGetTime >= 3600000UL) // updates clock time and gets zone times from vera once every hour
                                          {
                                            DEBUG_PRINTLN(F("Requesting time and valve data from Gateway..."));
                                            lcd.setCursor(15, 0);
                                            lcd.write(byte(0));
                                            clockUpdating = true;
                                            requestTime();
                                            lastVeraGetTime = millis();
                                          }
                                        }
                                        //
                                        void saveDateToEEPROM(unsigned long theDate)
                                        {
                                          DEBUG_PRINTLN(F("Saving Last Run date"));
                                          if (loadState(0) != 0xFF)
                                          {
                                            saveState(0, 0xFF); // EEPROM flag for last date saved stored in EEPROM (location zero)
                                          }
                                          //
                                          for (int i = 1; i < 5; i++)
                                          {
                                            saveState(5 - i, byte(theDate >> 8 * (i - 1))); // store epoch datestamp in 4 bytes of EEPROM starting in location one
                                          }
                                        }
                                        //
                                        void goGetValveTimes()
                                        {
                                          static unsigned long valveUpdateTime;
                                          static byte valveIndex = 1;
                                          if (millis() - valveUpdateTime >= 300000UL / NUMBER_OF_VALVES)// update each valve once every 5 mins (distributes the traffic)
                                          {
                                            DEBUG_PRINTLN(F("Calling for Valve Data..."));
                                            lcd.setCursor(15, 0);
                                            lcd.write(byte(1)); //lcd.write(1);
                                            request(valveIndex, V_VAR1);
                                            request(valveIndex, V_VAR2);
                                            request(valveIndex, V_VAR3);
                                            valveUpdateTime = millis();
                                            valveIndex++;
                                            if (valveIndex > NUMBER_OF_VALVES + 1)
                                            {
                                              valveIndex = 1;
                                            }
                                          }
                                        }
                                        
                                        1 Reply Last reply
                                        0
                                        • TON RIJNAARDT Offline
                                          TON RIJNAARDT Offline
                                          TON RIJNAARD
                                          wrote on last edited by
                                          #268

                                          Hello,

                                          Can some one help me with a working sketch for Domoticz.
                                          I have it a little working, only Domoticz give not the childs.
                                          I get from the gate way the time and then is searching for the name from the zone.
                                          If some one can give me a working sketch than i can see what is wrong.

                                          Thanks in advance Ton

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


                                          12

                                          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