MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-AlarmClock append / push to alarms array

    Scheduled Pinned Locked Moved Troubleshooting
    5 Posts 2 Posters 1.7k Views 2 Watching
    Loading More Posts
    • 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.
    • axellejamousA Offline
      axellejamous
      last edited by axellejamous

      I’m trying to append alarm objects to the alarms array
      This is my code so far.

      // SET ALARM
              if(notification === "SET_ALARM"){
                  var mqttData = JSON.parse(payload);
                  this.config.alarms.push({time: mqttData.hour+":"+mqttData.min, days:
       [1,2,3,4,5,6,7], sound: "alarm.mp3", title: "Alarm", message: mqttData.msg});
                  this.updateDom(300);            
                  console.log("alarm obj: "+this.config.alarms);
              }
      

      However, in the console it shows only one alarm object.
      0_1516038503305_c79d2306-4f34-4423-b9b2-eeff11d9ffcc-image.png

      Note: I have one alarm set in the config file

      1 Reply Last reply Reply Quote 0
      • axellejamousA Offline
        axellejamous
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • axellejamousA Offline
          axellejamous
          last edited by

          I removed the Dom update and it seems to work.

          strawberry 3.141S 1 Reply Last reply Reply Quote 0
          • strawberry 3.141S Offline
            strawberry 3.141 Project Sponsor Module Developer @axellejamous
            last edited by

            @axellejamous be aware of that day 7 doesn’t exist the days range from 0 sunday to 6 saturday

            Please create a github issue if you need help, so I can keep track

            axellejamousA 1 Reply Last reply Reply Quote 2
            • axellejamousA Offline
              axellejamous @strawberry 3.141
              last edited by

              @strawberry-3.141 changed, thank you!

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Enjoying MagicMirror? Please consider a donation!
              MagicMirror created by Michael Teeuw.
              Forum managed by Sam, technical setup by Karsten.
              This forum is using NodeBB as its core | Contributors
              Contact | Privacy Policy