<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[TypeError: Cannot read property &#x27;getElementsByClassName&#x27; of null]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I’m at my wit’s end!<br />
Based on module “MMM-FHEM by BenRoe” I’ve created a module to receive event changes from the home automation pimatic. The module works fine. Then I started to write a second modul and can’t get rid of the error:<br />
<strong>Cannot read property ‘getElementsByClassName’ of nullt</strong></p>
<p dir="auto">To isolate the problem I reduced the code to the example from the module development page.</p>
<pre><code>Module.register("HelloWorld",{
    // Default module config.
    defaults: {
        text: "Hello World!"
    },
    
    start: function() {
        var self = this;
        setInterval(function() {
            self.updateDom(); // no speed defined, so it updates instantly.
        }, 1000); //perform every 1000 milliseconds.
    },
    // Override dom generator.
    getDom: function() {
        var wrapper = document.createElement("div");
        wrapper.className = 'MyHelloWorld';
        wrapper.innerHTML = this.config.text;
        return wrapper;
    }
});
</code></pre>
<p dir="auto">Following the console log:</p>
<p dir="auto"><img src="https://s28.postimg.org/acmdy48ql/Magic_Mirror_trouble161228.jpg" alt="alt text" class=" img-fluid img-markdown" /></p>
<p dir="auto">What’ s wrong? I need help from an expert!</p>
]]></description><link>https://forum.magicmirror.builders/topic/1280/typeerror-cannot-read-property-getelementsbyclassname-of-null</link><generator>RSS for Node</generator><lastBuildDate>Wed, 17 Jun 2026 04:06:59 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/1280.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 28 Dec 2016 09:05:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TypeError: Cannot read property &#x27;getElementsByClassName&#x27; of null on Wed, 28 Dec 2016 19:52:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michmich" aria-label="Profile: MichMich">@<bdi>MichMich</bdi></a>: Thank’s a lot, I’ve fixed the issue. Result can be reviewed <a href="https://forum.magicmirror.builders/topic/1285/magicmirror-pimatic-home-automation-dashboard">here</a></p>
]]></description><link>https://forum.magicmirror.builders/post/9988</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/9988</guid><dc:creator><![CDATA[Mr.Sponti]]></dc:creator><pubDate>Wed, 28 Dec 2016 19:52:19 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError: Cannot read property &#x27;getElementsByClassName&#x27; of null on Wed, 28 Dec 2016 12:38:52 GMT]]></title><description><![CDATA[<p dir="auto">Try addicting this method to your module:</p>
<pre><code>notificationReceived: function(notification, payload) {
    if (notification === 'DOM_OBJECTS_CREATED') {
        // you can now schedule the dom update method.
    }
}
</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/9956</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/9956</guid><dc:creator><![CDATA[MichMich]]></dc:creator><pubDate>Wed, 28 Dec 2016 12:38:52 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError: Cannot read property &#x27;getElementsByClassName&#x27; of null on Wed, 28 Dec 2016 10:52:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mr.sponti" aria-label="Profile: Mr.Sponti">@<bdi>Mr.Sponti</bdi></a> that happens because you are trying to update the DOM before its even created</p>
]]></description><link>https://forum.magicmirror.builders/post/9953</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/9953</guid><dc:creator><![CDATA[strawberry 3.141]]></dc:creator><pubDate>Wed, 28 Dec 2016 10:52:54 GMT</pubDate></item></channel></rss>