Read the statement by Michael Teeuw here.
2 Mirrors and one Sensor ( MMM-PIR-Sensor )
-
its 160cm x 65cm
One is a TV and one a Display -
You can install one PIR on one RPI(A).
Then, you can modify or build a module to send HTTPRequest to other RPI(B) on RPI(A) which has PIR sensor
Then, you can also modify or build a module to catch HTTPRequest on RPI(B) to use it as a signal for your job.- MMM-PIR-Sensor (RPI(A)) : You can modify
socektNotificationReceived()
to emit your custom notification,
Or send HTTPRequest directly to RPI(B) - MMM-NotificationTrigger (RPI(A)) : Or you can translate notification from MMM-PIR-Sensor to your custom notification for further relayed module,
Or you can execute directly external shell command/internal javascript for sending HTTPRequest when notification is coming from MMM-PIR-Sensor - Or … you can build your own module for this job.
- MMM-Remote-Controller (RPI(B)) : You can get HTTPRequest from RPI(A) to do something
- MMM-NotificationTrigger(RPI(B)) : This module also can catch HTTPRequest and do something
- Or … you can build your module for this job.
- Or you can make scripts with javascript or python or any other language to communicate between two RPIs. It will be not so difficult to expert, but…
- MMM-PIR-Sensor (RPI(A)) : You can modify
-
Thanks for your answer.
I will try it. -
Here is a simple example for using
MMM-NotificationTrigger
. Not tested, but you can catch the concept.Assumption
- RPI_A
- MM IP : 192.168.178.101:8080
- PIR_SENSOR is installed
- This will emit notification
"USER_PRESENCE"
with payloadtrue/false
- RPI_B
- MM IP : 192.168.178.102:8080
- PIR_SENSOR IS not installed.
- It needs payload value of
USER_PRESENCE
from RPI_A
RPI_A MMM-NotificationTrigger config
{ module: "MMM-NotificationTrigger", config: { triggers: [ { trigger: "USER_PRESENCE", triggerPayloadFilter: (payload) => { return payload }, fires: [ { fire: "DUMMY_NOTIFICATION", exec: `curl -d "notification=RELAYED_USER_PRESENCE&payload=true" http://192.168.178.102:8080/webhook` } ] }, { trigger: "USER_PRESENCE", triggerPayloadFilter: (payload) => { return !payload }, fires: [ { fire: "DUMMY_NOTIFICATION", exec: `curl -d "notification=RELAYED_USER_PRESENCE&payload=false" http://192.168.178.102:8080/webhook` } ] }, ] } },
If
USER_PRESENCE
notification is emitted from MMM-PIR-Sensor, it will be translated toDUMMY_NOTIFICATION
andcurl
shell command will be executed to transfer message(RELAYED_USER_PRESENCE) to RPI_BRPI_B MMM-NotificationTrigger config
{ module: "MMM-NotificationTrigger", config: { useWebhook: true, triggers: [ { trigger: "RELAYED_USER_PRESENCE", fires: [ { fire: "DOING_MY_JOB", payload: (payload) => { return (payload == "true") ? true : false } } ] } ] } },
By
useWebhook:true
it can listen message from RPI_A. WhenRELAYED_USER_PRESENCE
is coming,DOING_MY_JOB
(or whatever you want) notification will be emitted on RPI_B - RPI_A
-
@binia very cool implementation!