DustinBryant / MMM-Ring

Module for MagicMirror that adds video feed of Ring Doorbell events
MIT License
25 stars 10 forks source link

Black screen on mirror #5

Open mikepgchan opened 4 years ago

mikepgchan commented 4 years ago

I have some issue with this module. When I ring the bell, there is reaction on my magic mirror. I have put this top_left and other module will move below, but the ring module has no video and only black screen. Is there someone with the same problem? @DustinBryant do you know how I can fix this?

DustinBryant commented 4 years ago
  1. Has the module ever worked for you or is this the first time using it?
  2. Do you have an active Ring subscription?
  3. Are you using 2 factor authentication?
  4. Are there any errors showing in the terminal?
    • Using pm2 Run the following in a terminal: pm2 restart mm && pm2 logs mm and once it starts, on your keyboard press the alt key then ctrl+m and look at the terminal window for errors. Ring your doorbell and watch for other errors
    • Not using pm2 Start Magic Mirror in terminal (Navigate to the main MagicMirror folder and run npm run start) and once it starts, on your keyboard press the alt key then ctrl+m and look at the terminal window for errors. Ring your doorbell and watch for other errors
  5. Are there any errors in the dev console?
    • If you are using pm2 then stop mm by pm2 stop mm. Now start the Magic Mirror in terminal by using npm start dev. You're looking for warnings only related to MMM-RING. Ring your doorbell and watch for other errors
  6. Are .ts files being put into the public folder after you ring your doorbell?
    • With MagicMirror running, on your keyboard press the alt key then ctrl+m. Open file manager and navigate to the MagicMirror/modules/MMM-Ring/public folder. Now, go ring your doorbell and come back. There should be .ts files being generated and deleted during an active ring event.
mikepgchan commented 4 years ago
  1. No never
  2. Im in my 30 days trial period.
  3. no
  4. no errors
  5. No error
  6. yes
mikepgchan commented 4 years ago

I can see following log:

Interval: 300000 [20:23:37.102] [LOG] MMM-Ring at (26-1-2020 20:23:37): Found 1 location(s) with 1 camera(s). [20:23:37.104] [LOG] MMM-Ring at (26-1-2020 20:23:37): Location has the following 1 camera(s): [20:23:37.105] [LOG] MMM-Ring at (26-1-2020 20:23:37): - 42664410: Voordeur (doorbell_v3) [20:23:37.106] [LOG] MMM-Ring at (26-1-2020 20:23:37): Location has the following 0 device(s): [20:23:37.108] [LOG] MMM-Ring at (26-1-2020 20:23:37): Actively listening for doorbell presses [20:24:53.380] [LOG] MMM-Ring at (26-1-2020 20:24:53): Voordeur had its doorbell rung! Preparing video stream. [20:26:23.686] [LOG] timeout hit [20:26:23.687] [LOG] MMM-Ring at (26-1-2020 20:26:23): Voordeur video stream has ended [20:27:48.204] [LOG] MMM-Ring at (26-1-2020 20:27:48): Voordeur had its doorbell rung! Preparing video stream. [20:29:18.466] [LOG] timeout hit [20:29:18.468] [LOG] MMM-Ring at (26-1-2020 20:29:18): Voordeur video stream has ended

DustinBryant commented 4 years ago

Ok, everything is looking good then. We just need it to get displayed.

