MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    UNSOLVED MMM-Fuel - multi instances

    Troubleshooting
    2
    2
    151
    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
      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
        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

        Create a working config
        How to add modules

        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 Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
        This forum is using NodeBB as its core | Contributors
        Contact | Privacy Policy