• 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. MisterT
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
M
Offline
  • Profile
  • Following 0
  • Followers 0
  • Topics 11
  • Posts 56
  • Groups 0

MisterT

@MisterT

5
Reputation
440
Profile views
56
Posts
0
Followers
0
Following
Joined Apr 23, 2019, 5:21 PM
Last Online Mar 21, 2024, 5:12 PM

MisterT Unfollow Follow

Best posts made by MisterT

  • RE: Rotate screen problem when MM starts

    @sdetweil thx for your fast answer
    release is

    No LSB modules are available.
    Distributor ID: Raspbian
    Description: Raspbian GNU/Linux 11 (bullseye)
    Release: 11
    Codename: bullseye

    image below is my orientation screen. how i turn the black slash screen ?

    ![alt text]https://ibb.co/bK1s7Gc(image url)

    posted in Troubleshooting
    M
    MisterT
    Jan 4, 2023, 7:38 PM
  • RE: MMM-Strava

    hI @ianperrin
    It Works !!!
    Nice explanations.
    My mistake is when i launched a webpage to write the url i stoped the MM by Ctrl+Q. Now with MM start and a webpage opened. Everything is alright

    Thanks for your help

    posted in Health
    M
    MisterT
    Nov 8, 2019, 11:25 AM
  • RE: MMM-Domiticz

    @art212 Domoticz and Magic mirror are separate. In the config.js, just complete the Ip adress of Domoticz Device and Domoticz user and password if need. In my case, Domoticz is on a raspberry and my magic mirror on a other one

    posted in Utilities
    M
    MisterT
    Nov 18, 2020, 9:35 PM
  • RE: MMM-Domoticz Cannot read property '0' of undefined

    Hi, I come back again because @sdetweil send me a MMM-Domoticz module. This module works with user and password of domoticz. So if you want see your domoticz devices on your MM you can use this code below.
    Just copy it on text editor and save it as domoticz.js in your MM module folder and in a domoticz folder

    /* global Module */
    
    /* Magic Mirror
     * Module: Domoticz
     *
     * By Mathias Arvidsson  & editing by sdetewell
     */
    
    Module.register("domoticz",{
    
    	defaults: {
    		units: 0,
    		updateInterval: 2000,
    		animationSpeed: 1000,
    		timeFormat: "HH:MM:ss",
    		lang: "en",
    
    		initialLoadDelay: 0,
    		retryDelay: 2500,
    
            apiBase: "http://xxx.xxx.x.xx",
    		apiUser: "xxxxx",
    		apiPw: "xxxxxxxxx",
    		sensors: [
    			{
    				idx: "1",
    				symbolon: "fa fa-user",
    				symboloff: "fa fa-user-o",
    				hiddenon: false,
    				hiddenoff: false,
    				customTitle: "",
    			},
    		],
    	},
    	keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
    		// sample data for parse testing
    	foo:'{ "result": [\
       {"Name":"test1", "Data":"foobar1","type":"something1"},\
    	  {"Name":"test2", "Data":"foobar2","type":"something2"},\
    		 {"Name":"test3", "Data":"foobar3","type":"something3"},\
    		  {"Name":"test4", "Data":"foobar4","type":"something4"}\
    ]}',
    
    	firstEvent: false,
    
      Base64_encode : function(input) {
        var output = "";
        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
        var i = 0;
        input = this.Base64_utf8_encode(input);
        while (i < input.length) {
          chr1 = input.charCodeAt(i++);
          chr2 = input.charCodeAt(i++);
          chr3 = input.charCodeAt(i++);
          enc1 = chr1 >> 2;
          enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
          enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
          enc4 = chr3 & 63;
          if (isNaN(chr2)) {
            enc3 = enc4 = 64;
          } else if (isNaN(chr3)) {
            enc4 = 64;
          }
          output = output + this.keyStr.charAt(enc1) + this.keyStr.charAt(enc2) + this.keyStr.charAt(enc3) + this.keyStr.charAt(enc4);
        }
        return output;
      },
    
      Base64_decode : function(input) {
        var output = "";
        var chr1, chr2, chr3;
        var enc1, enc2, enc3, enc4;
        var i = 0;
        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
        while (i < input.length) {
          enc1 = this.keyStr.indexOf(input.charAt(i++));
          enc2 = this.keyStr.indexOf(input.charAt(i++));
          enc3 = this.keyStr.indexOf(input.charAt(i++));
          enc4 = this.keyStr.indexOf(input.charAt(i++));
          chr1 = (enc1 << 2) | (enc2 >> 4);
          chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
          chr3 = ((enc3 & 3) << 6) | enc4;
          output = output + String.fromCharCode(chr1);
          if (enc3 != 64) {
            output = output + String.fromCharCode(chr2);
          }
          if (enc4 != 64) {
            output = output + String.fromCharCode(chr3);
          }
        }
        output = this.Base64_utf8_decode(output);
        return output;
      },
    
      Base64_utf8_encode : function(string) {
        string = string.replace(/\r\n/g, "\n");
        var utftext = "";
        for (var n = 0; n < string.length; n++) {
          var c = string.charCodeAt(n);
          if (c < 128) {
            utftext += String.fromCharCode(c);
          } else if ((c > 127) && (c < 2048)) {
            utftext += String.fromCharCode((c >> 6) | 192);
            utftext += String.fromCharCode((c & 63) | 128);
          } else {
            utftext += String.fromCharCode((c >> 12) | 224);
            utftext += String.fromCharCode(((c >> 6) & 63) | 128);
            utftext += String.fromCharCode((c & 63) | 128);
          }
        }
        return utftext;
      },
    
      Base64_utf8_decode : function(utftext) {
        var string = "";
        var i = 0;
        var c = 0,
          c1 = 0,
          c2 = 0,
          c3 = 0;
        while (i < utftext.length) {
          c = utftext.charCodeAt(i);
          if (c < 128) {
            string += String.fromCharCode(c);
            i++;
          } else if ((c > 191) && (c < 224)) {
            c2 = utftext.charCodeAt(i + 1);
            string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
            i += 2;
          } else {
            c2 = utftext.charCodeAt(i + 1);
            c3 = utftext.charCodeAt(i + 2);
            string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
            i += 3;
          }
        }
        return string;
      },
    
    
    
    	getStyles: function() {
    	    return ['font-awesome.css'];
    	},
    	// Define required scripts.
    	getScripts: function() {
    		return ["moment.js"];
    	},
    
    
    
    	// Define start sequence.
    	start: function() {
    		Log.info("Starting module: " + this.name);
    		// Set locale.
    		moment.locale(config.language);
    
    		this.loaded = false;
    		this.status1 = false;
    		this.title = "Loading...";
    		this.scheduleUpdate(this.config.updateInterval);//this.scheduleUpdate(this.config.initialLoadDelay);
    		this.sensors = [];
    		for (var c in this.config.sensors) {
    			var sensor = this.config.sensors[c];
    			var newSensor = {idx:sensor.idx, symbolon:sensor.symbolon, symboloff:sensor.symboloff, hiddenon:sensor.hiddenon, hiddenoff:sensor.hiddenoff, customTitle:sensor.customTitle, status:"", sname:"",type:""};
    			Log.log(sensor.idx);
    			this.sensors.push(newSensor);
    		}
    Log.log(JSON.stringify(this.sensors));
    	},
    
    
    
    	// Override dom generator.
    	getDom: function() {
    		var wrapper = document.createElement("div");
    
    		if (!this.loaded) {
    			wrapper.innerHTML = "Loading...";
    			wrapper.className = "dimmed light small";
    			return wrapper;
    		}
    		var tableWrap = document.createElement("table");
    		tableWrap.className = "small";
    
    		for (var c in this.sensors) {
    			var sensor = this.sensors[c];
    			if((sensor.status=="On" && sensor.hiddenon)||(sensor.status=="Off" && sensor.hiddenoff)) continue;
    			var sensorWrapper = document.createElement("tr");
    			sensorWrapper.className = "normal";
    
    			var symbolTD = document.createElement('td');
    			symbolTD.className = "symbol";
    			var symbol = document.createElement('i');
    			var symbolClass = sensor.symboloff
    			if(sensor.status=="On") symbolClass = sensor.symbolon
    			symbol.className = symbolClass;
    			symbolTD.appendChild(symbol);
    			sensorWrapper.appendChild(symbolTD);
    
    			var titleTD = document.createElement('td');
    			titleTD.className = "title bright";
    			if(sensor.status=="Off") titleTD.className = "title light";
    			titleTD.innerHTML = sensor.sname;
    			if(typeof sensor.customTitle !== 'undefined') titleTD.innerHTML = sensor.customTitle;
    			sensorWrapper.appendChild(titleTD);
    
    			var statusTD = document.createElement('td');
    			statusTD.className = "time light";
    			statusTD.innerHTML = sensor.status;
    			sensorWrapper.appendChild(statusTD);
    
    			tableWrap.appendChild(sensorWrapper);
    		}
    		wrapper.appendChild(tableWrap);
    		return wrapper;
    	},
    
    
    	updateDomo: function() {
    		var i = 0;
    		var self = this
    		let userid= this.Base64_encode(this.config.apiUser)
    		let password=this.Base64_encode(this.config.apiPw)
    		for (var sensor of this.sensors) {
    			
    			var url =  this.config.apiBase + ":" + this.config.apiPort + "/json.htm?username="+userid + "&password=" +password + "&type=devices&rid="  + sensor.idx;
    			let domoRequest = new XMLHttpRequest();
    			domoRequest.open("GET", url, true);
    			domoRequest.onreadystatechange = function() {
    				if (this.readyState === 4) {
    					// if the api response return code is 200 (ok)
    					if (this.status === 200) {
    						// if there was data returned
    						// example https://github.com/driverdan/node-XMLHttpRequest/blob/master/example/demo.js 
    						// uses this.responseText , not this.response
    						// this.response is an object
    						if(this.responseText && this.responseText.length>0){
    							// process it
    							self.processJson(JSON.parse(this.responseText));							
    							Log.log("Loaded data");
    						}
    						else {
    							 // oops, no data returned
    						   Log.error(self.name + ": no data returned.");
    						}
    					} else {
    						Log.error(self.name + ": Could not load data.");
    						Log.log("Did not load data");
    						// dummy call to verify parse works ok
    						// even where there are no devices
    						self.processJson(JSON.parse(self.foo));
    					}
    				}
    			};			
    			// watch out having multiple requests in progress at the same time. 
    			// onreadystatechange doesn't happen til LONG time after send..
    			// for loop starts another request immediately
    			domoRequest.send();			
    			i++;
    		}
    	},
    
    	processJson: function(data) {		
    		if (!data) {
    			// Did not receive usable new data.
    			// Maybe this needs a better check?
    			return;
    		}
    		Log.log("data="+data);
    		for (var c in this.sensors) {		
    		  // moved log entry here, as c is not set until start of for loop
    			// watch out if data does not contain "result":[] array
    			if( data.result !=='undefined' && typeof data.result ==='object' && data.result.length >0) {
    				Log.log("****Parsing data: " + c + " " + data.result[0].Name);		
    				var sensor = this.sensors[c];
    				if(sensor.idx == data.result[0].idx){
    					this.sensors[c].sname = data.result[0].Name;
    					this.sensors[c].status = data.result[0].Data;
    					this.sensors[c].type = data.result[0].Type;
    				}
    			}
    		}
    		
    		this.loaded = true;
    		this.updateDom(this.config.animationSpeed);
    	},
    
    	scheduleUpdate: function(delay) {
    		Log.log("Updating..");
    		var nextLoad = this.config.updateInterval;
    		if (typeof delay !== "undefined" && delay >= 0) {
    			nextLoad = delay;
    		}
    
    		//var self = this;
    		setInterval(() => {
    			this.updateDomo();
    		}, nextLoad);
    	}
    });
    

    After this in your config.js just add for exemple:

    		{
    			module: 'domoticz',
          			position: 'top_right',
          			header: 'Températures',
          				config: {
                				apiBase: "http://xxx.xxx.x.xx",
                				apiPort: "xx",
    					apiUser: "xxx",
    					apiPw: "xxxxxx",
                			sensors: [
                      			{
    					idx: "183",
    					symbolon: "fa fa-thermometer-half",
    					symboloff: "fa fa-thermometer-half",
    					customTitle: "Cuisine",
    					},
                      			{
    					idx: "5",
    					symbolon: "fa fa-thermometer-half",
    					symboloff: "fa fa-thermometer-half",
    					customTitle: "Raspberry Domotique",
    					},					
    					]
    					}
       		},
    

    And it works
    Thanks @sdetweil for your help

    posted in Troubleshooting
    M
    MisterT
    Jan 7, 2020, 5:18 PM
  • RE: MMM-COVID19-SPARKLINE

    Hi everybody,

    just a question about countries.
    It is possible to add France ? or is too complicated ?

    take care of yourself :winking_face:

    posted in Health
    M
    MisterT
    Apr 11, 2020, 11:21 AM

