darickc / MMM-BackgroundSlideshow

MIT License
146 stars 84 forks source link

Implemented PLAY/PAUSE/NEXT notifications and fixed timer issue #29

Closed gpetersen closed 5 years ago

gpetersen commented 5 years ago

Please accept this pull request that implements the following notifications per #28

It also adds a notification for other modules when the background is updated.

darickc commented 5 years ago

Thanks for working on this.

sony8943 commented 4 years ago

Hello gpetersen I have PIR sensor and it's working great with my magic mirror it's open the HDMI screen but this is not the issue that the problem is I want when it's open the screen HDMI to start to play the picture then when the screen it's off to put in in pause mode. Another one question if you have from the keyboard to press to put the play mode and the pause mode. Thank you

gpetersen commented 4 years ago

@sony8943 - I use the MMM-KeyBindings module for keyboard control and have wired up a gesture sensor that acts as a USB keyboard and sends keystrokes. If you have some way to detect the event from your PIR sensor and send a MMM notification, or use a keystroke I think you could do what you need. Here's the top portion of my MMM-KeyBindings config that you can use for inspiration.

{
        module: 'MMM-KeyBindings',
        config: {
            enabledKeyStates: ["KEY_PRESSED"],
            evdev: { enabled: false },
            //gestures Right, Left, Up, Down, Clockwise, Anti-clockwise, Forward, Backward, Wave
            handleKeys: [ 'r', 'l', 'u', 'd', 'c', 'a','f','b','w','p','y','n'], 
            //enableMousetrap: true,
            enableKeyboard: true,

            // http://localhost:8080/api/modules to get module names
            actions: [
                {
                    key: "y",
                    state: "KEY_PRESSED",
        mode: "DEFAULT",
        notification: "BACKGROUNDSLIDESHOW_PLAY",
                },
sony8943 commented 4 years ago

Cheers but background slide show no have a keyboard shortcut ? for play p or any key for pause spacebar or any key.

gpetersen commented 4 years ago

Not directly, no - but easy to add with the MMM-KeyBindings module. Just define which keys you want to handle, and the action/notification you want to send. E.g. Play/Pause/etc.

sony8943 commented 4 years ago

ok thank-you

sony8943 commented 4 years ago

Hello i install the module MMM-KeyBindings i put in config but where i have to put notification: "BACKGROUNDSLIDESHOW_PLAY", only in MMM-KeyBindings config area or in MMM-BackgroundSlideshow config areea

sony8943 commented 4 years ago

    {
module: 'MMM-BackgroundSlideshow',
position: 'fullscreen_below',
config: {
  imagePaths: ['modules/MMM-BackgroundSlideshow/exampleImages'],
  transitionImages: true,
  randomizeImageOrder: 'random',
  sortImagesBy: 'random',
  imageInfo: 'name, date, imagecount',
  showImageInfo: 'true',
  backgroundSize: 'contain',
  notification: "BACKGROUNDSLIDESHOW_PREVIOUS",
},

},

 {
module: 'MMM-KeyBindings',
config: {
    enabledKeyStates: ["KEY_PRESSED"],
    evdev: { enabled: false },
    handleKeys: [ 'r', 'l', 'u', 'd', 'c', 'a','f','b','w','p','y','n'],
    enableKeyboard: true,

    actions: 
         {
             key: "y",
             state: "KEY_PRESSED",
    mode: "DEFAULT",
    notification: "BACKGROUNDSLIDESHOW_PREVIOUS",
   }
 }

},

cpp

sony8943 commented 4 years ago

its ok like that ?

sony8943 commented 4 years ago

Can you help me how to enable notification

gpetersen commented 4 years ago

Notifications are automatically enabled and how the different MMM Modules talk to each other, you shouldn't need the notification: "BACKGROUNDSLIDESHOW_PREVIOUS", in your MMM-BackgroundSlideshow module, it's simply part of the code and will respond to those notifications.

You can also install the MMM-ViewNotifications module to help you visualize whether your notification is being sent.

{
    module: 'MMM-ViewNotifications',
    position: "top_left",
    header: "Notifications",
    config: {
        //config options here
    }
}
sony8943 commented 4 years ago
    {
module: 'MMM-BackgroundSlideshow',
position: 'fullscreen_below',
config: {
  imagePaths: ['modules/MMM-BackgroundSlideshow/exampleImages'],
  transitionImages: true,
  randomizeImageOrder: 'random',
  sortImagesBy: 'random',
  imageInfo: 'name, date, imagecount',
  showImageInfo: 'true',
  backgroundSize: 'contain',

}

},

 {
module: 'MMM-ViewNotifications',
position: "top_left",
header: "Notifications",

},

 {
module: 'MMM-KeyBindings',
config: {
    enabledKeyStates: ["KEY_PRESSED"],
    evdev: { enabled: true },
    handleKeys: [ 'r', 'l', 'u', 'd', 'c', 'a','f','b','w','p','y','n'],
    enableKeyboard: true,

    actions: 
         {
             key: "y",
             state: "KEY_PRESSED",
    mode: "DEFAULT",
    notification: "BACKGROUNDSLIDESHOW_PREVIOUS",
   }
 }

},

sony8943 commented 4 years ago

I press y from the keyboard And nothing happened I want to change the picture when I press the y from the keyboard. I have to implement something else to put on the config. ?

sony8943 commented 4 years ago

I Install de modul view notifications it's working fine, I can see any anything happened on the magic mirror . It's showing when I press any key , it's showing key press.

sony8943 commented 4 years ago

Screenshot_20201010-113312.png