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

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Adjust time?

Adjust time?

Scheduled Pinned Locked Moved Troubleshooting
19 Posts 8 Posters 9.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    moffen666
    wrote on last edited by
    #1

    Hello

    My controller is Domoticz and it set up to show local time so that works, but the time in my sensors/node is off by 2h.

    My time 20:00
    Sensor shows 18:00

    Where do I correct this, can't seem to find any config file?

    Any idea?

    Regards

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

      Guess you always could add 60 * 60 * 2 to the time received from controller here:
      https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/examples/TimeAwareSensor/TimeAwareSensor.ino#L51

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pjeterinfo
        wrote on last edited by
        #3

        Domoticz shows your correct local time, but are you sure that the timezone on the Domoticz "server" is correctly configured?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          moffen666
          wrote on last edited by
          #4

          I checked the time on my Raspberry with Putty and it seems correct.

          @hek: How do you mean, should I use TimeAwareSensor.ino Im seeing this problem on 'IrrigationController.ino' atm

          http://www.mysensors.org/build/irrigation

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

            Like I said, add (or subtract) where the time is received. Should be a smililar line in the irrigation controller.

            But @pjeterinfo answer is probably better. Check the timezone setting on the Domoticz server.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              moffen666
              wrote on last edited by
              #6

              Dident find any similar line, but could this be the problem?

              https://www.domoticz.com/forum/viewtopic.php?f=6&t=6391

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

                Yes, sounds like your problem.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  moffen666
                  wrote on last edited by
                  #8

                  thx, dunno how to solve that tho, maybe someone else had the same problem?

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    moffen666
                    wrote on last edited by
                    #9

                    This is from the Domoticz forum:

                    At the moment this is used:
                    
                    case I_TIME:
                    //send time in seconds from 1970 with timezone offset
                    {
                    time_t atime = mytime(NULL);
                    struct tm ltime;
                    localtime_r(&atime, &ltime);
                    sstr << mktime(&ltime);
                    SendCommand(node_id, child_sensor_id, message_type, I_TIME, sstr.str());
                    }
                    
                    I would expect it to be local time now
                    
                    If your gateway system set to the correct timezone ?
                    
                    

                    Does the serial gateway modify the time before sending it to the nodes/sensors?

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

                      No, it doesn't.

                      1 Reply Last reply
                      0
                      • M moffen666

                        This is from the Domoticz forum:

                        At the moment this is used:
                        
                        case I_TIME:
                        //send time in seconds from 1970 with timezone offset
                        {
                        time_t atime = mytime(NULL);
                        struct tm ltime;
                        localtime_r(&atime, &ltime);
                        sstr << mktime(&ltime);
                        SendCommand(node_id, child_sensor_id, message_type, I_TIME, sstr.str());
                        }
                        
                        I would expect it to be local time now
                        
                        If your gateway system set to the correct timezone ?
                        
                        

                        Does the serial gateway modify the time before sending it to the nodes/sensors?

                        tekkaT Offline
                        tekkaT Offline
                        tekka
                        Admin
                        wrote on last edited by tekka
                        #11

                        @moffen666 said:

                        Does the serial gateway modify the time before sending it to the nodes/sensors?

                        UTC is the convention for time sync. UTC-local offset has to be adjusted in the callback function.
                        (I'm adding this because I had the same issue/request for MYSController: one can choose UTC or local time for sync...)

                        AWIA 1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          moffen666
                          wrote on last edited by
                          #12

                          Thx tekka

                          Im way in over my head here, but do I adjust the callback function in my Irrigation controller sketch.

                          The time reported from my sensors in the webUI is correct its only the time on my LCD in the irrigation controller that's off -2h.

                          Regards

                          YveauxY 1 Reply Last reply
                          0
                          • M moffen666

                            Thx tekka

                            Im way in over my head here, but do I adjust the callback function in my Irrigation controller sketch.

                            The time reported from my sensors in the webUI is correct its only the time on my LCD in the irrigation controller that's off -2h.

                            Regards

                            YveauxY Offline
                            YveauxY Offline
                            Yveaux
                            Mod
                            wrote on last edited by
                            #13

                            @moffen666 when doen right, it should be fixed in the gateway. Otherwise you need to adjust in all sensors and run into problemen when daylight-saving changes.

                            http://yveaux.blogspot.nl

                            1 Reply Last reply
                            0
                            • tekkaT tekka

                              @moffen666 said:

                              Does the serial gateway modify the time before sending it to the nodes/sensors?

                              UTC is the convention for time sync. UTC-local offset has to be adjusted in the callback function.
                              (I'm adding this because I had the same issue/request for MYSController: one can choose UTC or local time for sync...)

                              AWIA Offline
                              AWIA Offline
                              AWI
                              Hero Member
                              wrote on last edited by
                              #14

                              @tekka said:

                              UTC is the convention for time sync. UTC-local offset has to be adjusted in the callback function.
                              (I'm adding this because I had the same issue/request for MYSController: one can choose UTC or local time for sync...)

                              I am a little confused and running into the time difference issue. What is the 'standard' for the controller to report time?

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

                                If we want to be able to use the same (unmodified) sketch all over the world, I'd put my vote for letting the controller sending out local time (time adjusted).

                                I do it like that in the Vera plugin anyway.

                                AWIA 1 Reply Last reply
                                1
                                • hekH hek

                                  If we want to be able to use the same (unmodified) sketch all over the world, I'd put my vote for letting the controller sending out local time (time adjusted).

                                  I do it like that in the Vera plugin anyway.

                                  AWIA Offline
                                  AWIA Offline
                                  AWI
                                  Hero Member
                                  wrote on last edited by
                                  #16

                                  @moffen666 @hek Solved in latest beta of Domoticz thanks to very quick reaction of @GizMoCuz . Domoticz was sending UTC

                                  1 Reply Last reply
                                  0
                                  • C Offline
                                    C Offline
                                    chefkooch
                                    wrote on last edited by
                                    #17

                                    I've got the same problem with Fhem. Does anybody know where to change that in the fhem Module?

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      moffen666
                                      wrote on last edited by
                                      #18

                                      Amazing, what a great community here and over at Domoticz....

                                      Thank you all so much, just makes me glad!

                                      Regards

                                      1 Reply Last reply
                                      0
                                      • TheoLT Offline
                                        TheoLT Offline
                                        TheoL
                                        Contest Winner
                                        wrote on last edited by TheoL
                                        #19

                                        Is there a Domoticz fix for this? Because if it's returning UTC, you cannot use the time correctly through out the year. UTC doesn't have summer and winter time correction. This means that you have to recalibrate the time in your sensor, depening on the current date. In my opinion things like that should be handled by the Home Automation Server. But that's just my opinion ;)

                                        Ow. Responded to quick. Didn't saw the response of @AWI. I second @moffen666 I love the MySensor and Domoticz community

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


                                        11

                                        Online

                                        11.7k

                                        Users

                                        11.2k

                                        Topics

                                        113.1k

                                        Posts


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

                                        • Don't have an account? Register

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