Ax-LED / MMM-Podcast2

A module to stream 100 Sekunden Tagesschau
MIT License
2 stars 1 forks source link

BUTTON_PRESSED don't work with Page-Selector #3

Closed Robiv8 closed 5 years ago

Robiv8 commented 5 years ago

Only for Info! So I have this Issues submit to the Github Page-Selector Issues.

After numerous tests, I found that the command BUTTON_PRESS does not work when Page-Select is installed.

Here are my config.js `

modules: [ { module: 'MMM-Remote-Control' // uncomment the following line to show the URL of the remote control on the mirror // , position: 'bottom_left' // you can hide this module afterwards from the remote control itself }, { module: 'MMM-Buttons', config: { maxShortPressTime: 400, minLongPressTime: 2000, buttons: [

{ pin: 17, //The pin that connects your first button name: "Hauptseite", //Or whatever you really want longPress: { //longPress or shortPress doesnt matter. Really it's just the stuff on the inside that matters. notification: "PAGE_SELECT", payload: "haupt" //Or whatever page you want }, shortPress: { notification: "PAGE_SELECT", payload: "haupt" //Or whatever page you want } }, { pin: 24, //The pin that connects your first button name: "Podcast", //Or whatever you really want longPress: { //longPress or shortPress doesnt matter. Really it's just the stuff on the inside that matters. notification: "BUTTON_PRESSED", payload: "BUTTON_PRESSED" //Or whatever page you want }, shortPress: { notification: "BUTTON_PRESSED", payload: "BUTTON_PRESSED" //Or whatever page you want }}

]}},

{ module: 'MMM-Page-Selector', position: 'top_bar', config: { defaultPage: "haupt", ///"main", displayTitle: true, //false, selectPageNotif: ["SELECT_PAGE"], incrementPageNotif: ["PAGE_UP"], decrementPageNotif: ["PAGE_DOWN"] } },

{ module: "alert", name: "alert" }, { module: "updatenotification", name: "notification", position: "top_bar" }, { module: "clock", name: "clock", position: "top_left" }, { module: "currentweather", name: "currentweather", position: "top_right", config: { location: "Stuttgart", locationID: "2825297", //ID from http:// appid: "xxxxxxxxxxx" } }, { module: 'MMM-Podcast2', name: "podcast2", config: { feedUrl: 'https://www.tagesschau.de/export/video-podcast/webxl/tagesschau-in-100-sekunden_https/', refreshInterval: 1000 * 1800, //refreshs streaming link every 1800 seconds (30Min) omxargs: ' --win 320,180,1600,900 -o both ' //1600 - 320 = -> 1280 x 720 <- = 900 - 180 } }, { module: "newsfeed", name: "newsfeed", position: "bottom_bar", config: { feeds: [ { title: "StN", url: "http://www.stuttgarter-nachrichten.de/stuttgart.rss.feed" } ], showSourceTitle: true, showPublishDate: true } }, ], pages: { haupt: { "clock": "top_left", "currentweather": "top_right", "podcast2": "middle_center", "newsfeed": "bottom_bar" } }, exclusions: [ "notification", "alert" ] };

`

And with this test config it works! `

modules: [ { module: 'MMM-Remote-Control' // uncomment the following line to show the URL of the remote control on the mirror // , position: 'bottom_left' // you can hide this module afterwards from the remote control itself }, { module: 'MMM-Buttons', config: { maxShortPressTime: 400, minLongPressTime: 2000, buttons: [ { pin: 24, //The pin that connects your first button name: "Podcast", //Or whatever you really want longPress: { //longPress or shortPress doesnt matter. Really it's just the stuff on the inside that matters. notification: "BUTTON_PRESSED", payload: "BUTTON_PRESSED" //Or whatever page you want }, shortPress: { notification: "BUTTON_PRESSED", payload: "BUTTON_PRESSED" //Or whatever page you want } } ] } }, { module: "alert", }, { module: "updatenotification", position: "top_bar" }, { module: "clock", position: "top_left" }, { module: "currentweather", position: "top_right", config: { location: "Stuttgart", locationID: "2825297", //ID from http:// appid: "xxxxxxxx" } }, { module: 'MMM-Podcast2', config: { feedUrl: 'https://www.tagesschau.de/export/video-podcast/webxl/tagesschau-in-100-sekunden_https/', refreshInterval: 1000 * 1800, //refreshs streaming link every 1800 seconds (30Min) omxargs: ' --win 320,180,1600,900 -o both ' //1600 - 320 = -> 1280 x 720 <- = 900 - 180 } }, { module: "newsfeed", position: "bottom_bar", config: { feeds: [ { title: "StN", url: "http://www.stuttgarter-nachrichten.de/stuttgart.rss.feed" } ], showSourceTitle: true, showPublishDate: true } }, ]

};

`

Robiv8 commented 5 years ago

