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-compliment showing evening compliment anytime

    Scheduled Pinned Locked Moved Solved Troubleshooting
    24 Posts 2 Posters 5.7k 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.
    • S Offline
      selyjohns @sdetweil
      last edited by

      @sdetweil Hi,
      Ok great.
      I be able to see the value of hour variable.
      It seem to be correct because it’s 17.

      Condition of morning not verified.
      Condition of afternoon verified, so the line is executed (because 17 is between 12 and 18)

      compliments = this.config.compliments.afternoon.slice(0);

      I don’t know why evening compliments are displayed…it’s very strange

      S 1 Reply Last reply Reply Quote 0
      • S Do not disturb
        sdetweil @selyjohns
        last edited by sdetweil

        @selyjohns there are a few more lines of code to step thru…

        when it gets to the return compliments u can go er over compliments and then expand the array to see what is in there

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          selyjohns @sdetweil
          last edited by

          @sdetweil Yes ! Problem found…
          Step by step, i’ve understand

          		if (hour >= this.config.morningStartTime && hour < this.config.morningEndTime && this.config.compliments.hasOwnProperty("morning")) {
          			compliments = this.config.compliments.morning.slice(0);
          		} else if (hour >= this.config.afternoonStartTime && hour < this.config.afternoonEndTime && this.config.compliments.hasOwnProperty("afternoon")) {
          			compliments = this.config.compliments.afternoon.slice(0);
          		} else if (this.config.compliments.hasOwnProperty("evening")) {
          			compliments = this.config.compliments.evening.slice(0);
          		}
          

          The JS need to have a “morning” and “afternoon” compliments define, else it choosing “evening” by default if define.

          My problem was i don’t had afternoon compliment define…but i’ve evening one.

          Thank you very much for your time and your time :) It was very helpful.

          S 1 Reply Last reply Reply Quote 0
          • S Do not disturb
            sdetweil @selyjohns
            last edited by sdetweil

            @selyjohns awesome…

            I assume that if u don’t have any entries, you would still leave the list

            afternoon: [],

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              selyjohns @sdetweil
              last edited by

              @sdetweil sorry i don’t uderstand what you mean ?
              I think it works if afternoon is present but empty

              S 1 Reply Last reply Reply Quote 0
              • S Do not disturb
                sdetweil @selyjohns
                last edited by

                @selyjohns said in MMM-compliment showing evening compliment anytime:

                I think it works if afternoon is present but empty

                thats what I meant

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  selyjohns @sdetweil
                  last edited by

                  @sdetweil good :)
                  Ok so thank you for your help. Maybe it need to be more explicit on documentation.

                  And they are confusion between compliments and MMM-compliments

                  I will now close this case.

                  Have a good day

                  1 Reply Last reply Reply Quote 0
                  • 1
                  • 2
                  • 3
                  • 1 / 3
                  • 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