A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
  • 0 Votes
    5 Posts
    5k Views
    I
    @Squawk09 - it is not a requirement to log when receiving notifications, but it can be useful when debugging. To prove you are receiving the notification, change the line to Log.log('The current temperature is ' + this.temp); and look in the browsers console and you should see the temperature displayed when it is sent from the current weather module. Once you have confirmed that your module is receiving the notifications, you can then move on to displaying the temperature. The trick is to understand the sequence of events that occur and how they affect your module. In your case the functions in your modules are currently fired in the following order: start notificationReceived (ALL_MODULES_STARTED) getDom notificationReceived (DOM_OBJECTS_CREATED) notificationReceived (Temperature) The result is that your getDom function is called before the Temperature notification is received, so this.temp hasn’t been set yet. Since you cannot control the order in which the modules are loaded, or when the Temperature notification is sent by the current weather module, you need to tell your module to call the getDom function again, after the Temperature notification has been received. To do this, change your notificationReceived function to notificationReceived: function(notification, payload, sender) { if (notification === 'Temperature' && sender.name === 'currentweather') { var currentweather = payload; if ( currentweather && currentweather.hasOwnProperty('temperature') ) { this.temp = currentweather.temperature; this.updateDom(); Log.log('The current temperature is ' + this.temp); } } }, Check out the wiki for documentation, and of course keep asking questions here in these forums :)
  • My Setup (or: How crazy I am)

    6
    0 Votes
    6 Posts
    5k Views
    bheplerB
    I just wanted to chime in and say this post also helped me get started. Thank you for the general setup points. The last issue I had was that when the mirror was doing its thing and displaying content to the monitor, I couldn’t use a browser from my development machine to see the output. And SSH into the Pi wasn’t allowing me to start the mirror service. The browser and Pi just weren’t communicating. My solution was to run node serveronly. This allows me to hit the mirror’s ip address and for my browser to render the mirror content. A quick reboot of the mirror will pop it back into display mode.
  • Module will not render

    black screen
    2
    1 Votes
    2 Posts
    2k Views
    MichMichM
    If you wan’t to perform a updateDom a.s.a.p, you could use the DOM_OBJECTS_CREATED notification: notificationReceived: function(notification, payload, sender) { if (notification === 'DOM_OBJECTS_CREATED') { this.updateDom(); } } BUT … keep in mind, the updateDom() method will be called during the dom creation. So it doesn’t make any sense to do so …
  • Added getHeader function

    1
    3 Votes
    1 Posts
    1k Views
    MichMichM
    Per request, I’ve added a getHeader() method to the module api. This allows you to modify the header of the module from within the module itself. Note: that this method will only be called if the user has set a default header. If not no header will be shown and you won’t be able to update it. Note: if you module’s users run an old version of MagicMirror (a version without this change), this method will not be called. No errors should be thrown. So it’s safe to use … If you want to use the user’s set header in this method, just reference the this.data.header variable. Example code: getHeader: function() { return this.data.header + ' append string'; } More info: Documentation: https://github.com/MichMich/MagicMirror/tree/develop/modules#getheader Commit: https://github.com/MichMich/MagicMirror/commit/b2a7d3584bad2752d59d2325c581f5018e875306 Please let me know if this feature works for you …
  • Home Energy Usage on my Mirror?

    3
    0 Votes
    3 Posts
    3k Views
    yawnsY
    In addition to strawberry it looks like it is rather complicated getting access to the SiteSage API. Looking at various threads on the SiteSage support portal it requires approval from the sales guys and maybe a technical approval from your campus it department.
  • Unable to sendSocketNotification from node_helper to Module

    5
    0 Votes
    5 Posts
    4k Views
    J
    Wow that is not obvious or documented. However, that worked :) Thanks heaps!
  • Transit Departure module. How to get started?

    4
    0 Votes
    4 Posts
    3k Views
    A
    Hi, I’m currently working on a similar module for public transport in Oslo. What is the preferred way of development environment? It seems time consuming having to stop en start the magic mirror app each time. Any shortcuts?
  • setTimeout called only once in node_helper.js

    3
    0 Votes
    3 Posts
    2k Views
    strawberry 3.141S
    @bobbob601 a timeout is only fired once, what you want is an interval so replace setTimeout with setInterval
  • This topic is deleted!

    10
    0 Votes
    10 Posts
    172 Views
  • This might be a daft question, but...

    27
    0 Votes
    27 Posts
    21k Views
    strawberry 3.141S
    @Mitchfarino feel free to contact me via personal message
  • How to use Font Awesome?

    2
    1 Votes
    2 Posts
    3k Views
    P
    Hello, i want make a own module. Sadly i don’t know how add Font Awesome to project. getStyles: function() { return ["font-awesome.css"]; }, and what next? e.g. <i class="fa fa-cog"></i>
  • Parse HTML String

    7
    0 Votes
    7 Posts
    6k Views
    A
    @strawberry-3-141 You are absolutly right, I made a bad example. The real html code is a little bit more complicated, so I mixed the real code with this example. @ianperrin My input html is more complicated, but thanks for your answer, good to know! @Plati It helped me a lot to look at other modules. You should use a node_helper.js, there you can create a function which gets the html code of the website. //function which gets the data from the given URL getTheData: function(theURLtoCatch) { var options = {url: theURLtoCatch}; request(options, (error, response, body) => { if (response.statusCode === 200) { this.sendSocketNotification("DATA", this.parseHTML(body)); } else { console.log("Error getting Data " + response.statusCode); this.sendSocketNotification("ERROR", response.statusCode); } }); }, parseHTML: function(dataBody) { //use something like ianperrin and strawberry showed in his example }
  • Need some advise. Digital Ocean Modules

    19
    0 Votes
    19 Posts
    12k Views
    andrewchumchalA
    Thanks you so much @strawberry-3-141.
  • How to make sure dependencies get installed?

    3
    0 Votes
    3 Posts
    3k Views
    andrewchumchalA
    @strawberry-3.141 said in Hey Guys.: create a package.json file with npm init fill out the fields, after that type npm install --save Thanks for the quick reply.
  • Schedule a function in a module.

    3
    0 Votes
    3 Posts
    2k Views
    V
    @yo-less I solved in a different way that it was planned before, but just for the fill the lack of knowledge, can you share your solution? tks!
  • Handle dependencies

    4
    0 Votes
    4 Posts
    3k Views
    strawberry 3.141S
    @alexyak e.g. [ card : alexyak/motiondetector ] without spaces
  • How to receive push notifications from another server?

    6
    0 Votes
    6 Posts
    5k Views
    paphkoP
    @strawberry-3.141 Awesome, thank you! That’s exactly what I was looking for :-)
  • Sound cards of different Pi models

    microphone sound card
    2
    0 Votes
    2 Posts
    2k Views
    J
    @strawberry-3.141 said in Sound cards of different Pi models: To optimise one of my modules, I would like to ask you guys to type cat /proc/asound/cards in your console and provide the output together with your raspberry pi module and what kind of microphone you’re using Raspberry Pi 3 / USB Microphone No modules running now, Jbl Go with Bluetooth on a pi3. 0 [ALSA ]: bcm2835 - bcm2835 ALSA bcm2835 ALSA
  • Get user input

    3
    0 Votes
    3 Posts
    2k Views
    V
    Great it worked!!! My mistake was that I was creating the app after a notification and not at the start of my module! Thanks a lot!
  • py/php question

    1
    0 Votes
    1 Posts
    1k Views
    cowboysdudeC
    Quick question… The module I’m trying to create [that I already have in php] … I know I can call it from a py script just have NO clue about py so any help here would be great!! Thank you!