elliefairholm / on-this-day

20 stars 1 forks source link

Infinite loading loop #3

Closed soerenray closed 4 years ago

soerenray commented 4 years ago

Although I configured the main config.js file according to your doc, the MagicMirror is stuck showing the loading sign instead of the "on-this-day-fact". When I looked into the error, it said that "the fact was not callable". Hope to hear from you, maybe there is something wrong with the API? Pretty cool project though, love to see the commitment!

elliefairholm commented 4 years ago

Hi!

Hmm, how odd, other people say that it works for them. I will definitely take a look this weekend :)

Can I ask what you put in the main config.js for my module so that I can replicate it with mine?

On Mon, 4 May 2020 at 21:21, soerenray notifications@github.com wrote:

Although I configured the main config.js file according to your doc, the MagicMirror is stuck showing the loading sign instead of the "on-this-day-fact". When I looked into the error, it said that "the fact was not callable". Hope to hear from you, maybe there is something wrong with the API? Pretty cool project though, love to see the commitment!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/elliefairholm/on-this-day/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMW6AVRFZORPZHX2HTZQL3RP4ITRANCNFSM4MZAQCKA .

soerenray commented 4 years ago

`/ Magic Mirror Config Sample

var config = { address: "localhost", // Address to listen on, can be: // - "localhost", "127.0.0.1", "::1" to listen on loopback interface // - another specific IPv4/6 to listen on a specific interface // - "0.0.0.0", "::" to listen on any interface // Default, when address config is left out or empty, is "localhost" port: 8080, ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses // or add a specific IPv4 of 192.168.1.5 : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],

useHttps: false,        // Support HTTPS or not, default "false" will use HTTP
httpsPrivateKey: "",    // HTTPS private key path, only require when useHttps is true
httpsCertificate: "",   // HTTPS Certificate path, only require when useHttps is true

language: "de",
timeFormat: 24,
units: "metric",
// serverOnly:  true/false/"local" ,
             // local for armv6l processors, default
             //   starts serveronly and then starts chrome browser
             // false, default for all  NON-armv6l devices
             // true, force serveronly mode, because you want to.. no UI on this device

modules: [
    {
        module: "clock",
        position: "top_left"
    },
    {
        module:"currentweather",
        position:"top_left",
        config: {
            useLocationAsHeader: true,
            updateIntervall: 900000,
            showHumidity: true,
            showWindDirection: false,
            degreeLabel: true,
            showHumidity: true,
            useBeaufort: false,
            roundTemp: true,
            showFeelsLike:false,
            decimalSymbol:",",
            location:"XXXX",
            appid:"XXXXXX",
        }
    },
    {
        module:"on-this-day",
        position:"bottom_bar",
        config:{
            interests:"history",
        }
    },
    {
        module:"MMM-KVV",
        position:"top_right",
        config:{
            stopID:"de:8212:3",
        }
    },
    {
        module:"MMM-BurnIn",
        position:"lower_third",
        config:{
            updateInterval: 15,
        }
    },
]

};

/ DO NOT EDIT THE LINE BELOW / if (typeof module !== "undefined") {module.exports = config;} `

soerenray commented 4 years ago

Sorry for the weird formatting, I just copy-pasted it.. I ran npm run config:check in the MagicMirror Folder and it didn't show any syntax errors

soerenray commented 4 years ago

devtools shows error in line 158: "unable to get fact"

elliefairholm commented 4 years ago

Thanks for sending that!

From the top of my head, I think that interests has to be an array rather than a string - so rather than putting:

config { interests: "history" }

if you change it to:

config { interests: ["history"] }

I think that should do the trick. If not, do let me know.

I'll still have a look this weekend and try make things clearer :)

On Tue, 5 May 2020 at 18:21, soerenray notifications@github.com wrote:

`/ Magic Mirror Config Sample

*/

var config = { address: "localhost", // Address to listen on, can be: // - "localhost", "127.0.0.1", "::1" to listen on loopback interface // - another specific IPv4/6 to listen on a specific interface // - "0.0.0.0", "::" to listen on any interface // Default, when address config is left out or empty, is "localhost" port: 8080, ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses // or add a specific IPv4 of 192.168.1.5 : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],

useHttps: false, // Support HTTPS or not, default "false" will use HTTP httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true

language: "de", timeFormat: 24, units: "metric", // serverOnly: true/false/"local" , // local for armv6l processors, default // starts serveronly and then starts chrome browser // false, default for all NON-armv6l devices // true, force serveronly mode, because you want to.. no UI on this device

modules: [ { module: "clock", position: "top_left" }, { module:"currentweather", position:"top_left", config: { useLocationAsHeader: true, updateIntervall: 900000, showHumidity: true, showWindDirection: false, degreeLabel: true, showHumidity: true, useBeaufort: false, roundTemp: true, showFeelsLike:false, decimalSymbol:",", location:"XXXX", appid:"XXXXXX", } }, { module:"on-this-day", position:"bottom_bar", config:{ interests:"history", } }, { module:"MMM-KVV", position:"top_right", config:{ stopID:"de:8212:3", } }, { module:"MMM-BurnIn", position:"lower_third", config:{ updateInterval: 15, } }, ]

};

/ DO NOT EDIT THE LINE BELOW / if (typeof module !== "undefined") {module.exports = config;} `

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/elliefairholm/on-this-day/issues/3#issuecomment-624154760, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMW6AX2G2LP5TDVQ7B672TRQA4HLANCNFSM4MZAQCKA .

soerenray commented 4 years ago

My config file now looks like this, but still shows the same error when running npm start dev...

/ Magic Mirror Config Sample