News, By a stupid coincidence, I discovered something. I went to work and took my Raspi to test by the way. Raspi started, desktop stays black! Aaaah! OK No internet. I put F11 so that I come to the desktop, then Turn on the W-LAN because otherwise no Internet possible. Terminal opened and MM restarted. "pm2 restart mm" MM comes. I think I'll push the 2 buttons if the two sides are still changing, and YES it still does. Wy not ;-) Press the 3 button and behold! Podcast starts to run. I'm amazed. But why? What the hell is going on. I think, and do some tests. The following, if I start the computer without Internet, then shrink MM to get to the wi-fi switch ,. Turn on W-Lan and restart MM, the button works and podcast starts. But if I restart MM now it does not work anymore. So i must Start without Internet connection then restart MM and its Going. Very Strange!

Now I'm not sure why that is? MMM-buttons MMM-page selector, MMM-Podcast2 or on the MagicMirror itself

The log without Internet MMM-Podcast2 Error : Error: EAI_AGAIN in https://www.tagesschau.de/export/video-podcastwebxl/tagesschau-in-100-sekunden-https/

Robiv8 commented 5 years ago

Here some errors for analyzing:

MMM-Podcast2.js:72 Uncaught ReferenceError: streamurl is not defined
    at Class.notificationReceived (MMM-Podcast2.js:72)
    at sendNotification (main.js:95)
    at Object.sendNotification (main.js:498)
    at Class.sendNotification (module.js:368)
    at Class.sendAction (MMM-Buttons.js:88)
    at Class.buttonUp (MMM-Buttons.js:77)
    at Class.socketNotificationReceived (MMM-Buttons.js:120)
    at module.js:246
    at r.<anonymous> (socketclient.js:25)
    at r.emit (index.js:83)
Ax-LED commented 5 years ago

@Robiv8

see english text below

Es sieht so aus, als ob dein Raspberry zuerst die Internetverbindung verliert oder garnicht erst hat, danach kommt der Fehler in MMM-Podcast2. Ich könnte den Fehler mit der fehlenden Verbindung im Javascript abfangen, dann würde der Stream der Tagesschau aber auch nicht funktionieren. Ich vermute Internet/Netzwerkprobleme bei deinem Raspberry.

currentweather.js:338 GET https://api.openweathermap.org/data/2.5/weather?id=2825297&units=metric&lang=de&APPID=mypersonalid net::ERR_INTERNET_DISCONNECTED updateWeather @ currentweather.js:338 (anonymous) @ currentweather.js:499 setTimeout (async) scheduleUpdate @ currentweather.js:498 start @ currentweather.js:112 startModules @ loader.js:55 (anonymous) @ loader.js:40 stylesheet.onload @ loader.js:203 currentweather.js:330 currentweather: Could not load weather. weatherRequest.onreadystatechange @ currentweather.js:330 XMLHttpRequest.send (async) updateWeather @ currentweather.js:338 (anonymous) @ currentweather.js:499 setTimeout (async) scheduleUpdate @ currentweather.js:498 start @ currentweather.js:112 startModules @ loader.js:55 (anonymous) @ loader.js:40 stylesheet.onload @ loader.js:203 MMM-Podcast-xml2json.js:65 Uncaught TypeError: xmlStr.replace is not a function at cleanXML (MMM-Podcast-xml2json.js:65) at xml2json (MMM-Podcast-xml2json.js:11) at Class.socketNotificationReceived (MMM-Podcast2.js:88) at module.js:246 at r. (socketclient.js:25) at r.emit (index.js:83) at r.onevent (index.js:83) at r.MMSocket.self.socket.onevent (socketclient.js:19) at r.onpacket (index.js:83) at r. (index.js:83) cleanXML @ MMM-Podcast-xml2json.js:65 xml2json @ MMM-Podcast-xml2json.js:11 socketNotificationReceived @ MMM-Podcast2.js:88

It looks like your raspberry first loses the Internet connection (when trying to receive weather data) or does not even have one at all, after that there is an error in MMM Podcast2. I could catch the error with the missing connection in javascript, then the stream of Tagesschau would not work either. I suspect internet / network problems with your raspberry. currentweather.js:338 GET https://api.openweathermap.org/data/2.5/weather?id=2825297&units=metric&lang=de&APPID=mypersonalid net::ERR_INTERNET_DISCONNECTED updateWeather @ currentweather.js:338 (anonymous) @ currentweather.js:499 setTimeout (async) scheduleUpdate @ currentweather.js:498 start @ currentweather.js:112 startModules @ loader.js:55 (anonymous) @ loader.js:40 stylesheet.onload @ loader.js:203 currentweather.js:330 currentweather: Could not load weather. weatherRequest.onreadystatechange @ currentweather.js:330 XMLHttpRequest.send (async) updateWeather @ currentweather.js:338 (anonymous) @ currentweather.js:499 setTimeout (async) scheduleUpdate @ currentweather.js:498 start @ currentweather.js:112 startModules @ loader.js:55 (anonymous) @ loader.js:40 stylesheet.onload @ loader.js:203 MMM-Podcast-xml2json.js:65 Uncaught TypeError: xmlStr.replace is not a function at cleanXML (MMM-Podcast-xml2json.js:65) at xml2json (MMM-Podcast-xml2json.js:11) at Class.socketNotificationReceived (MMM-Podcast2.js:88) at module.js:246 at r. (socketclient.js:25) at r.emit (index.js:83) at r.onevent (index.js:83) at r.MMSocket.self.socket.onevent (socketclient.js:19) at r.onpacket (index.js:83) at r. (index.js:83) cleanXML @ MMM-Podcast-xml2json.js:65 xml2json @ MMM-Podcast-xml2json.js:11 socketNotificationReceived @ MMM-Podcast2.js:88 AxLED