I'm going to assume you're not using the latest MagicMirror. This is fine, we just may need to tweak one of the files.

  1. Open this file in a text editor: MagicMirror/js/electron.js.
  2. Search for the following: autoplay-policy in that file. There SHOULD be this line:
    app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");

    It will be located under

    function createWindow() {
  3. If that line is not there then right under the function createWindow() add this line:
    app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");

The end result should look like this:

function createWindow() {
    app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");
    var electronOptionsDefaults = {
        width: 800,
        height: 600,
        x: 0,
        y: 0,
        darkTheme: true,
        webPreferences: {
            nodeIntegration: false,
            zoomFactor: config.zoom
        },
        backgroundColor: "#000000"
    };
  1. No save the file and restart MagicMirror.. And ring your doorbell to verify it is working.
mikepgchan commented 4 years ago

thanks for your answer. My file is exactly what you mentioned. so, I dont have to change the file.

I am using the latest MagicMirror.

DustinBryant commented 4 years ago

Oh no, thought that would have been it!

  1. Are you by chance running in server-mode or normal?
  2. Are you using the default address localhost or are you using a custom one(in the config.js the first thing (about line 12 of the code) is the address)?
  3. Can you post your config and redact your username/password?

Also, from step 6 above

Are .ts files being put into the public folder after you ring your doorbell? With MagicMirror running, on your keyboard press the alt key then ctrl+m. Open file manager and navigate to the MagicMirror/modules/MMM-Ring/public folder. Now, go ring your doorbell and come back. There should be .ts files being generated and deleted during an active ring event.

After you ring your doorbell come back and open one of the .ts files using a video player and see if you get a short couple second video of your doorbell camera.

Let me know how that goes.

mikepgchan commented 4 years ago
  1. I am running on normale mode.
  2. 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, is "localhost" port: 8080, ipWhitelist: [], // 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"],
  3. { module: "MMM-Ring", position: "top_bar", config: { ringEmail: "xxx@hotmail.com", ringPwd: "123456789!!", ringVideoWidth: '700' } },

Step 6 above is working correct. after ringing my doorbell, ts files will appear and dissapear. I can also open this file and see the doorbell video.

I think this module is working, but only unable to show video in MagicMirror. Perhaps need to download some codec?

DustinBryant commented 4 years ago

Can you try setting position to: middle_center and remove the ringVideoWidth property?

mikepgchan commented 4 years ago

Done that, but still not working, thats why I moved the position and added ringVideoWidth haha after moving position to top_bar, at least I see some modules moving after ringing the bell. If I set this in middle_center, nothing will move.

DustinBryant commented 4 years ago

Running out of solutions for you. I can't reproduce the issue and you're not getting any errors so its difficult to know the source.

You had mentioned a codec before, but you shouldn't need a specific codec that doesn't already come with ffmpeg.

Perhaps try re-installing MMM-Ring by removing the folder and following the installation instructions again:

Using the terminal, navigate to your MagicMirror/modules folder Execute: git clone https://github.com/DustinBryant/MMM-Ring.git Navigate to this new folder cd MMM-Ring Execute: npm install

mikepgchan commented 4 years ago

I have reinstalled ffmpeg, MM-Ring and removed folder first. Did all installation again, but without success. If I every can make this work, I will share this here

Kitser commented 4 years ago

I have the same problem. The *.ts files are written to the public folder correctly as you described. This is my config

/*************** AUTO GENERATED BY REMOTE CONTROL MODULE ***************/

var config = 
{
  address: '0.0.0.0',
  electronOptions: {},
  ipWhitelist: [
    '127.0.0.1',
    '::ffff:127.0.0.1',
    '::1',
    '::ffff:192.168.1.1/120',
    '192.168.1.1/24'
  ],
  language: 'nl',
  modules: [
    {
      module: 'alert',
      config: {}
    },
    {
      module: 'updatenotification',
      position: 'top_bar',
      config: {}
    },
    {
      module: 'clock',
      position: 'top_center',
      config: {
        dateFormat: 'dddd D MMMM'
      }
    },
    {
      module: 'MMM-Remote-Control',
      config: {
        customCommand: {},
        customMenu: 'custom_menu.json',
        showModuleApiMenu: true,
        apiKey: ''
      }
    },
    {
      module: 'MMM-Ring',
      position: 'middle_center',
      config: {
        ring2faRefreshToken: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
      }
    },
    {
      module: 'MMM-iFrame',
      position: 'bottom_bar',
      header: '',
      config: {
        url: [
          'https://www.buienalarm.nl/vlaardingen-zuid-holland-nederland/xxxxxxxxxx',
          'https://www.buienalarm.nl/vlaardingen-zuid-holland-nederland/xxxxxxxxxxxx'
        ],
        updateInterval: 600000,
        width: '1080',
        height: '355',
        frameWidth: '1080'
      }
    },
    {
      module: 'currentweather',
      position: 'top_left',
      config: {
        location: 'xxxxxxxxxx',
        locationID: 'xxxxxxxx',
        appid: 'xxxxxxxxxxxx',
        iconTable: {
          '01d': 'wi-day-sunny',
          '02d': 'wi-day-cloudy',
          '03d': 'wi-cloudy',
          '04d': 'wi-cloudy-windy',
          '09d': 'wi-showers',
          '10d': 'wi-rain',
          '11d': 'wi-thunderstorm',
          '13d': 'wi-snow',
          '50d': 'wi-fog',
          '01n': 'wi-night-clear',
          '02n': 'wi-night-cloudy',
          '03n': 'wi-night-cloudy',
          '04n': 'wi-night-cloudy',
          '09n': 'wi-night-showers',
          '10n': 'wi-night-rain',
          '11n': 'wi-night-thunderstorm',
          '13n': 'wi-night-snow',
          '50n': 'wi-night-alt-cloudy-windy'
        }
      }
    },
    {
      module: 'weatherforecast',
      position: 'top_right',
      header: 'Weersvoorspelling',
      config: {
        location: 'xxxxx',
        locationID: 'xxxxxxxx',
        appid: 'xxxxxxxxxxxxxx',
        iconTable: {
          '01d': 'wi-day-sunny',
          '02d': 'wi-day-cloudy',
          '03d': 'wi-cloudy',
          '04d': 'wi-cloudy-windy',
          '09d': 'wi-showers',
          '10d': 'wi-rain',
          '11d': 'wi-thunderstorm',
          '13d': 'wi-snow',
          '50d': 'wi-fog',
          '01n': 'wi-night-clear',
          '02n': 'wi-night-cloudy',
          '03n': 'wi-night-cloudy',
          '04n': 'wi-night-cloudy',
          '09n': 'wi-night-showers',
          '10n': 'wi-night-rain',
          '11n': 'wi-night-thunderstorm',
          '13n': 'wi-night-snow',
          '50n': 'wi-night-alt-cloudy-windy'
        }
      }
    }
  ],
  paths: {
    modules: 'modules',
    vendor: 'vendor'
  }
}

/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== 'undefined') {module.exports = config;}
DustinBryant commented 4 years ago

I'm curious if it has to do with the version of electron that comes with MagicMirror. I haven't ran that version in quite some time. I manually changed it some time ago.

If either of you would like to test this then do it at your own risk. The following includes directions to upgrade electron to a higher version for MagicMirror:

Open the package.json file in a text editor within the MagicMirror main folder. Set the optionalDependency electron to the following:

    "electron": "^6.1.0"

Delete the node_modules folder within the main MagicMirror folder. Then in a terminal window run npm install

You may want to check all the package.json's for each module you have installed in the MagicMirror/modules folder. If any of them contain electron-rebuild as a dependency then navigate your terminal to those modules and run npm install which should re-run the electron-rebuild. Not many modules contain the electron-rebuild dependency but some do (IE: MMM-Hotword).

Once you've done this, you can restart the MagicMirror. Let me know if this works for you.

If you need to revert back, all you have to do is repeat the steps above but change the electron version of the main MagicMirror back to what it was before you changed it (IE: ^3.0.13).

mikepgchan commented 4 years ago

thanks for this advice, have done this step by step. doesnt work for me :(

jasonbade commented 4 years ago

I have a brand new installation of MagicMirror. One of the first modules I installed was MMM-Ring. I'm seeing the same behavior as mentioned above.

The version of Electron in the MM package.json appears to be newer (6.1.7) than what you referenced (6.1.0).

Doudy commented 4 years ago

Still no solution ?

The version of Electron in the MMM package.json appears to be newer (6.1.7)

Doudy commented 4 years ago

Hello, Yesterday I did several tests. My MMM with only as module: Alert + clock + ring = ring display OK Alert + clock + ring + weatherforecast = ring display OK Alert + clock + ring + weatherforecast + newsfeed = ring display OK Alert + clock + ring + weatherforecast + newsfeed + MMM-CalendarExt2 = ring display OK Alert + clock + ring + weatherforecast + newsfeed + MMM-CalendarExt2 + MMM-Domoticz = ring display OK If I add MMM-SmartWebDisplay = ring display NOK If I add MMM-Buienradar = ring display NOK

An idea ?

DustinBryant commented 4 years ago

Just pushed a new update that may or may not help. The Ring-client npm developer is about to release a change that will fix possible NAT issues and once that happens it may fix some of the issues you all are experiencing.

For the time being, please update by navigating to the MMM-Ring directory within MagicMirror/modules and perform the following:

git pull npm install

Ring now requires Two-Factor Authentication so please make sure to follow this Wiki on the details of setting that up correctly: https://github.com/DustinBryant/MMM-Ring/wiki/Refresh-Tokens

The biggest difference in change is the module now automatically gets a new Refresh Token for you when the one you provide expires.

DustinBryant commented 4 years ago

The ring-client-api has now been updated to 9.1.1 and the biggest feature of that upgrade is:

UPnP and NAT-PMP hole punching has been removed in favor of RTP latching. This should lead to a successful live stream, regardless of network configuration, network settings, and NAT type

Please update MMM-Ring to the latest and let me know if this fixes your issues:

git pull npm install

Doudy commented 4 years ago

Hello, I have update MMM-Ring. Result pi@raspberrypi-184:~/MagicMirror/modules/MMM-Ring $ git reset --hard HEAD HEAD est maintenant à d07e857 Upgraded ring-client-api to 6.0.3 pi@raspberrypi-184:~/MagicMirror/modules/MMM-Ring $ git reset --hard HEAD && git checkout master && git pull HEAD est maintenant à d07e857 Upgraded ring-client-api to 6.0.3 Déjà sur 'master' Votre branche est en retard sur 'origin/master' de 3 commits, et peut être mise à jour en avance rapide. (utilisez "git pull" pour mettre à jour votre branche locale) Mise à jour d07e857..39aac6b Fast-forward .github/ISSUE_TEMPLATE/bug_report.md | 27 -- .gitignore | 5 +- MMM-Ring.js | 12 + README.md | 19 +- node_helper.js | 36 ++- package-lock.json | 729 +++++++++++++++++++++++++++++++++------------------ package.json | 9 +- 7 files changed, 537 insertions(+), 300 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md pi@raspberrypi-184:~/MagicMirror/modules/MMM-Ring $ npm install

`pi@raspberrypi-184:~/MagicMirror/modules/MMM-Ring $ npm install

ffmpeg-for-homebridge@0.0.5 install /home/pi/MagicMirror/modules/MMM-Ring/node_modules/ffmpeg-for-homebridge node install.js

Downloading ffmpeg from https://github.com/homebridge/ffmpeg-for-homebridge/releases/latest/download/ffmpeg-raspbian-armv6l.tar.gz 100% - Download Complete ffmpeg version 4.2.2-d1e8be3 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516 configuration: --pkgconfigdir=/build/workspace/lib/pkgconfig --prefix=/build/workspace --pkg-config-flags=--static --extra-cflags=-I/build/workspace/include --extra-ldflags=-L/build/workspace/lib --extra-libs='-lpthread -lm' --enable-static --disable-debug --disable-shared --disable-ffplay --disable-doc --enable-openssl --enable-gpl --enable-version3 --enable-nonfree --enable-pthreads --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-runtime-cpudetect --enable-libfdk-aac --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-libspeex --enable-demuxer=rtsp --enable-omx-rpi --enable-mmal --enable-indev=alsa --enable-outdev=alsa libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100

ffmpeg has been downloaded to /home/pi/MagicMirror/modules/MMM-Ring/node_modules/ffmpeg-for-homebridge/ffmpeg Thank you for using https://github.com/homebridge/ffmpeg-for-homebridge

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

added 44 packages from 60 contributors, removed 12 packages, updated 41 packages and audited 221 packages in 673.699s

12 packages are looking for funding run npm fund for details

found 1 low severity vulnerability run npm audit fix to fix them, or npm audit for details pi@raspberrypi-184:~/MagicMirror/modules/MMM-Ring $ npm audit

                   === npm audit security report ===

┌──────────────────────────────────────────────────────────────────────────────┐ │ Manual Review │ │ Some vulnerabilities require your attention to resolve │ │ │ │ Visit https://go.npm.me/audit-guide for additional guidance │ └──────────────────────────────────────────────────────────────────────────────┘ ┌───────────────┬──────────────────────────────────────────────────────────────┐ │ Low │ Prototype Pollution │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Package │ yargs-parser │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Patched in │ >=13.1.2 <14.0.0 || >=15.0.1 <16.0.0 || >=18.1.2 │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Dependency of │ ring-client-api │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Path │ ring-client-api > stun > meow > yargs-parser │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ More info │ https://npmjs.com/advisories/1500 │ └───────────────┴──────────────────────────────────────────────────────────────┘ found 1 low severity vulnerability in 221 scanned packages 1 vulnerability requires manual review. See the full report for details.`

DustinBryant commented 4 years ago

That is the normal response for this update. It is a low vulnerability that the ring-client-api uses. Have you tried running MagicMirror after the update and if so did the MMM-Ring module work correctly?

Doudy commented 4 years ago

Hello, I followed the Refresh Tokens procedure to get a new token. Tests: With only alert-updatenotification-clock and MMM-Ring => ring display OK => much faster display (almost instantaneous) I add newfeed => ring display OK => much faster display I add currentweather and weatherforecast => works intermittently I add MMM-CalendarExt2 => ring display OK I add MMM-CalendarExtTimeline => ring display OK I add MMM-Domoticz => ring display OK I add MMM-SmartWebDisplay top-center or middle_center => ring display NOK I withdraw MMM-SmartWebDisplay I add MMM-iFrameReload middle-center => ring display is placed below iFrameReload I add MMM-pages => ring display on each page

Ascertainment : Doesn't seem to work with SmartWebDisplay

My MMM-Pages `

module: "MMM-pages", config: { modules: [ [ "MMM-iFrameReload"], [ "MMM-CalendarExt2", "MMM-CalendarExtTimeline" ], [ "MMM-Domoticz-1", "MMM-Domoticz-2"] ], fixed: ["clock", "newsfeed", "currentweather", "weatherforecast","MMM-page-indicator","MMM-Ring"], rotationTime:4000, }

`

DustinBryant commented 4 years ago

I briefly looked over MMM-SmartWebDisplay and I don't see how they could interfere. Maybe in the configuration put MMM-Ring first and then the MMM-SmartWebDisplay after or vise versa depending on how you currently have it set up. It could also have been a fluke. I'd try a couple times with the doorbell while using MMM-SmartWebDisplay to see if that is the case.

Doudy commented 4 years ago

Hello, I put MMM-Ring first. I redid tests with MMM-SmartWebDisplay and that does not change anything. No ring display!

In my previous comment, I mentioned that the display was steeper, but it is not. Always so slow ...

talving commented 4 years ago

Having the same problem..

shagtimetim commented 3 years ago

Having the same issue. I have the Ring module in a page with clock. I get no motion alerts nor ring alerts.