• 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.

Module help for variable

Scheduled Pinned Locked Moved Solved Troubleshooting
10 Posts 2 Posters 2.0k 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 Feb 5, 2019, 6:04 PM

    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 Feb 5, 2019, 6:19 PM Reply Quote 0
    • S Offline
      sdetweil @rts58
      last edited by Feb 5, 2019, 6:19 PM

      @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 Feb 5, 2019, 6:47 PM

        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 Feb 5, 2019, 6:59 PM

          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 Feb 5, 2019, 9:34 PM Reply Quote 0
          • S Offline
            sdetweil @rts58
            last edited by Feb 5, 2019, 9:34 PM

            @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 Feb 5, 2019, 10:16 PM Reply Quote 1
            • R Offline
              rts58 @sdetweil
              last edited by Feb 5, 2019, 10:16 PM

              @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 Feb 5, 2019, 10:24 PM Reply Quote 0
              • S Offline
                sdetweil @rts58
                last edited by Feb 5, 2019, 10:24 PM

                @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 Feb 6, 2019, 12:05 AM

                  @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
                  1 / 1
                  • First post
                    7/10
                    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