Skip to content

Other modules

JoChef2 edited this page May 7, 2020 · 10 revisions

Here are examples for a lot of modules.

It's very easy to use the examples. You have to do only two things after you copied the examples in your config.

  1. Set the Name of the device
  2. Change the Port. You should beginn with port 11100 and count for every device up. Or if you changed the startPort begin 1000 over your startPort.
  3. (optional) Create routines in your Alexa app. That's often very helpful if you don't want to say turn on or off or you want so switch more then one device with one voice command.

Modules

MMM-CalendarExt2
MMM-Pages
MMM-Podcast2
MMM-SleepWake

There are four possible device types:

  1. Next scene
  2. Previous scene
  3. Specific scene
  4. Switch between scenes
  5. MMM-Pages with MMM-CalendarExt2

Next scene

notifications:[
    {
        name: 'Next calendar scene',
        port: <Your Port>,
        OnOff: false,
        notification: ["CALEXT2_SCENE_NEXT", 'null']
    }
]

Previous scene

notifications:[
    {
        name: 'Previous calendar scene',
        port: <Your Port>,
        OnOff: false,
        notification: ["CALEXT2_SCENE_PREVIOUS", 'null']
    }
]

Specific scene

You can change the scene with the name of the scene or the id.

1. ID:

The ids begin with 0. You have to set the id you want.

notifications:[
    {
        name: '<Your Name>',
        port: <Your Port>,
        OnOff: false,
        notification: ["CALEXT2_SCENE_CHANGE", {type:"id", key:<Your scene id>}]
    }
]
2. Name:

You have to set the name of the scene you want to change.

notifications:[
    {
        name: '<Your Name>',
        port: <Your Port>,
        OnOff: false,
        notification: ["CALEXT2_SCENE_CHANGE", {type:"name", key:"<Your scene name>"}]
    }
]

Switch between scenes

You can switch between two scenes like this:
Currently scene 1 is shown. When you say "Alexa turn on scene 2", scene 2 is shown. Then you say "Alexa turn off scene 2", scene 1 is shown.
To configure that first you have to set the types for the scenes. The first array is on and the second off. Then you can set the name or id.

notifications: [
    {
        name: '<Your Name>',
        port: <Your Port>,
        OnOff: true,
        notification: [
            ["CALEXT2_SCENE_CHANGE", "{type:"<The type></The>", key:"<Your scene name or id>"}"],
            ["CALEXT2_SCENE_CHANGE", {type:"<The type></The>", key:"<Your scene name or id>"}]
        ]
    }
]

MMM-Pages with MMM-CalendarExt2

If you want to use MMM-CalendarExt2 with MMM-Pages you have to add some things to the config of MMM-CalendarExt2. I found them here and here. I think the first one has everybody who uses both modules, but the second one is also necessary if you want to change the page with my module. So here is the full notification array you have to add to the MMM-CalendarExt2 config:

notifications: {
    "PAGE_INCREMENT": {
        exec: "sceneNext",
    },
    "PAGE_DECREMENT": {
        exec: "scenePrevious",
    },
    "PAGE_CHANGED": {
        exec: "changeSceneById",
        payload: (payload) => {
            return payload
        }
    }
},

Note: You need for every page a scene like it's described on the first page.

You have to do only one thing to integrate this module. Set the number of pages you have in the config like this: pages: 3. Then the module will create a device for every page. If you want to show the next or previous page you should use the following devices.

Next page

notifications:[
    {
        name: 'Next page',
        port: <Your Port>,
        OnOff: false,
        notification: ["PAGE_INCREMENT", 'payload']
    }
]

Previous page

notifications:[
    {
        name: 'Previous page',
        port: <Your Port>,
        OnOff: false,
        notification: ["PAGE_DECREMENT", 'payload']
    }
]

With my module you can use MMM-Podcast2 without MMM-Remote-Control. You have to set a notification like this:

notifications:[
    {
        name: '<Your Name>',
        port: <Your Port>,
        OnOff: false,
        notification: ["BUTTON_PRESSED_LONG", 'payload']
    }
]

Note: This module doesn't need OnOff because it looks itself if a video is currently playing.

You have to do only one thing to integrate this module: Set the option vcgencmd to hide like this: vcgencmd: "hide"