lavolp3 / MMM-AVStock

MagicMirror module for displaying stock price with yfinance API
MIT License
39 stars 18 forks source link

MMM-AVStocks disappears as a function of another module #7

Closed Kugelfang666 closed 5 years ago

Kugelfang666 commented 5 years ago

Dear all,

I currently use two modules in my setup which for some unknown reason are cross-interacting in a unwanted way:

My config.js looks like this:

        {
            module: 'MMM-PIR',
            position: 'bottom_center',
            config: {
                sensorPin: 4,
                delay: 30000,
                turnOffDisplay: true,
                showCountdown: true,
                callbackScripts: ["callback.py"]
            }
        },

        {
          module: "MMM-AVStock",
          header: "Stocks",
          position: "top_right", //"bottom_bar" is better for `mode:ticker`
          config: {
            apiKey : "XXXXXXXXXX", // https://www.alphavantage.co/
            timeFormat: "DD-MM-YYYY HH:mm:ss",
            symbols : ["aapl", "GOOGL", "AMZN"],
            alias: ["Apple", "Google", "Amazon"], 
            tickerDuration: 60, 
            chartDays: 90,
            poolInterval : 1000*15, 
            mode : "table", // "table", "ticker", "series"
            decimals: 2, 
            candleSticks : false, 
            coloredCandles : false, 
            premiumAccount: false, 
          }
        },

Now comes the peculiar thing: if I set

showCountdown: false,

in MMM-PIR the on screen countdown of this module disappears as intended but so does also the list of the AVStock. In fact the header of AVStocks is still there but the actual list does not appear. Also if I change the

mode : "table", // "table", "ticker", "series"

nothing happens. This behavior is fully reversible and reproducible. It would be great if someone could help me out on this.

eouia commented 5 years ago

I'm not using PIR sensor, so I cannot test by myself. When you set as showCountdown:true, Everything is OK? only when showCountdown:false it happens? Very weird thing. I'm looking inside MMM-PIR, but nothing suspicious points be found. Maybe real test with PIR sensor be needed, but I haven't. Maybe @mboskamp can help us with real device test.

Kugelfang666 commented 5 years ago

Thanks for looking into this,

Excacly, with the Setting on „true“ everything is fine

Kugelfang666 commented 5 years ago

BTW the error is even reproducible without an actual sensor attached to the pi. So in case you want to try it out just install the MMM-PIR without any change to the hardware

eouia commented 5 years ago

https://www.dropbox.com/s/v7czoe4jhxo4ew6/%EC%8A%A4%ED%81%AC%EB%A6%B0%EC%83%B7%202019-04-06%2011.52.19.png?dl=0

Well, I'd installed MMM-PIR and use default configuration (like with yours) But In my devices(RPI3B+, Asus TinkerBoard S, OSX), nothing seems wrong. very weird issue. Of course, MMM-PIR will make an error when countdown be zeor because of no real PIR GPIO, but I think it is not related with this issue.

Kugelfang666 commented 5 years ago

hold on, there might be a misunderstanding:

the apps can coexists but if you set showCountdown: false, in MMM-PIR and the actual list with stocks in MMM-AVStocks disappears

eouia commented 5 years ago

Sorry, for misunderstood. I can represent your issue at this moment. I'll look inside more.

eouia commented 5 years ago

Ok. Now I found what's wrong. getDom() of MMM-PIR's will return null on showCountdown:false. The return value from getDom shouldn't be null. (at least it should be empty DOM) but it return null. It is the bug to prevent other modules working condition on DOM_OBJECTS_CREATED The better way to solve this issue is that @mboskamp fix getDom to return empty DOM when showCountdown is false. Fortunately(?) You can simply remove position from configuration of MMM-PIR.

Kugelfang666 commented 5 years ago

oh really! excellent removing the portion worked :D thanks a lot!

mboskamp commented 5 years ago

Hi @Kugelfang666, @eouia thanks for working this out. I dont have an operational mirror at hand right now so I cant test anything. But returning an empty DOM object instead of null makes total sense to me. Feel free to raise a pull request. Otherwise I will make the changes when I find the time for it. Cheers