Latest posts made by MisterT

  • RE: MMM-Strava

    @ianperrin i use Strava module for my mirror but recently Strava update api and now I have the message : 429 limits exceed. I changed reloadinterval to 15601000 and updateinterval to 60*1000 but still the same message.
    Have you an idea ?
    Thx for next answer

    posted in Health
    M
    MisterT
    Mar 20, 2024, 7:51 PM
  • MMM-Soccer & MM-SoccerV2 don't work

    Hi everybody

    I use MMM-Soccer since a long time but the soccer season have begin and nothing on the screen (no results, only the name of the module or name of teams).
    I have no errors in log file (ctrl + maj + i). I changed nothing.
    I tested MMM-Soccer and MMM-soccer V2 and it’s the same thing. No scores are availables
    am i the only guy with these problems ?

    Thanks for next answers

    posted in Troubleshooting
    M
    MisterT
    Aug 17, 2023, 1:51 PM
  • Cors policy Domoticz

    Hi everybody
    I have a problem with the latest version of MM and my Domoticz module.
    I use this Domoticz module (link below) and when i start MM, i have a error message on console like

    Domoticz could not load data
    Access to XMLHttpRequest at… from origine http://0.0.0.0:8080 has been block by CORS policy. the request client is not a secure context and…

    [link text](https://forum.magicmirror.builders/topic/11123/mmm-domoticz-cannot-read-property-0-of-undefined/14?page=2link url)

    I try different things but still not working:

    i try this link but nothing : usecoreproxy
    [link text]https://github.com/MichMich/MagicMirror/issues/2714#issuecomment-1024627426(link url)

    i try this link but nothing: websecurity = false
    [link text]https://forum.magicmirror.builders/topic/16131/mmm-hue-cors-policy-issue/2(link url)

    Can you help me please ?

    posted in Troubleshooting
    M
    MisterT
    Jan 6, 2023, 6:09 PM
  • RE: Rotate screen problem when MM starts

    @sdetweil thx for your support. i found the guilty module after 2 hours. it’s MMM-PIR-Sensor-Lite. There is an hidden rotate parameter and the default parameter is normal rotate. that’s why when MM starts there was a rotate screen on normal position.

    So for people with rotate problem when MM Starts and if you have MMM-PIR-Sensor-Lite, add this parameter in your config.js:

    rotation Direction of content rotation.

    Possible values: ‘normal’, ‘left’, ‘right’ or ‘inverted’
    Default value: ‘normal’

    posted in Troubleshooting
    M
    MisterT
    Jan 5, 2023, 7:29 AM
  • RE: Rotate screen problem when MM starts

    @sdetweil if i turn on left right or inverted, when i start MM screen rotate on normal position

    posted in Troubleshooting
    M
    MisterT
    Jan 4, 2023, 7:52 PM
  • RE: Rotate screen problem when MM starts

    @sdetweil thx for your fast answer
    release is

    No LSB modules are available.
    Distributor ID: Raspbian
    Description: Raspbian GNU/Linux 11 (bullseye)
    Release: 11
    Codename: bullseye

    image below is my orientation screen. how i turn the black slash screen ?

    ![alt text]https://ibb.co/bK1s7Gc(image url)

    posted in Troubleshooting
    M
    MisterT
    Jan 4, 2023, 7:38 PM
  • Rotate screen problem when MM starts

    Hi everybody

    i need help about rotate screen when MM starts. I use a screen on vertical position for my MM.
    When i start my raspberry (pi3 b+ on bulleye and i used @sdetweil link to install MM) the boot logo is on horizontal position and when the graphical interface is shown, it’s on vertical position. (everything is ok, i used preference rotation to rotate the screen on right).
    After that, i start my MM with PM2 and MM starts vertically. But after 2 sec, the screen rotate on horizontal position and when i quit MM with Ctrl + Q, the graphical interface is also on horizontal position.

    Have you an idea ? (CSS on MM is blank)

    thx for next answers

    posted in Troubleshooting
    M
    MisterT
    Jan 4, 2023, 7:06 PM
  • RE: MMM-Fuel

    Hi @strawberry-3-141 i’m french and the data for the price of fuel is “opensource”. That’s why you can obtain informations about fuel, price fuel and type of fuel, fuel location, etc…
    these informations are update every day
    If you follow these links below, you can find exemple to use data :

    https://www.data.economie.gouv.fr/explore/dataset/prix-carburants-fichier-quotidien-test-ods/api/(link url)
    there are different tabs to navigate between graph, informations and locations

    https://www.data.economie.gouv.fr/api/v2/console(link url)
    this is the API (i think) to use data

    I don’t know if it’s possible to integrate french fuel data in your module or it’s too complicated because i’m a noob in programmation/coding.

    Maybe you can check these informations and tell me if possible?

    and sorry for my english :-)

    Thx

    posted in Transport
    M
    MisterT
    Jan 4, 2023, 11:30 AM
  • RE: MMM-Domoticz Cannot read property '0' of undefined

    Hi, everybody
    I used this old thread because i have a other problem with this module. I update my magic mirror to 2.8 and now this module doesn’t work properly. the error is:

    Domoticz.js:260 GET http://1xx.1xx1.3x:xxxx/json.htm?username=RmFiaWVu&password=ZmwwNjA2ODVEb21vdGljeg==&type=devices&rid=334 net::ERR_FAILED
    updateDomo @ domoticz.js:260
    (anonymous) @ domoticz.js:299
    0.0.0.0/:1 Access to XMLHttpRequest at 'http://1xx.1xx1.3x:xxxx/json.htm?username=RmFiaWVu&password=ZmwwNjA2ODVEb21vdGljeg==&type=devices&rid=336' from origin 'http://0.0.0.0:8080' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `private`.
    domoticz.js:249 domoticz: Could not load data.
    domoRequest.onreadystatechange @ domoticz.js:249
    XMLHttpRequest.send (async)
    updateDomo @ domoticz.js:260
    (anonymous) @ domoticz.js:299
    domoticz.js:250 Did not load data
    domoticz.js:271 data=[object Object]
    domoticz.js:276 ****Parsing data: 0 test1
    domoticz.js:276 ****Parsing data: 1 test1
    domoticz.js:276 ****Parsing data: 2 test1
    domoticz.js:276 ****Parsing data: 3 test1
    domoticz.js:276 ****Parsing data: 4 test1
    domoticz.js:276 ****Parsing data: 5 test1
    domoticz.js:276 ****Parsing data: 6 test1
    domoticz.js:260 GET http://1xx.1xx1.3x:xxxx/json.htm?username=RmFiaWVu&password=ZmwwNjA2ODVEb21vdGljeg==&type=devices&rid=336 net::ERR_FAILED
    

    I think the json request doesn’t match with the good domoticz request

    http://1xx.1xx1.3x:xxxx/json.htm?username=RmFiaWVu&password=ZmwwNjA2ODVEb21vdGljeg==&type=devices&rid=336

    ip and port are good but all these after are bad.
    @sdetweil is the most contributor of this code. have you an idea?
    i use the same code that the code is above this post

    thanks for your help

    posted in Troubleshooting
    M
    MisterT
    Feb 21, 2022, 1:50 PM
  • MMM-assistant2display spotify error

    Hi everybody and @bugsounet

    I just updated MMM-google assistant and MMM-assistant2display an now i have an error with spotify. I can’t see on the bottom of my screen the listening music. In console i have these errors:

    spotify.js:1 Uncaught TypeError: Cannot read property 'src' of null
        at Spotify.updateSongInfo (spotify.js:1)
        at Spotify.updateCurrentSpotify (spotify.js:1)
        at Class.socketNotificationReceived (MMM-Assistant2Display.js:1)
        at module.js:250
        at Socket.<anonymous> (socketclient.js:39)
        at Socket../node_modules/component-emitter/index.js.Emitter.emit (index.js:145)
        at Socket.emitEvent (socket.js:253)
        at Socket.onevent (socket.js:240)
        at Socket.MMSocket.self.socket.onevent (socketclient.js:33)
        at Socket.onpacket (socket.js:204)
    updateSongInfo @ spotify.js:1
    updateCurrentSpotify @ spotify.js:1
    socketNotificationReceived @ MMM-Assistant2Display.js:1
    (anonymous) @ module.js:250
    (anonymous) @ socketclient.js:39
    ./node_modules/component-emitter/index.js.Emitter.emit @ index.js:145
    emitEvent @ socket.js:253
    onevent @ socket.js:240
    MMSocket.self.socket.onevent @ socketclient.js:33
    onpacket @ socket.js:204
    (anonymous) @ index.js:21
    ./node_modules/component-emitter/index.js.Emitter.emit @ index.js:145
    ondecoded @ manager.js:207
    (anonymous) @ index.js:21
    ./node_modules/component-emitter/index.js.Emitter.emit @ index.js:145
    add @ index.js:117
    ondata @ manager.js:199
    (anonymous) @ index.js:21
    ./node_modules/component-emitter/index.js.Emitter.emit @ index.js:145
    onPacket @ socket.js:387
    (anonymous) @ socket.js:196
    ./node_modules/component-emitter/index.js.Emitter.emit @ index.js:145
    onPacket @ transport.js:103
    onData @ transport.js:96
    ws.onmessage @ websocket.js:108
    

    My config.js is the same before and after the update. and token on spotify is ok

    Do you have a solution ?

    thx

    posted in Troubleshooting
    M
    MisterT
    Jan 21, 2021, 6:42 PM
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