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

Electricity Bill Module Development

Scheduled Pinned Locked Moved Utilities
19 Posts 3 Posters 3.6k Views 3 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
    SopaMaruchan @sdetweil
    last edited by Jul 18, 2022, 5:55 PM

    @sdetweil I named my retreived data as “foo” and then used sendSocketNotification as you previously told me but I got this as output:
    e9ba4fa8-aca0-4167-b503-ec9c105d2bb4-image.png
    I did it this way on my node_helper file (Highlighted the lines I added):
    c59c8d5a-fce8-46b6-8305-9454cad39dbf-image.png
    Did I missed anything?

    S 2 Replies Last reply Jul 18, 2022, 6:10 PM Reply Quote 0
    • S Online
      sdetweil @SopaMaruchan
      last edited by Jul 18, 2022, 6:10 PM

      @SopaMaruchan ah, so much fun!

      you are inside the callback of the request,so ‘this’ I pointing to some request object and not the node_helper instance…

      sooooo

      before request(…

      add
      let self = this

      and change this. to self.

      object oriented programming is tricky

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • S Online
        sdetweil @SopaMaruchan
        last edited by Jul 18, 2022, 6:12 PM

        @SopaMaruchan and {foo} is unnecessary

        you could just use
        res.body

        it’s the same stuff, why waste memory w a new pointer only being used once

        (same w info there too)

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        S 1 Reply Last reply Jul 18, 2022, 6:31 PM Reply Quote 0
        • S Offline
          SopaMaruchan @sdetweil
          last edited by Jul 18, 2022, 6:31 PM

          @sdetweil Hahahaha true that!
          Kinda fixed it guided by your recommendations but the thing is that I’m still getting the same output: 098fca99-2a82-4ccd-8758-b81dcaedc3b6-image.png
          Here the code:
          80366fb7-a775-46ea-a207-88b196b918cd-image.png

          S 1 Reply Last reply Jul 18, 2022, 6:49 PM Reply Quote 0
          • S Online
            sdetweil @SopaMaruchan
            last edited by Jul 18, 2022, 6:49 PM

            @SopaMaruchan hm…

            sample from one of my modules

            self.sendSocketNotification("SLEEP_HIDE")
            

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            S 1 Reply Last reply Jul 18, 2022, 7:19 PM Reply Quote 0
            • S Offline
              SopaMaruchan @sdetweil
              last edited by Jul 18, 2022, 7:19 PM

              hmm, actually it does help. I’ll be testing around and tell you when I get it to work!
              Anyways your help was a huge pilar to keep myself going with this, much thanks brother💝

              S 1 Reply Last reply Jul 18, 2022, 7:29 PM Reply Quote 0
              • S Offline
                SopaMaruchan @SopaMaruchan
                last edited by Jul 18, 2022, 7:29 PM

                Does it help if I tell you that I got everything on my onstart function of the node_helper file?

                S S 2 Replies Last reply Jul 18, 2022, 7:36 PM Reply Quote 0
                • S Online
                  sdetweil @SopaMaruchan
                  last edited by Jul 18, 2022, 7:36 PM

                  @SopaMaruchan never done it in start.

                  I usually wait til the module sends it’s 1st request

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    SopaMaruchan @SopaMaruchan
                    last edited by Jul 18, 2022, 7:53 PM

                    @SopaMaruchan I’m realizing that my my receiveSocketNotification is not being triggered on my MM-Module file:
                    f111ce89-0276-4196-a41b-2ad73b016eaa-image.png
                    I logged some text after calling receiveSocketNotification function but there’s no output on console.

                    node_helper:
                    74f933d7-53b1-483c-b0a3-0abfe6827b34-image.png

                    S M 4 Replies Last reply Jul 18, 2022, 9:10 PM Reply Quote 0
                    • S Online
                      sdetweil @SopaMaruchan
                      last edited by Jul 18, 2022, 9:10 PM

                      @SopaMaruchan if the send fails like that, not sent

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

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