Read the statement by Michael Teeuw here.
How to configure MMM-Buttons to start/stop MMM-Podcast2
-
Hi there!
I’ve been lurking here for quite some time and found many helpful hints, while I’m building my first MagicMirror. Thanks for that to all!What do I want to accomplish?
I have following modules installed, which all run without problems:- MMM-Remote-Control
- MMM-Podcast2 (which starts the “tagesschau in 100 min.” video stream
- MMM-PIR-Sensor (to switch my monitor on and off)
Currently, I can start/stop the video stream when I enter http://myIP:8080/remote?action=NOTIFICATION¬ification=BUTTON_PRESSED in a browser.
Now I want to accomplish following user stories:
Story 1:
Press shortly a physical push-button on pin 27 to start/stop the video stream.
This button is also a combined restart/shutdown button.
Press > 2 sec --> Reboot
Press > 5 sec --> Shutdown
I am using this simple service.
Now I want to use the same button to start/stop the video stream, when I push it for less than 2 secs.Story 2:
When the PIR sensor detects motion and switches on the monitor, the video stream should start, too. Stopinfg the video by pressing shortly the physical push-button (see Story 1)I’ve installed MMM-Buttons, but I can’t find the right configuration of the MMM-Buttons module to at least start/stop the video.
What is the correct payload and notification I have to use?I hope that some could give the hint into the right direction.
Thanks in advance,
Fozi -
Alright, I found the solution myself, at least how to trigger play/stop with a push-button:
-
I wasn’t aware that connecting GND and a GPIO Pin like BCM 27 will not trigger reliably anything as the status is floating, Thus a pull-down resistor is required to get a defined high status. Check this really comprehensive write-up:
link text.
So I added a resistor as gescribed, e.g. here:
in chapter 4.2. -
Then I configures the MMM-Buttons module that way:
{ module: 'MMM-Buttons', config: { buttons: [ { pin: 27, name: "podcast", shortPress: { notification: "BUTTON_PRESSED", }, } ] } },
That’s it!
When I now push the button the video stream start shortly after playing, and when I push again, it stops.
The one thing I’m still trying to accomplish is that the PIR-sensor (AM312) on pin 4 triggers the video to start.
I home this helps some of you, when you come by.
Cheers,
Fozi -