shbatm / MMM-Carousel

Displays a single magic mirror module at a time, rotating through the list of configured modules in a carousel-like fashion.
MIT License
40 stars 13 forks source link

CarouselId variable #19

Closed Robiv8 closed 5 years ago

Robiv8 commented 5 years ago

I have 7 identical modules with different locations. I gave them each a different carouselId. 1-7

module:" MMM-Public-TransportHafas ",
position: "bottom_right",
config: {
carouselId: "1",
...
module: "MMM-Public-TransportHafas",
position: "bottom_right",
config: {
carouselId: "2",
...
module: "MMM-Public-TransportHafas",
position: "bottom_left",
config: {
carouselId: "3",
...

in the config:

"1": ['MMM-DWD-WarnWeather',{name:'clock',carouselId:'3'}, {name:'MMM-PublicTransportHafas',carouselId:'1'}, {name:'MMM-PublicTransportHafas',carouselId:'2'}, {name:'MMM-PublicTransportHafas',carouselId:'3'} ],

The problem is that only one module is displayed! And while the first.

If i give the same id to all 3 modules (carouselId: "3")

"1": ['MMM-DWD-WarnWeather',{name:'clock',carouselId:'2'},{name:'MMM-PublicTransportHafas',carouselId:'3'}],

all 3 are displayed correctly. Why are they not recognized by id?

shbatm commented 5 years ago

What are you trying to do, are you trying to show a couple each on different slides? The carouselId value should be the same for all of the modules you want to show on a single slide, and different when you want them on different slides.

Please post the full MMM-Carousel config for additional help.

Two Slide Example:

"1": ['MMM-DWD-WarnWeather',
       {name:'clock',carouselId:'3'}, // Shows ALL clock modules with ID: 3
       {name:'MMM-PublicTransportHafas',carouselId:'1'}], // Shows ALL MMM-PublicTransportHafas modules with id: 1
"2": [{name:'MMM-PublicTransportHafas',carouselId:'2'} ] // Shows ALL MMM-PublicTransportHafas modules with id: 2
Robiv8 commented 5 years ago

I have 6 timetables, 1 each for different railways. On the main page I want to display 4 plans but on the other pages 1 each of them.

Module X - City 1 Module X - City 2 Module X - City 3 Module X - City 4

On the mainpage show Module X - City 1,2,3 and 4, clock, .. Page 2 = Module X - City 1, clock, .. Page 3 = Module X - City 2, clock, ..

Example config

{
    module: 'MMM-Carousel',
    position: 'bottom_bar', // Required only for navigation controls
    config: {
        transitionInterval: 0,
        showPageIndicators: true,
        showPageControls: false,
        ignoreModules: ['MMM-Podcast2', 'alert', 'MMM-Buttons', 'MMM-Remote-Control', 'MMM-Remote-Control-Repository'],
        mode: 'slides',
        slides: {
//          main: ['clock'],
            "1": ['MMM-DWD-WarnWeather',{name:'clock',carouselId:'3'},{name:'MMM-PublicTransportHafas',carouselId:'1'},{name:'MMM-PublicTransportHafas',carouselId:'2'},{name:'MMM-PublicTransportHafas',carouselId:'3'},{name:'MMM-PublicTransportHafas',carouselId:'5'}],
            "2": ['MMM-DarkSkyForecast', {name:'newsfeed', carouselId: '5'}, {name:'MMM-PublicTransportHafas',carouselId:'1'}],
            "3": ['MMM-DWD-WarnWeather', {name:'MMM-PublicTransportHafas',carouselId:'2'}],
            "4": ['MMM-DarkSkyForecast', {name:'MMM-PublicTransportHafas',carouselId:'3'}],
            "5": ['MMM-DWD-WarnWeather', {name:'MMM-PublicTransportHafas',carouselId:'4'}],
            "6": ['MMM-DarkSkyForecast', {name:'MMM-PublicTransportHafas',carouselId:'5'}]
        }
    }
},

#######

{
module: "MMM-PublicTransportHafas",
name: "Miedelsbach",
position: "bottom_right",
config: {
carouselId: "1",
stationID: "008007193",// Replace with your stationID!
headerPrefix: "Bf",
stationName: "Miedelsbach",   // Replace with your station name!
direction: "",     // Show only departures heading to this station. (A station ID.)
ignoredLines: [],   // Which lines should be ignored? (comma-separated list of line names)
excludedTransportationTypes: ["bus"],  // Which transp not be shown (, list) values:StN tram, BuN bus, s suburban
timeInFuture: 120,
showTableHeaders: false, //true,
showColoredLineSymbols: true,     // Want colored line symbols?
useColorForRealtimeInfo: true,    // Want colored real time information (timeToStation, early)?
showTableHeadersAsSymbols: true,  // Table Headers as symbols or text?
maxUnreachableDepartures: 1,      // How many unreachable departures should be shown?
maxReachableDepartures: 4,        // How many reachable departures should be shown?
//customLineStyles: "hafas", // Prefix for the name of the custom css file. ex: Leipzig-lines.css (case sensitive)
showOnlyLineNumbers: false        // Display only the line number instead of the complete name, i. e. "11" instead of "STR 11"
}
},
{
module: "MMM-PublicTransportHafas",
name: "Frickenhausen",
position: "bottom_right",
config: {
carouselId: "2",
stationID: "008007446",// Replace with your stationID!
headerPrefix: "Bf",
stationName: "Frickenhausen",   // Replace with your station name!
direction: "",     // Show only departures heading to this station. (A station ID.)
ignoredLines: [],   // Which lines should be ignored? (comma-separated list of line names)
excludedTransportationTypes: ["bus"],  // Which transp not be shown (, list) values:StN tram, BuN bus, s suburban
timeInFuture: 120,
showTableHeaders: false, //true,
showColoredLineSymbols: true,     // Want colored line symbols?
useColorForRealtimeInfo: true,    // Want colored real time information (timeToStation, early)?
showTableHeadersAsSymbols: true,  // Table Headers as symbols or text?
maxUnreachableDepartures: 1,      // How many unreachable departures should be shown?
maxReachableDepartures: 4,        // How many reachable departures should be shown?
//customLineStyles: "hafas",             // Prefix for the name of the custom css file. ex: Leipzig-lines.css (case sensitive)
showOnlyLineNumbers: false        // Display only the line number instead of the complete name, i. e. "11" instead of "STR 11"
}
},
{
module: "MMM-PublicTransportHafas",
name: "Korntal",
position: "bottom_left",
config: {
carouselId: "3",
stationID: "008003409",// Replace with your stationID!
headerPrefix: "Bf",
stationName: "Korntal DB",   // Replace with your station name!
direction: "",     // Show only departures heading to this station. (A station ID.)
ignoredLines: [],   // Which lines should be ignored? (comma-separated list of line names)
excludedTransportationTypes: ["bus", "Fernverkehr"],  // Which transp not be shown (, list) values:StN tram, BuN bus, s suburban
timeInFuture: 120,
showTableHeaders: false, //true,
showColoredLineSymbols: true,     // Want colored line symbols?
useColorForRealtimeInfo: true,    // Want colored real time information (timeToStation, early)?
showTableHeadersAsSymbols: true,  // Table Headers as symbols or text?
maxUnreachableDepartures: 1,      // How many unreachable departures should be shown?
maxReachableDepartures: 4,        // How many reachable departures should be shown?
//customLineStyles: "hafas",             // Prefix for the name of the custom css file. ex: Leipzig-lines.css (case sensitive)
showOnlyLineNumbers: false        // Display only the line number instead of the complete name, i. e. "11" instead of "STR 11"
}
},
{
module: "MMM-PublicTransportHafas",
name: "KorntalVoll",
position: "bottom_left",
config: {
carouselId: "4",
stationID: "008003409",// Replace with your stationID!
headerPrefix: "Bf",
stationName: "Korntal DB",   // Replace with your station name!
direction: "",     // Show only departures heading to this station. (A station ID.)
ignoredLines: [],   // Which lines should be ignored? (comma-separated list of line names)
excludedTransportationTypes: ["bus", "Fernverkehr"],  // Which transp not be shown (, list) values:StN tram, BuN bus, s suburban
timeInFuture: 240,
showTableHeaders: false, //true,
showColoredLineSymbols: true,     // Want colored line symbols?
useColorForRealtimeInfo: true,    // Want colored real time information (timeToStation, early)?
showTableHeadersAsSymbols: true,  // Table Headers as symbols or text?
maxUnreachableDepartures: 2,      // How many unreachable departures should be shown?
maxReachableDepartures: 8,        // How many reachable departures should be shown?
//customLineStyles: "hafas",             // Prefix for the name of the custom css file. ex: Leipzig-lines.css (case sensitive)
showOnlyLineNumbers: false        // Display only the line number instead of the complete name, i. e. "11" instead of "STR 11"
}
},
{
module: "MMM-PublicTransportHafas",
name: "Münchingen",
position: "bottom_left",
config: {
carouselId: "5",
stationID: "000557824",// Replace with your stationID!
headerPrefix: "Bf",
stationName: "Münchingen",   // Replace with your station name!
direction: "",     // Show only departures heading to this station. (A station ID.)
ignoredLines: [],   // Which lines should be ignored? (comma-separated list of line names)
excludedTransportationTypes: ["bus"],  // Which transp not be shown (, list) values:StN tram, BuN bus, s suburban
timeInFuture: 120,
showColoredLineSymbols: true,     // Want colored line symbols?
useColorForRealtimeInfo: true,    // Want colored real time information (timeToStation, early)?
showTableHeadersAsSymbols: true,  // Table Headers as symbols or text?
maxUnreachableDepartures: 1,      // How many unreachable departures should be shown?
maxReachableDepartures: 4,          // How many reachable departures should be shown?
//customLineStyles: "hafas", // Prefix for the name of the custom css file. ex: Leipzig-lines.css (case sensitive)
showOnlyLineNumbers: false          // Display only the line number instead of the complete name, i. e. "11" instead of "STR 1
}
},
{
module: "MMM-PublicTransportHafas",
name: "MünchingenVoll",
position: "bottom_right",
config: {
carouselId: "6",
stationID: "000557824",// Replace with your stationID!
headerPrefix: "Bf",
stationName: "Münchingen",   // Replace with your station name!
direction: "",     // Show only departures heading to this station. (A station ID.)
ignoredLines: [],   // Which lines should be ignored? (comma-separated list of line names)
excludedTransportationTypes: ["bus"],  // Which transp not be shown (, list) values:StN tram, BuN bus, s suburban
timeInFuture: 240,
showColoredLineSymbols: true,     // Want colored line symbols?
useColorForRealtimeInfo: true,    // Want colored real time information (timeToStation, early)?
showTableHeadersAsSymbols: true,  // Table Headers as symbols or text?
maxUnreachableDepartures: 2,      // How many unreachable departures should be shown?
maxReachableDepartures: 8,          // How many reachable departures should be shown?
//customLineStyles: "hafas", // Prefix for the name of the custom css file. ex: Leipzig-lines.css (case sensitive)
showOnlyLineNumbers: false          // Display only the line number instead of the complete name, i. e. "11" instead of "STR 1
}
},
shbatm commented 5 years ago

OK. Now I see what you are trying to do. This isn't supported in the current version, but I made a small change and pushed a new version to the develop branch for you to try.

The changes I made will now do partial matches for the slide to allow you to tag them in different groups on different slides.

Checkout Develop Branch:

cd ~/MagicMirror/modules/MMM-Carousel
git fetch --all && git checkout develop
# Restart your MagicMirror

Changes:

Try changing the carouselId of the ones you want to show on the main page to "main|1", "main|2", etc. (e.g. Tag them with "main|" and also the slide number you want them to show on).

Then update your slide section like so:

        slides: {
            "1": ['MMM-DWD-WarnWeather',{name:'clock',carouselId:'3'},{name:'MMM-PublicTransportHafas',carouselId:'main'}], // Should match all modules with "main" in the ID string
            "2": ['MMM-DarkSkyForecast', {name:'newsfeed', carouselId: '5'}, {name:'MMM-PublicTransportHafas',carouselId:'1'}], // Will only match a module with "1" in the ID string.
            "3": ['MMM-DWD-WarnWeather', {name:'MMM-PublicTransportHafas',carouselId:'2'}],
            "4": ['MMM-DarkSkyForecast', {name:'MMM-PublicTransportHafas',carouselId:'3'}],
            "5": ['MMM-DWD-WarnWeather', {name:'MMM-PublicTransportHafas',carouselId:'4'}],
            "6": ['MMM-DarkSkyForecast', {name:'MMM-PublicTransportHafas',carouselId:'5'}]
        }
Robiv8 commented 5 years ago

THX i will try it tonight after work ;-) Many Thanks

Edit: Is working! I can live with that, it is a bit complicated but the main thing is that it works. Many Thanks