var config = { address: "localhost", // Address to listen on, can be: // - "localhost", "127.0.0.1", "::1" to listen on loopback interface // - another specific IPv4/6 to listen on a specific interface // - "0.0.0.0", "::" to listen on any interface // Default, when address config is left out or empty, is "localhost" port: 8080, ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses // or add a specific IPv4 of 192.168.1.5 : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],

useHttps: false,        // Support HTTPS or not, default "false" will use HTTP
httpsPrivateKey: "",    // HTTPS private key path, only require when useHttps is true
httpsCertificate: "",   // HTTPS Certificate path, only require when useHttps is true

language: "de",
timeFormat: 24,
units: "metric",
// serverOnly:  true/false/"local" ,
             // local for armv6l processors, default
             //   starts serveronly and then starts chrome browser
             // false, default for all  NON-armv6l devices
             // true, force serveronly mode, because you want to.. no UI on this device

modules: [
    {
        module: "clock",
        position: "top_left"
    },
    {
        module:"currentweather",
        position:"top_left",
        config: {
            useLocationAsHeader: true,
            updateIntervall: 900000,
            showHumidity: true,
            showWindDirection: false,
            degreeLabel: true,
            showHumidity: true,
            useBeaufort: false,
            roundTemp: true,
            showFeelsLike:false,
            decimalSymbol:",",
            location:"Heltersberg",
            appid:"69806cab7c48c4c84c4c54f6c78bcd52",
        }
    },
    {
        module:"on-this-day",
        position:"bottom_bar",
        config:{
            interests:["history"]
        }
    },
    {
        module:"MMM-KVV",
        position:"top_right",
        config:{
            stopID:"de:8212:3",
        }
    },
    {
        module:"MMM-BurnIn",
        position:"lower_third",
        config:{
            updateInterval: 15,
        }
    },
]

};

/ DO NOT EDIT THE LINE BELOW / if (typeof module !== "undefined") {module.exports = config;}

elliefairholm commented 4 years ago

Hello :)

So I figured out what the issue was!

I was using the packing Moment.js as a dependency to format the date, but I didn't realise that depending on your browser and language configuration, moment gives you different date formats. I didn't realise that the German format is 2020.05.11 and not 2020/05/11, and as my code was splitting the time using '/', it could not properly format the date. This then meant that when the API was called, as the date format was wrong, the response was that there was no fact.

I've updated it now though and have tested it with your config file so it should definitely work for you (but in case it doesn't please do let me know!).

Sorry that it didn't work in the first place, and hope you're well :)

Ellie

On Tue, 5 May 2020 at 20:14, soerenray notifications@github.com wrote:

My config file now looks like this, but still shows the same error when running npm start dev...

/ Magic Mirror Config Sample

*/

var config = { address: "localhost", // Address to listen on, can be: // - "localhost", "127.0.0.1", "::1" to listen on loopback interface // - another specific IPv4/6 to listen on a specific interface // - "0.0.0.0", "::" to listen on any interface // Default, when address config is left out or empty, is "localhost" port: 8080, ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses // or add a specific IPv4 of 192.168.1.5 : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],

useHttps: false, // Support HTTPS or not, default "false" will use HTTP httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true

language: "de", timeFormat: 24, units: "metric", // serverOnly: true/false/"local" , // local for armv6l processors, default // starts serveronly and then starts chrome browser // false, default for all NON-armv6l devices // true, force serveronly mode, because you want to.. no UI on this device

modules: [ { module: "clock", position: "top_left" }, { module:"currentweather", position:"top_left", config: { useLocationAsHeader: true, updateIntervall: 900000, showHumidity: true, showWindDirection: false, degreeLabel: true, showHumidity: true, useBeaufort: false, roundTemp: true, showFeelsLike:false, decimalSymbol:",", location:"Heltersberg", appid:"69806cab7c48c4c84c4c54f6c78bcd52", } }, { module:"on-this-day", position:"bottom_bar", config:{ interests:["history"] } }, { module:"MMM-KVV", position:"top_right", config:{ stopID:"de:8212:3", } }, { module:"MMM-BurnIn", position:"lower_third", config:{ updateInterval: 15, } }, ]

};

/ DO NOT EDIT THE LINE BELOW / if (typeof module !== "undefined") {module.exports = config;}

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/elliefairholm/on-this-day/issues/3#issuecomment-624221333, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMW6ARSRMLLJXUSPNYJKU3RQBJQRANCNFSM4MZAQCKA .

soerenray commented 4 years ago

Hi, it works perfectly! Thanks for the heads up and for the work you put in :)

Soeren

soerenray commented 4 years ago

Hi Ellie, I cloned the repository in another folder on my Raspberry Pi and it, surprisingly, threw the same error. As a result, I (a JS newbie) tried changing the code so it works regardless of your location(in other words: I wouldn't encounter my issue I encountered earlier).. I'll attach it in the next comment, maybe it helps prevent future comlications.

Hope you're well, Soeren

soerenray commented 4 years ago

on-this-day.txt

elliefairholm commented 4 years ago

Hello!

Sorry it's taken me so long to reply.

Thank you so much for sending me your code, I really appreciate it. It was great - I made a few adjustments and uploaded the changes. You're right, it was much easier to do it that way.

Thanks again for the email, and hope all is well with you :)

Ellie

On Fri, 29 May 2020 at 21:07, soerenray notifications@github.com wrote:

Hi Ellie, I cloned the repository in another folder on my Raspberry Pi and it, surprisingly, threw the same error. As a result, I (a JS newbie) tried changing the code so it works regardless of your location(in other words: I wouldn't encounter my issue I encountered earlier).. I'll attach it in the next comment, maybe it helps prevent future comlications.

Hope you're well, Soeren

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/elliefairholm/on-this-day/issues/3#issuecomment-636137987, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMW6ASUZYJBJZYYCCHLHSTRUABVPANCNFSM4MZAQCKA .