Navigation

    MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    sendNotification help

    Troubleshooting
    2
    6
    1100
    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.
    • J
      jasondreher last edited by

      I want to be able to send a value to https://github.com/mykle1/MMM-EventHorizon to change the time used in a count down timer. Right now I can make the module hide with…

      this.sendNotification('HIDE_TIMER');
      

      but I cant seem to do much more, how do I change my sendNotification to include a payload to change the date and time in MMM-EventHorizon. I will have to change the notificationReceived in MMM-EventHorizon to I assume…

      S 1 Reply Last reply Reply Quote 0
      • S
        sdetweil @jasondreher last edited by sdetweil

        @jasondreher just add the payload on to the api call like this

        this.sendNotification('HIDE_TIMER', payload);
        

        ‘payload’ can be anything… a variable (this.variable_name), a literal(‘some literal string’), a dynamically constructed value (‘some value’ + variable_name + ’ right now ')

        the receiving modules sendNotificationReceived(code, payload, sender) function is responsible for ignoring or processing the payload data according to the shared rules of the sender

        1 Reply Last reply Reply Quote 0
        • J
          jasondreher last edited by jasondreher

          OK so I change my sendNotification to

          this.sendNotification('SHOW_TIMER','18:25:25');
          

          and the MMM-EventHorizon notificationReceived to

              notificationReceived: function(notification, payload) {
                  if (notification === 'HIDE_TIMER') {
                      this.hide(1000);
                  } else if (notification === 'SHOW_TIMER') {
                      this.show(1000);
                      this.time = payload //I added this
                      this.updateDom();  //I added this
                  }
          
              },
          

          Thinking the paylaod will update the countdown time but it does nothing… Not sure what I am doing worng. I have tested this quite a few different ways and searched quite a bit…

          I can tell its doing something as it flickers (like it is refreshing with the updateDom) but the countdown does not reflect the new time.

          S 1 Reply Last reply Reply Quote 0
          • S
            sdetweil @jasondreher last edited by

            @jasondreher you didn’t use the payload. Just hide and show. I don’t know the other module.

            But I would guess u need to start a timer with some elapsed time til the action (from now)

            1 Reply Last reply Reply Quote 0
            • J
              jasondreher last edited by

              @jasondreher said in sendNotification help:

              this.time = payload

              I added “this.time = payload”, this is using the payload correct?

              1 Reply Last reply Reply Quote 0
              • S
                sdetweil last edited by

                @jasondreher said in sendNotification help:

                this.time = payload

                probably

                this.config.time = payload
                
                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 Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                This forum is using NodeBB as its core | Contributors
                Contact | Privacy Policy