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

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Time awareness and scheduling events

Time awareness and scheduling events

Scheduled Pinned Locked Moved Development
30 Posts 8 Posters 9.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • YveauxY Yveaux

    @hek I also want to be able to switch on my lights when my gateway is down, but when we want to move intelligence to the nodes (eg make them programmable using rules as seen in another discussion) we have to think upfront what the implications are and how to implement this. I should not rush some kind of schedule rules now, without thinking over the whole concept first.

    T Offline
    T Offline
    ToSa
    Code Contributor
    wrote on last edited by
    #12

    @Yveaux

    This is a request for ideas before I start coding any of this!!!

    :)
    time awareness was straight forward based on existing functionality (even if I would still argue that it should be an integral part of the sensor code and not require separate code in the custom sketch).The rules engine requires much more prep work and smart ideas.

    In an earlier project I ended up with the following (not saying that this is the best approach - just to start the discussion):

    • simple memory manager assigning memory addresses so that you can remotely request or set a variable in memory the same way you do today with sensors (think about a memory address having its own sensor-id on the node)
    • rules to set variables on the same node or on remote nodes (or on the gateway/controller)
    • rules triggered by schedule or triggered by events (button clicked / temperature changed / ...)
    • no need to trigger rules remotely - you can get that by setting a variable remotely and have a rule listening on changes to that variable (node A with the light switch telling node B with the relay to turn on the light)
    • gateway is always made aware of what's going on but usually not required for the execution

    The problem is that the "setup" of the network and the specific nodes gets way more complex - easy to do for software developers but hard to do for a "normal" user.

    1 Reply Last reply
    0
    • hekH hek

      @Yveaux

      Fully agree. That why we're discussing the concepts :facepunch: :)

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

      @hek yeah yeah... The initial post sounded quite concrete and is limited to time and scheduling. Therefore I wanted to broaden things a bit. But I guess this will automatically happen in a few hours anyway, if you get what I mean ;-)

      http://yveaux.blogspot.nl

      1 Reply Last reply
      0
      • T Offline
        T Offline
        ToSa
        Code Contributor
        wrote on last edited by
        #14

        @hek any plans to setup a "dev_1.5" branch or something similar? If we continue adding major functionality changes to 1.4 it will never get "ready" :)

        hekH 1 Reply Last reply
        0
        • T ToSa

          @hek any plans to setup a "dev_1.5" branch or something similar? If we continue adding major functionality changes to 1.4 it will never get "ready" :)

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

          @ToSa

          Yes, only ONE page left to document (API). Then I'll release 1.4 (push it to master) and we can have development for our selves again ;)

          1 Reply Last reply
          0
          • korttomaK korttoma

            @hek I ordered a few of these -> http://www.ebay.com/itm/191276972230 hoping they can serve the same purpose.

            korttomaK Offline
            korttomaK Offline
            korttoma
            Hero Member
            wrote on last edited by
            #16

            @korttoma said:

            @hek I ordered a few of these -> http://www.ebay.com/itm/191276972230 hoping they can serve the same purpose.

            I have now been playing with one of these for a few hour and I really like it. Running an LCD and TinyRTC on the same I2C bus and it is working fine.
            Need some more time on the sketch before I mount everything in a box. The goal is a scene controller
            / clock / info display by the bed.
            I was thinking of adding the knock sensor as a "clapper" device but I don't think I can pull of the code so that it would keep updating the clock as often as I would like.

            • Tomas
            hekH 1 Reply Last reply
            0
            • korttomaK korttoma

              @korttoma said:

              @hek I ordered a few of these -> http://www.ebay.com/itm/191276972230 hoping they can serve the same purpose.

              I have now been playing with one of these for a few hour and I really like it. Running an LCD and TinyRTC on the same I2C bus and it is working fine.
              Need some more time on the sketch before I mount everything in a box. The goal is a scene controller
              / clock / info display by the bed.
              I was thinking of adding the knock sensor as a "clapper" device but I don't think I can pull of the code so that it would keep updating the clock as often as I would like.

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

              @korttoma

              Yes, received mine yesterday but haven't had time to play with it yet.
              The DS3231 I got seems to have a build-in temp-sensor also.

              1 Reply Last reply
              0
              • greglG Offline
                greglG Offline
                gregl
                Hero Member
                wrote on last edited by
                #18

                Probably not something you need guys, but something i did the other day - a sketch to request the time from Vera and set an RTC.

                My requirement is to keep the RTC synced when daylight saving changes, so sync would be at 2:01 Sundays.

                https://codebender.cc/sketch:48244

                hekH 1 Reply Last reply
                1
                • greglG gregl

                  Probably not something you need guys, but something i did the other day - a sketch to request the time from Vera and set an RTC.

                  My requirement is to keep the RTC synced when daylight saving changes, so sync would be at 2:01 Sundays.

                  https://codebender.cc/sketch:48244

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

                  @gregl

                  Thanks @gregl, was just about to create something similar :)

                  1 Reply Last reply
                  0
                  • greglG Offline
                    greglG Offline
                    gregl
                    Hero Member
                    wrote on last edited by
                    #20

                    No prob... you can remove the bugs ive added ;-)

                    1 Reply Last reply
                    0
                    • korttomaK Offline
                      korttomaK Offline
                      korttoma
                      Hero Member
                      wrote on last edited by
                      #21

                      Thanks! @GREGL I find it useful also for my project.

                      • Tomas
                      1 Reply Last reply
                      0
                      • JohnJ Offline
                        JohnJ Offline
                        John
                        Plugin Developer
                        wrote on last edited by
                        #22

                        I would suggest to sync times a little bit more because if i remember correct the 1307 is quite sensitive for drifting because of temperature, if it would drift 3 seconds a day would be around 16 minutes a year, the DS3231 compansates this with the build in temp sensor.

                        But i could be incorrect, but, update your rtc more often anyway ;)

                        My Domotica project: http://www.pidome.org

                        1 Reply Last reply
                        0
                        • korttomaK Offline
                          korttomaK Offline
                          korttoma
                          Hero Member
                          wrote on last edited by korttoma
                          #23

                          Just tried the DS3232RTC library from the examples provided by @hek and it seems like the RTC I2C DS1307 AT24C32 (link to device in earlier post) I have is working happily with this library also. I guess all the features of the library does not work but since the features on my device are working I will stick with this lib since it is provided by MySensors.

                          Maybe you should try it out to @gregl

                          BTW!, the RTC I have seems to drift quite allot (~1s/h) so I would not recommend it to someone that needs accuracy.

                          • Tomas
                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            ToSa
                            Code Contributor
                            wrote on last edited by
                            #24

                            All - help me understand the use-case for a RTC on a sensor please.

                            From the discussion above I get that we might have two different needs:

                            • really high accuracy
                            • a second (or few seconds) deviation are acceptable

                            We lose accuracy in RF transmission already, therefore fetching the time on the controller or gateway and sending it to the nodes is not appropriate for the high accuracy need. A RTC would not help in this case because you need to tell the RTC the current time to start with and if that's already inaccurate, you won't get the accuracy needed. The only way to get real accuracy would be to fetch it on the node directly e.g. with a DCF77 receiver.
                            For the "less accuracy needed" scenario why would you add hardware to the node if receiving a time broadcast from the controller every x minutes is good enough to get the required (lower) accuracy "in software" without the need for hardware?

                            hekH 1 Reply Last reply
                            0
                            • JohnJ Offline
                              JohnJ Offline
                              John
                              Plugin Developer
                              wrote on last edited by John
                              #25

                              You would be better of with an http://www.maximintegrated.com/en/products/digital/real-time-clocks/DS3231.html which has a theoretically drift between 1 and 2 minutes a year (depending on operating temperatures).If i'm correct it uses the internal temp sensor for drift compensation (and could also be read?).

                              My Domotica project: http://www.pidome.org

                              1 Reply Last reply
                              0
                              • T ToSa

                                All - help me understand the use-case for a RTC on a sensor please.

                                From the discussion above I get that we might have two different needs:

                                • really high accuracy
                                • a second (or few seconds) deviation are acceptable

                                We lose accuracy in RF transmission already, therefore fetching the time on the controller or gateway and sending it to the nodes is not appropriate for the high accuracy need. A RTC would not help in this case because you need to tell the RTC the current time to start with and if that's already inaccurate, you won't get the accuracy needed. The only way to get real accuracy would be to fetch it on the node directly e.g. with a DCF77 receiver.
                                For the "less accuracy needed" scenario why would you add hardware to the node if receiving a time broadcast from the controller every x minutes is good enough to get the required (lower) accuracy "in software" without the need for hardware?

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

                                @ToSa said:

                                All - help me understand the use-case for a RTC on a sensor please.

                                If your mains powered watering node has a power failure (restarts) and loses connection to controller.

                                1 Reply Last reply
                                0
                                • JohnJ Offline
                                  JohnJ Offline
                                  John
                                  Plugin Developer
                                  wrote on last edited by John
                                  #27

                                  All - help me understand the use-case for a RTC on a sensor please.

                                  http://forum.mysensors.org/topic/284/simple-temp-light-time-setup-with-lcd-1-4-no-beta-anymore

                                  Time currently is being pushed every minute by the device created on the controller to "the display" (It has no RTC now). When it fails to receive the new time it would then be standing still. So it is nice to have without power failure.

                                  My Domotica project: http://www.pidome.org

                                  T 1 Reply Last reply
                                  0
                                  • JohnJ John

                                    All - help me understand the use-case for a RTC on a sensor please.

                                    http://forum.mysensors.org/topic/284/simple-temp-light-time-setup-with-lcd-1-4-no-beta-anymore

                                    Time currently is being pushed every minute by the device created on the controller to "the display" (It has no RTC now). When it fails to receive the new time it would then be standing still. So it is nice to have without power failure.

                                    T Offline
                                    T Offline
                                    ToSa
                                    Code Contributor
                                    wrote on last edited by
                                    #28

                                    @hek @John
                                    using the "time.h" library on the node the time will continue to run. It will not be very accurate (as accurate as the "millis" in arduino) which should be sufficient to turn off the water after 15 minutes (no matter if that's a few seconds off) and good enough to let the clock tick further unless the next successful submission is received from the controller.

                                    JohnJ 1 Reply Last reply
                                    0
                                    • T ToSa

                                      @hek @John
                                      using the "time.h" library on the node the time will continue to run. It will not be very accurate (as accurate as the "millis" in arduino) which should be sufficient to turn off the water after 15 minutes (no matter if that's a few seconds off) and good enough to let the clock tick further unless the next successful submission is received from the controller.

                                      JohnJ Offline
                                      JohnJ Offline
                                      John
                                      Plugin Developer
                                      wrote on last edited by John
                                      #29

                                      @ToSa
                                      True, I personally will be using some self build wall clocks, and the display will get a bigger role in our household, so it would be nice to keep track of time as close as possible.

                                      My Domotica project: http://www.pidome.org

                                      1 Reply Last reply
                                      0
                                      • greglG Offline
                                        greglG Offline
                                        gregl
                                        Hero Member
                                        wrote on last edited by
                                        #30

                                        @ToSa
                                        In my use case its a pool controller I use a rtc to do several things..but the desire to sync is really just to adjust for daylight savings changes.

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


                                        15

                                        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