Skip to content

MMM_TriggerNotification clarification and request #12

@KimORichter

Description

@KimORichter

This issue may not really be an issue due to what I am asking MMM-TN to do may not be the original intent of this module, in which case please consider this a request to see if it would be possible to do.

Project: I built a MagicMirror with a set of LED lights (not type WS2801, they are designed for backlighting TVs) that I am using for accent lighting want to control using motion detection. I am using MMM-GPIO-HANDLER to read the PIR sensor and control the LEDs RGB so three pins. I created a MagicMirror module, MMM-Timers, to provide time capabilities, it creates timers and sends notifications when timer compoletes. I am trying to fade the LEDs up when seeing motion and fade down after the timer completes. Sort of mimicking MMM-PIR operations, however main support for MMM-PIR is non-existent any more so I am trying to find a work-around. I firmly believe this process will work if I can get MMM-TN to see notifications from itself. I thought about trying to work it with 2 instances of MMM-TN but was not convinced I could make it work.

Issue: I have MMM_TriggerNotification working for external notifications, however if I send notifications from within MMM-TN to handle, MMM-TN does not see them.

Thank you.

Kim Richter

I have included my MM-TN config entry with commentary on what works and what does not for clarity of my use.

	{
		module: "MMM-NotificationTrigger",
		config: {
			useWebhook:false,
			triggers: [
				{
					trigger: "PIR_SENSOR_DETECTION",						// <---------------sees this trigger when sent by PIR
					fires: [                                                                                             //  but not when ALL_MODULES_STARTED notification is issued below
						 {
							fire:"SHOW_ALERT",								// for troubleshooting, will be removed
							payload: function() {
							  return {
								type:"notification",
								title:"PIR_SENSOR_DETECTION",
								message: "motion detected"
							 }
							},
						  },
						{	// Notification to MMM-Pages to show modules
							fire: "LEAVE_HIDDEN_PAGE",						// <---------------works
							payload: "",
						},
						{	// Notification to MMM-Timers to create timer
							fire: "TIMER_CREATE",							// <---------------works
							payload: (payload) => {
								return {
									name: "SCREEN_TIMER",
									timerInterval: 15,
									isRunning: true,
								}
							}
						},
						{	// Notification to MMM-Timers to start timer
							fire: "TIMER_START",							// <---------------works
							payload: (payload) => {
								return {
									name: "SCREEN_TIMER"
								}
							},
						},
						 {  Show alert that we are about to send MY_FADE_LEDS
							fire:"SHOW_ALERT",								// for troubleshooting, will be removed
							payload: function() {
							  return {
								type:"notification",
								title:"PIR_SENSOR_DETECTION",
								message: "Sending MY_FADE_LEDS"
							 }
							},
						  },
						{	// 
							fire: "MY_FADE_LEDS",							// Trigger defined below --- I see it in ViewNotifications but does not see it above
							payload: ""										//						 --- does not trigger from this notification 	
						},
					]
				},
				{   // MM Notification of all modules started
					trigger: "ALL_MODULES_STARTED",							// <---------------works
					fires: [
						 {
							fire:"SHOW_ALERT",								// for troubleshooting, will be removed
							payload: function() {
							  return {
								type:"notification",
								title:"ALL_MODULES_STARTED",
								message: "Sending PIR_SENSOR_DETECTION"
							 }
							},
						  },
						{	// 
							fire: "PIR_SENSOR_DETECTION",					// <---------------Trigger above --- I see it in ViewNotifications but does not see it above
							payload: "",									//								 --- does not trigger from this notification 	
						}
					]
				},
				{
					trigger: "TIMER_COMPLETED",								// <---------------works
					fires: [
						 {
							fire:"SHOW_ALERT",								// for troubleshooting, will be removed
							payload: function() {
							  return {
								type:"notification",
								title:"TIMER_COMPLETED",
								message: "Sending MY_FADE_LEDS"
							 }
							},
						  },
						{	// Notification to MMM-Pages to display hidden page
							fire: "SHOW_HIDDEN_PAGE",						// <---------------works
							payload: "screenSaver",
						},
						{	// 
							fire: "MY_FADE_LEDS",							// Trigger defined below --- I see it in ViewNotifications but does not see it above
							payload: ""
						},
					]
				},
				{
					trigger: "MY_FADE_LEDS",								// Trigger MY_FADE_LEDS definition - never Triggers
					fires: [
						 {
							fire:"SHOW_ALERT",								// for troubleshooting, will be removed
							payload: function() {							// never publishes this alert
							  return {
								type:"notification",
								title:"In MY_FADE_LEDS",
								message: "Sending: HANDLE_ON/OFF Set:State:0"
							 }
							},
						  },
					]
				},
			]
		}
	},

Again, thank you the great module and for looking at this request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions