MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. rts58
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    R
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 56
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: Best way to display recipe

      @mykle1 Great, thanks, I’ll take a look at the voice modules and see what I can come up with. I also just found MMM-ImageFileWatcher which looks like it may do a lot of what I was looking for.

      posted in Development
      R
      rts58
    • RE: Best way to display recipe

      @justjim1220 thank you, I just looked at it again. I thought it was pulling a daily menu from somewhere, not a way of displaying a specific recipe. Where do the recipes come from?

      posted in Development
      R
      rts58
    • Best way to display recipe

      Hi, my MM is actually a kitchen display. Currently it is showing calendar, weather, news, nests, and background images. I’m looking for the best way to shutdown current modules and display a recipe full screen. My first thought was to send the web page link via MagicRemote and use pages to switch to a page that would only show the page in an iframe. However, it looks like most pages don’t like to be displayed in iframe. Second thought was to save page as an image, and have MM look for a file in remote location and if it finds it, close other modules and display the image. Has anyone done something like this already, or have a suggestion for a better approach?

      Thanks!

      posted in Development
      R
      rts58
    • RE: Module help for variable

      @sdetweil Thanks, I got it. I needed to get rid of “this”. So the correct test was:

      if (!(oldAwayState === awayState) && (awayState === 'home')) 
      
      posted in Troubleshooting
      R
      rts58
    • RE: Module help for variable

      @sdetweil thanks, I’ll give that a try. I’ve been writing the variables to the consol log but it’s not quite as helpful.

      posted in Troubleshooting
      R
      rts58
    • RE: Module help for variable

      Is there something wrong with this:

      if (!(this.oldAwayState === awayState) && (this.awayState === 'home')) 
      

      maybe they are both not strings or something?

      posted in Troubleshooting
      R
      rts58
    • RE: Module help for variable

      That’s what I thought. But it still fires off every two minutes, there must be an error in the logic.

      posted in Troubleshooting
      R
      rts58
    • RE: Module help for variable

      Thank you @sdetweil ! So that helps me to create the module level variable. Sorry for dumb question, but how to I read/write it from within my process data function? I thought using this.oldAwayState would be the module level.

      posted in Troubleshooting
      R
      rts58
    • Module help for variable

      Hi,
      I’ve created a small module to turn my monitor off when my nest realizes I’ve left the house. This uses a notification from mmm-nest-status. Since I’m a noob I don’t understand how to keep track of a variable between notifications. I’m guessing I need something in start: ? Here is the code:

      Module.register("controlMonitor", {
      	defaults: {},
      	notificationReceived: function(notification, payload, sender) {
      		if (notification === 'MMM_NEST_STATUS_UPDATE') {
                  this.processData(payload);
      		}
      	},
      	processData: function(data) {
      		var awayState = 'unknown'; // 'home', 'away'
      		// check for away state
      		if (data.devices && data.structures) {
      			var sId = Object.keys(data.structures)[0];
      			var sObj = data.structures[sId];
      			awayState = sObj.away;
      		}
      		var oldAwayState = this.awayState;
      		this.awayState = awayState;
      		// if state has changed and new is away then shut monitor off
      		if (!(this.oldAwayState === awayState) && (this.awayState === 'away')) {
      			//this.sendNotification("REMOTE_ACTION", {action: 'MONITOROFF'});
      				console.log(this.name + "awayState " + awayState + "oldAwayState " + oldAwayState + " " + this.datetime4log());
      		}
      		// if state has changed and new is home then turn monitor on
      		if (!(this.oldAwayState === awayState) && (this.awayState === 'home')) {
      			//this.sendNotification("REMOTE_ACTION", {action: 'MONITORON'});
      				console.log(this.name + "awayState " + awayState + "oldAwayState " + oldAwayState + " " + this.datetime4log());
      		}
      	},
      	datetime4log: function() {
      		var d = new Date();
      		return (d.getMonth()+1) + "/" + d.getDate() + "/" + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
      		}
      });
      
      

      What’s happing now is the home state is firing off every 2 minutes for every notification. I need a module level oldAwayState variable, so the when I get the update I can test against it to only fire off an update if there is a change.

      Thanks

      posted in Troubleshooting
      R
      rts58
    • RE: module for mm background

      @surger13, I did it similar in way as @sdetweil but with extra steps:frowning_face: . I set up a new directory hpmv in the module folder with a symbolic link to the mounted directory in my case ~/Pictures/hpmv. Which required changing the imagePaths setting in config. I had challenges with getting the link to automount after rebooting. I finally got it to work without errors with this entry in /etc/fstab:
      //my.Nas.Ip.Addr/Photos /home/pi/Pictures/hpmv cifs guest,x-systemd.automount,vers=1.0 0 0 and by also using raspi-config setting to wait for network on boot.
      ​

      posted in Requests
      R
      rts58
    • 1 / 1