MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-Fuel - multi instances

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    2 Posts 2 Posters 414 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L Offline
      Liz
      last edited by Liz

      Cause we live close to the border with largely varying fuel prices (switzerland, austria, germany) I wanted to set up 3 instances of the MMM-Fuel module to compare prices.

      It appears to only use one (the first) of the configured providers and locations.
      The module is shown twice on my mirror, with the same stations. It rotates through both fuel types and distance sorting then starts at the first fuel type again.

      If I only use one of my configurations either one works as intended.

      Is there any way to start multipe instances?

      this is my config for two locations:

      {
      		module: "MMM-Fuel",
      		position: "top_right",
      		config: {
      			provider: "tankerkoenig",
      			api_key: "myAPiKey for tankerkönig",
      			lat: 47.791416,
      			lng: 9.882849,
      			radius: 15,
      			types: ["diesel", "e5"],
      			// all your config options, which are different than their default values
      			}
      		},
      		{
      		module: "MMM-Fuel",
      		position: "top_right",
      		config: {
      			provider: "spritpreisrechner",
      			lat: 47.2722109,
      			lng: 9.6025761,
      			radius: 5,
      			types: ["diesel", "e5"],
      			// all your config options, which are different than their default values
      			}
      		},
      
      S 1 Reply Last reply Reply Quote 0
      • S Away
        sdetweil @Liz
        last edited by sdetweil

        @liz looking at the code, this module doesn’t support multiple instances.

        you might be able to make a setup for this

        copy the MMM-Fuel folder to
        new folder MMM-Fuel1
        inside MMM-Fuel1, rename everything MMM-Fuel to MMM-Fuel1
        inside templates, rename MMM-Fuel.njk to MMM-Fuel1.njk

        inside the MMM-Fuel1.js, change places of MMM-Fuel to MMM-Fuel1

        Module.register('MMM-Fuel', {   // <-
        
            getStyles() {
                return ['font-awesome.css', 'MMM-Fuel.css']; .// <- 
            },
        
        
            getTemplate() {
                return 'templates/MMM-Fuel.njk';  // <- 
            },
        

        in your multi-instance config.js, change one of them to module:“MMM-Fuel1”

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Enjoying MagicMirror? Please consider a donation!
        MagicMirror created by Michael Teeuw.
        Forum managed by Sam, technical setup by Karsten.
        This forum is using NodeBB as its core | Contributors
        Contact | Privacy Policy