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.

    Module help for variable

    Scheduled Pinned Locked Moved Solved Troubleshooting
    10 Posts 2 Posters 2.5k 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.
    • R Offline
      rts58
      last edited by

      Thank you @sdetweil ! So that helps me to create the module level variable. Sorry for dumb question, but how to I read/write it from within my process data function? I thought using this.oldAwayState would be the module level.

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

        @rts58 this should work w your code as is

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • R Offline
          rts58
          last edited by

          That’s what I thought. But it still fires off every two minutes, there must be an error in the logic.

          1 Reply Last reply Reply Quote 0
          • R Offline
            rts58
            last edited by

            Is there something wrong with this:

            if (!(this.oldAwayState === awayState) && (this.awayState === 'home')) 
            

            maybe they are both not strings or something?

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

              @rts58 you can use the dev console and put stops in the code and look at the variables

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              R 2 Replies Last reply Reply Quote 1
              • R Offline
                rts58 @sdetweil
                last edited by

                @sdetweil thanks, I’ll give that a try. I’ve been writing the variables to the consol log but it’s not quite as helpful.

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

                  @rts58 the dev light is only for the module just file ( where getDom() is located)

                  Debugging the node helper or included scripts needs the console.log. sorry for confusion

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    rts58 @sdetweil
                    last edited by

                    @sdetweil Thanks, I got it. I needed to get rid of “this”. So the correct test was:

                    if (!(oldAwayState === awayState) && (awayState === 'home')) 
                    
                    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