• 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
  1. Home
  2. SaschaSP
  3. Posts
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
S
Offline
  • Profile
  • Following 0
  • Followers 0
  • Topics 0
  • Posts 3
  • Groups 0

Posts

Recent Best Controversial
  • RE: How can I add more time periods for MMM-compliments?

    @DæmonEyes you only make changes in
    MagicMirror/modules/default/compliments/MMM-Compliments.js
    and of corse in the
    MagicMirror/config/config.js?

    Can your Post your changes here in the Forum?
    Here is a nice “HowTo” post a code into the Forum for better reading https://forum.magicmirror.builders/topic/4247/how-to-post-code-on-the-forum-for-absolute-beginners

    Thank you

    posted in Requests
    S
    SaschaSP
    Feb 27, 2019, 7:46 AM
  • RE: .txt file include

    @strawberry-3-141
    Ok, i will try step by step.
    Beginning with my first probleme:
    The Output message (displayed on the mirror) is only displaying one word after the “identifyer-word”

    identifyer "Meldung"
    Stellmotor Antrieb blockiert
    MagicMirror Display only Stellmotor
    Antrieb blockiert is missing

    The identifyer-wordsare Meldung Zone Zeit

    The content from my txt:

    Meldung Stellmotor Antrieb blockiert
    Zone Nebenantrieb
    Zeit 6.Juni 2018 10:40
    +++ENDE DER DATEI+++
    

    My edited sensor.js:

    Module.register("Home-Status",{
    	defaults: {
    		updateInterval: 0.5 * 60 * 1000 //reads the file every 30 seconds
    	},
    
    	start: function(){
    		this.sendSocketNotification("START", this.config);
    	},
    
    	socketNotificationReceived: function(notification, payload) {
    		if(notification === "DATA"){
    			this.dataFile = payload;
    			this.updateDom();
    		}
    	},
    
    	getDom: function(){
    		var wrapper = document.createElement("div");
    		if(this.dataFile){
                            var meldungRegExp = /Meldung (.*?) /ig;
                            var meldung = meldungRegExp.exec(this.dataFile)[1];
    
    
                            var zoneRegExp = /Zone (.*?) /ig;
                            var zone = zoneRegExp.exec(this.dataFile)[1];
    
    			var zeitRegExp = /Zeit (.*?) /ig;
    			var zeit = zeitRegExp.exec(this.dataFile)[1];
    			wrapper.innerHTML = "Meldung: " + meldung + " Zone: " + zone + " Zeit: " + zeit;
    		} else {
    			wrapper.innerHTML = "No Data";
    		}
    		return wrapper;
    	}
    });
    
    

    Result wich is displayed at MagicMirror:

    Meldung:Stellmotor Zone:Nebenantrieb Zeit:6.Juni

    posted in Troubleshooting
    S
    SaschaSP
    Jun 13, 2018, 9:42 AM
  • RE: .txt file include

    @strawberry-3-141 great solution from you.
    I want to use your solution not for showing Temperatur/ Humidity rather for showing alerts from sensors.

    The content from my txt is for example:

    Meldung Stellmotor Antrieb blockiert
    Zone Nebenantrieb
    Zeit 6.Juni 2018 10:40
    +++ENDE DER DATEI+++
    

    I change the sensor.js:

    Module.register("Home-Status",{
    	defaults: {
    		updateInterval: 0.5 * 60 * 1000 //reads the file every 30 seconds
    	},
    
    	start: function(){
    		this.sendSocketNotification("START", this.config);
    	},
    
    	socketNotificationReceived: function(notification, payload) {
    		if(notification === "DATA"){
    			this.dataFile = payload;
    			this.updateDom();
    		}
    	},
    
    	getDom: function(){
    		var wrapper = document.createElement("div");
    		if(this.dataFile){
                            var meldungRegExp = /Meldung = (.*?) /ig;
                            var meldung = meldungRegExp.exec(this.dataFile)[1];
    
                            var zoneRegExp = /Zone = (.*?) /ig;
                            var zone = zoneRegExp.exec(this.dataFile)[1];
    
    			var zeitRegExp = /Zeit = (.*?) /ig;
    			var zeit = zeitRegExp.exec(this.dataFile)[1];
    			wrapper.innerHTML = "Meldung: " + meldung + " , Zone: " + zone + " , "Zeit: " + zeit" ;
    		} else {
    			wrapper.innerHTML = "No Data";
    		}
    		return wrapper;
    	}
    });
    

    but it dosn´t work.
    Firtst problem: my txt have no seperators like = or :
    second probleme: my alert text (Meldung) contains of several words
    third Problem: only the newest txt should be displayed. The Names from the txt files are for example 20180112090125.txt or 20185912085949.txt etc. It´s not possible to edit the incoming txt names. Best way is to automaticly delete the previous txt

    I hope you can help me to Display " Meldung, Zone, Zeit" on my MagicMirror

    Best regards

    Sascha

    posted in Troubleshooting
    S
    SaschaSP
    Jun 12, 2018, 10:09 AM
  • 1 / 1
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