Robiv8 commented 5 years ago

Hallo und Danke für die Info, An der Internetverbindung liegt es definitiv nicht! Habe verschiedene raspis mit verschiedenen Installationen probiert. Überall dasselbe. Die ganzen Daten wie zb. Wetter, Zugverbindungen, DWD usw. werden auch gleich geladen. Internet ist gleich da, da es auch per Lan angeschloßen ist ohne Wlan.

Habe rausbekommen das wenn ich in der MMM-Podcast-xml2json.js unter Zeile 12 ein var streamurl = ''; dranhänge es zwar ohne Fehler funktioniert jedoch immer erst wen man 3x den button drückt.

I experimented a lot and read a lot. This “streamurl is not defined” has made me curious. So i put a new entry in the MMM podcast2.js under line 12 with:

var streamurl = '';

then it will work after a reboot, but not right after the first press. You have to press again and next time it will come. So page is set up, then Press Button for Play, Press Button for Stop, Press Button for Play and then comes the video. Very Strange.

Server started ...
Connecting socket for: MMM-Remote-Control
Starting node helper for: MMM-Remote-Control
Connecting socket for: MMM-Buttons
Starting node helper for: MMM-Buttons
Connecting socket for: MMM-Page-Selector
Connecting socket for: updatenotification
Connecting socket for: MMM-Podcast2
Connecting socket for: newsfeed
Starting module: newsfeed
Sockets connected & modules started ...
Launching application.
Initialize button Hauptseite on PIN 17
Initialize button Podcast on PIN 24
Starting node helper for: MMM-Podcast2
Create new news fetcher for url: http://www.stuttgarter-nachrichten.de/stuttgart.rss.feed - Interval: 300000
Use existing news fetcher for url: http://www.stuttgarter-nachrichten.de/stuttgart.rss.feed

The site has now fully built up. Now i press the button:

MMM-Podcast2 PLAY: < -- Nothing! Also do not wait for a longer time
MMM-Podcast2 STOP: 
MMM-Podcast2 PLAY: < -- now comes the Video
MMM-Podcast2 STOP:
Ax-LED commented 5 years ago

@Robiv8 see english version below Ich habe mal nachgeforscht, es scheint an dem von dir verwendetet MMM-Page-Selector zu liegen. Ändere bitte mal deine config.js wie folgt

        haupt: {
        "clock": "top_left",
        "currentweather": "top_right",
        "newsfeed": "bottom_bar"
        }
    },
        exclusions: [
        "notification",
        "podcast2",
        "alert"
        ]

Hintergrund: MMM-Page-selector braucht für die Modulanzeige unter "haupt" wohl eine Position um korrekt zu funktionieren. Da MMM-Podcast2 aber keine Position hat (und braucht) klappt es nicht. Wenn du MMM-Podcast2 in die exclusions packst, wird das Modul mit dem Start von MM geladen, somit auch der zugehörige node_helper, der die URL des .mp4 streams aus der rss Seite extrahiert. Daher war deine Fehlermeldung auch streamurl = undefined, da der node_helper nie geladen wurde und somit auch keine streamurl ausgelesen werden konnte.

Freue mich auf deine Rückmeldung

AxLED

english: I investigated your error, it seems to be the MMM-Page-Selector module you use. Please change your config.js as follows


        haupt: {
        "clock": "top_left",
        "currentweather": "top_right",
        "newsfeed": "bottom_bar"
        }
    },
        exclusions: [
        "notification",
        "podcast2",
        "alert"
        ]```
** Explanation: ** `MMM-Page-selector` probably needs a position for the modules listet under "haupt" to work correctly. But `MMM-Podcast2` has no position (and does not need it) and does not work. If you put `MMM-Podcast2` in the `exclusions`, the module is loaded with the start of MM, and so the corresponding `node_helper` is loaded, which extracts the URL of the .mp4 stream from the rss page. This was the reason  your error message was `streamurl = undefined`, since the `node_helper` was never loaded and thus no streamurl could be read.

I'm looking forward to your feedback

axled
Robiv8 commented 5 years ago

Werde ich gleich morgen Nachmittag testen, das wäre ja der große Knaller. Danke fürs recherchieren. Ich werde auf jedenfall Rückmelden.

Will I test the same tomorrow afternoon, that would be the big bang. Thanks for researching. I will definitely confirm.

Robiv8 commented 5 years ago

OK That work! i will Test it more tonight but the first test was positiv Yeah Trank you very much

Ax-LED commented 5 years ago

As i didnt hear something i guess it works on your mirror also. Issue closed AxLED