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

Help, I need to send data to the module I am trying to create

Scheduled Pinned Locked Moved Development
2 Posts 4 Posters 511 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.
  • K Offline
    kylelamb1324
    last edited by Apr 14, 2022, 6:21 PM

    I am new to javascript so this project that I am working on is proving more difficult than anticipated.

    I am creating a module to monitor our schools bus routes and display them onto the screen. I have the webscraping working fine in a javascript file that returns a 2x2 array of bus times for each route and stop. but need to implement it into the magic mirror.

    to my understanding in order to do this I need a node_helper.js file to scrape the data and send it using sendSocketNotification. Is this right? Im not sure how this function works, if anyone has some insight it would be greatly appreciated
    code_text

    S 1 Reply Last reply Apr 14, 2022, 6:28 PM Reply Quote 0
    • S Offline
      sdetweil @kylelamb1324
      last edited by sdetweil Apr 14, 2022, 6:31 PM Apr 14, 2022, 6:28 PM

      @kylelamb1324 see my sample module
      it’s node helper receives a message and sends one back
      https://github.com/sdetweil/SampleModule

      its
      string identifying the message
      and some buffer of data,
      completely up to you, string, number, structure…

      then on the receiving side u get the identifier, so you can tell different messages apart
      and a pointer to the buffer sent by the sender

      socket notifications are private to your module

      an example use

      the node_helper does not get any of the info from config.js like the modulename.js does

      so, typically the first thing would be to send the this.config buffer to the node_helper

      Sam

      How to add modules

      learning how to use browser developers window for css changes

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