• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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-Tado wrong units

Scheduled Pinned Locked Moved Troubleshooting
28 Posts 3 Posters 3.6k Views 4 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.
  • W Offline
    WouterEekhout
    last edited by WouterEekhout May 30, 2020, 9:59 PM May 30, 2020, 9:57 PM

    @sdetweil I don’t think we are on the same page. Your solution is not working for me, therefor I cannot reproduce it.

    I tested it by setting my units in the config.js as following:

    var config = {
    ...
       units: 'lipsum',
    ...
    }
    

    I add your recommendation and debug it:
    2d91064e-ad55-478b-9bb9-f5da377194df-image.png

    As you can see, the self.config.units is not ‘lipsum’.

    If I keep my code like it is now:
    7bdf2312-7cba-47db-910a-466b09598448-image.png

    As you can see now self.config.units contains ‘lipsum’. Also the output on the screen is correct (It shows the temp in fahrenheit, because it is not equal to ‘metric’).

    I might be overlooking something. But as far as I am seeing, it works correctly.

    S 1 Reply Last reply May 30, 2020, 10:36 PM Reply Quote 0
    • S Away
      sdetweil @WouterEekhout
      last edited by sdetweil May 30, 2020, 10:46 PM May 30, 2020, 10:36 PM

      @WouterEekhout according to the doc

      https://docs.magicmirror.builders/development/core-module-file.html#available-module-instance-properties

      this.config	Boolean	The configuration of the module instance as set in the user's config.js file. This config will also contain the module's defaults if these properties are not over-written by the user config.
      

      and my experience matches this and depends on it.
      from my 2.11 system with your latest module installed
      config

      		{
              module: 'MMM-Tado',
              position: 'top_right', // This can be any of the regions.
              config: {
                  username: 'your_tado_username',
                  password: 'your_tado_password',
                  updateInterval: 300000,
                  units:"freddy"
              }
          }
      

      this.config
      this.config1.png

      self.config
      self.config1.png

      notice that self.config is THE mm config.js in object form and it HAS a ‘units’ value, so when the assignment happens
      this.config.units=self.config.units
      units will change from ‘freddy’ to ‘metric’

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • W Offline
        WouterEekhout
        last edited by May 31, 2020, 9:16 AM

        @sdetweil Thank you for the clarification. Now it is clear why there is miscommunication. I use the units from the general config settings: https://docs.magicmirror.builders/getting-started/configuration.html#general .

        To clarify my config looks like this:

        var config = {
        	address: "localhost", 
        	port: 8080,
        	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
        
        	language: "en",
        	timeFormat: 24,
        	units: "metric",
        
        	modules: [
        		{
        			module: 'MMM-Tado',
        			position: 'top_right',
        			header: 'My Home',
        			config: {
        				username: 'x',
        				password: 'x',
        				updateInterval: 300000,
        			}
        		},
        	]
        
        };
        

        Notice that the units-config is outside modules-config. And not in the module-config. I think this makes more sense. Because of this self.config.units does contain the correct value. I will update the readme about the units-config, so it will be more clear.

        S 1 Reply Last reply May 31, 2020, 11:52 AM Reply Quote 0
        • S Away
          sdetweil @WouterEekhout
          last edited by sdetweil May 31, 2020, 11:54 AM May 31, 2020, 11:52 AM

          @WouterEekhout ok, but… i don’t think that is what the USER wanted… their system is in metric, but they wanted your module display to be Fahrenheit, so I would use some other varname, and check to see if they specified that, and use IT over the system value…

          or because u have it as a default, if u set it to some invalid value, then check if its what you allow,
          then if invalid, use system, otherwise allow users value…

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • W Offline
            WouterEekhout
            last edited by May 31, 2020, 12:28 PM

            @sdetweil I disagree, it is unclear if the current config is not working or if he wanted a custom units setting for the app. @Stoffbeuteluwe Can you clarify if you wanted to set a different unit for the app?

            S 1 Reply Last reply May 31, 2020, 12:54 PM Reply Quote 0
            • S Offline
              Stoffbeuteluwe Project Sponsor @WouterEekhout
              last edited by May 31, 2020, 12:54 PM

              @WouterEekhout I am from Germany and I need metric unit but Sam helped me to fix and now it’s working for me.
              It would be cool to have the choice in module config. Metric or imperial
              Thanks to you guys

              S 1 Reply Last reply May 31, 2020, 12:55 PM Reply Quote 0
              • S Away
                sdetweil @Stoffbeuteluwe
                last edited by May 31, 2020, 12:55 PM

                @Stoffbeuteluwe what is your main config.js units set to? up near address:

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                S 1 Reply Last reply May 31, 2020, 2:18 PM Reply Quote 0
                • S Offline
                  Stoffbeuteluwe Project Sponsor @sdetweil
                  last edited by May 31, 2020, 2:18 PM

                  @sdetweil it is metric

                  S 1 Reply Last reply May 31, 2020, 2:20 PM Reply Quote 0
                  • S Away
                    sdetweil @Stoffbeuteluwe
                    last edited by May 31, 2020, 2:20 PM

                    @Stoffbeuteluwe so, the original code should have worked…

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    S 1 Reply Last reply May 31, 2020, 2:32 PM Reply Quote 0
                    • S Offline
                      Stoffbeuteluwe Project Sponsor @sdetweil
                      last edited by May 31, 2020, 2:32 PM

                      @sdetweil without your fix it does not work in my case

                      S 1 Reply Last reply May 31, 2020, 2:34 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 2 / 3
                      2 / 3
                      • First post
                        12/28
                        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