Jopyth / MMM-Remote-Control

Magic Mirror Module to shutdown or configure your mirror
MIT License
504 stars 149 forks source link

API not reachable, error msg: Cannot GET /api/docs #306

Open Schnabulation opened 1 month ago

Schnabulation commented 1 month ago

OS

Raspberry Pi OS (Linux magicmirror 6.6.31+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux)

NodeJS Version

v22.9.0

MagicMirror² Version

2.29.0

Remote Control Version

2.3.8

Did you try using just Remote Control alone with MM?

Description

Brand new install of Magic Mirror using manual install on a Raspberry Pi 5.

MagicMirror and MMM-Remote-Control working flawlessly. Frontend of MagicMirror can be accessed from another machine (http://IP-of-MM:8080). Frontend of MMM-Remote-Control can be accessed from another machine (http://IP-of-MM:8080/remote.html).

However: I can not access the API endpoint. A normal GET request to http://IP-of-MM:8080/api/docs gets answered with Cannot GET /api/docs

Expected behavior

API request should be completed successfully.

Current behavior

Error message saying Cannot GET /api/docs

Possible solution

No response

Steps to reproduce

  1. Start MM
  2. Wait until everything starts
  3. Try to open "http://IP-of-MM:8080/api/docs"

Log

Nothing in log files regarding this issue. I started 'npm logs mm' and kept watching the logs as I send above request. No new entries.

config.js

let config = {
    address: "0.0.0.0",     // 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,
    basePath: "/",  // The URL path where MagicMirror² is hosted. If you are using a Reverse proxy
                    // you must set the sub path here. basePath must end with a /
    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"],

    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",
    locale: "de-CH",
    // logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging
    logLevel: ["WARN", "ERROR"], // Add "DEBUG" for even more logging
    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: "alert",
        },
        {
            module: "MMM-Remote-Control",         
            config: {
                showModuleApiMenu: true,
                secureEndpoints: false,
                customCommand: {
                monitorOnCommand: 'WAYLAND_DISPLAY=wayland-1 wlr-randr --output HDMI-A-1 --on --transform 270',
                monitorOffCommand: 'WAYLAND_DISPLAY=wayland-1 wlr-randr --output HDMI-A-1 --off',
                monitorStatusCommand: '/home/steve/MagicMirror/monitorstatus.sh'
                }
            }
        },

Additional info

No response

khassel commented 1 month ago

This module needs changes to work with new MagicMirror² version v2.29.0. A PR is on the way but I don't know who is maintaining this project at the moment ...

Schnabulation commented 1 month ago

Interesting, thank you for reply.

Regarding the aforementioned PR: the module works perfectly fine on my setup - only the API does not work. Stock install of the module btw.

khassel commented 1 month ago

the api works with the PR, tested this ...

khassel commented 1 month ago

the module works perfectly fine on my setup

not on my side, e.g. http://localhost:8080/remote.html#update-menu is always empty and http://localhost:8080/remote.html#module-control-menu is missing ...

Jopyth commented 1 month ago

@ezeholz has done most of the maintenance for a long time. But if they are not available I can merge the PRs needed as well.

So #307 should fix the module and the API? Because I just saw #292 has also been open for a very long time, and am not sure if that would still be needed as well.

khassel commented 1 month ago

So https://github.com/Jopyth/MMM-Remote-Control/pull/307 should fix the module and the API?

I did some cleanup/changes in the core mm for v2.29.0 which breaks this module at some points, https://github.com/Jopyth/MMM-Remote-Control/pull/307 is the fix for this.

With this fix the /api/docs shows the swagger site (whithout the fix you get the error described above), but I cannot say if the other PR is still needed.

ambarusa commented 1 month ago

Having the same issue. @khassel's update is working well in my setup

martbrad11 commented 1 month ago

I've just installed MM on PC running Linux Mint (Ubuntu version) and have the same problem. I've tried to update MMM_Remote-Control but it tells me I'm up to date. I can see the remote web page but API does not connect. Is there a way I can fix this?

ambarusa commented 1 month ago

Clone this repo and branch temporarily:

https://github.com/khassel/MMM-Remote-Control/tree/mm_fixes

ezeholz commented 1 month ago

So it's safe to merge? I cannot test it anymore, as I don't own a MM instalation anymore.

Sorry for the absence, a lot happened on my side.

Snille commented 1 month ago

I can also confirm that @khassel:s PR works.

ezeholz commented 1 month ago

Please confirm that it's actually working, khassel PR merged

Snille commented 1 month ago

I can confirm, it works now. Thank you.