• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.8k 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.
  • A Offline
    axellejamous
    last edited by axellejamous Jan 15, 2018, 5:49 PM Jan 15, 2018, 5:40 PM

    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
    • A Offline
      axellejamous
      last edited by Jan 15, 2018, 5:48 PM

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • A Offline
        axellejamous
        last edited by Jan 15, 2018, 6:25 PM

        I removed the Dom update and it seems to work.

        S 1 Reply Last reply Jan 15, 2018, 9:21 PM Reply Quote 0
        • S Offline
          strawberry 3.141 Project Sponsor Module Developer @axellejamous
          last edited by Jan 15, 2018, 9:21 PM

          @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

          A 1 Reply Last reply Jan 15, 2018, 11:11 PM Reply Quote 2
          • A Offline
            axellejamous @strawberry 3.141
            last edited by Jan 15, 2018, 11:11 PM

            @strawberry-3.141 changed, thank you!

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              5/5
              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