@sdetweil I totally get the difficulty in supporting people. I have been picking njk apart by examples already in the njk templates that I’ve found.
Read the statement by Michael Teeuw here.
Posts
-
RE: safer weather template by adding a remote config variable
-
RE: Three module issues from a new user
it would have been nice if the fontawesome 4 prefixes weren’t hardcoded into the module sources/templates. Would have made changing the icons to something else in so much easier.
-
RE: safer weather template by adding a remote config variable
@sdetweil true, and it also allows for a remote file, an extra config file if you will. I think the weather should do the same for it’s templates.
-
RE: Making a dashboard for a company
@MagicBeginner Quite a few of the third party modules actually access a python script to do some processing. The gestures and sensor modules are great examples of that. If you need to use python in combination with the mm.
-
safer weather template by adding a remote config variable
The compliments module is great. I love the remoteFile config variable so that I can add my own custom list of special date messages and other things. The beauty is that a custom file of compliments doesn’t get erased upon updating the mm and is easy to copy to another mirror instance. It is also easy to find to add or alter the compliments.
The weather module uses external template files like current.njk and forcast.njk. It is possible to modify them to make the weather appear as we like. But they are at risk of being overwritten by an update to the mirror.
I think that having a weather module config variable for a custom template would make updating less stressful and easier.
To that end I have modified my local weather module instance as follows.
In the weather module weather.js defaults section I added
defaults: { remoteTemplate: "current.njk",
and I altered the getTemplate function to the following:
// Select the template depending on the display type. getTemplate: function () { if (this.config.remoteTemplate !="") {return this.config.remoteTemplate} else { switch (this.config.type.toLowerCase()) { case "current": return "current.njk"; case "hourly": return "hourly.njk"; case "daily": case "forecast": return "forecast.njk"; //Make the invalid values use the "Loading..." from forecast default: return "forecast.njk"; } } },
Thus, if I do not create or set a remote template, the module will not fail, it will get the template it should.
But I want to use a custom template becuase I want control to the css tags used in the html so I can more easily customise the weather. I also wanted a different layout. So made copies of current.njk and forecast.njk and put them in the mm config folder. I also renamed them to be very clear they were my custom template.
Then,
in the weather section of my config.js
I added the relative path to my custom template file.config: { remoteTemplate: "../../../../config/kellyforecast.njk",
I actually have a custom version of current and forecast templates. I can quickly tweak the templates and not get into the folder structure of the mm default modules.
I would like to contribute this to the mm repository.
-
RE: Little magic mirror (but not a mirror)
@SJK this is very cool! This method could be used for an eInk type display. It’s really making me think those old pi zeros could be very useful again.
-
RE: RPi 3B+ with 'Bullseye' can't rotate screen?
@fribse it’s not in the mirror config. you have to change the rasperrypi’s actual configuration
-
RE: Making a dashboard for a company
@MagicBeginner I actually think the mm will work great… provided that you have a way to access the data you want to display.
For example, my company uses SAGE 500 ERP and it does have an api that we can connect to and get info. The downside is that the person handing the SAGE 500 programming must create that api point.
If the company you are working for has that capability, then you can display whatever data they want you too. JSON is pretty easy with the mirror modules. You’ll just have to build a module for it. And there are lots of third party modules that you can dig into for examples of how to do that.
If they don’t already have some kind of ERP or CMS sytem already (which would make the most sense for them to enter and keep a database of historical information in) then you’ll have to build that for them too. Though you probably won’t want to do all this on a raspberry pi, the sd cards can get corrupted and all the data will be gone.
You have some choices to make about it and how serious they are about historical data tracking could impact the cost of the project for them. (reliable server, backups, automated backups, etc)
-
RE: Struggling with Weather... module
@D3dl3g if you get a free api key from openweathermap and then you can test with a known weather api that we all know works. (openweathermap works for me ). then you’ll narrow down the possibilities of why your particular setup isn’t working. 1) if it is the way you have installed the module, or 2) if the problem is with the weather endpoint you are trying to use. 3) maybe the uk weather api isn’t availble to you if you aren’t physically in the uk, 4) something else…
but getting the module working first in a known working configuration… will narrow down a lot of possibilities. it doesn’t mean that you can’t use the api you want later (unless that’s the issue).
-
thinking about an inky touchscreen hat for mirror gestures
I was at microcenter and bought a pimoroni inky touchscreen just to play with.
I’ve been fighting with teh MMM-flick-gesture module trying to add the airwheel gestures and learned I need to learn a lot more…
Since the pisupply Flick would be hanging below the mirror anyway… I’m thinking the inky display might be a better thing to use instead. And… it could display some things when the mirror is blacked out, and when the mirror is displaying, it could show instructions on how to use it to control the mirror pages and module.
I think I might be going down a rabbit hole.
I’m wondering if anyone has setup an inky display magic mirror. Have you?