Read the statement by Michael Teeuw here.
sendNotification help
-
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…
-
@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
-
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.
-
@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)
-
@jasondreher said in sendNotification help:
this.time = payload
I added “this.time = payload”, this is using the payload correct?
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login