Jopyth/MMM-Remote-Control

Module status

sdmydbr9 opened this issue · 15 comments

I’m unable to figure out if there’s any mechanism to determine the hidden or not status of a module.
Curl http://localhost/remote?action=HIDE&force=true&module=$name
is for hiding a module, is there any curl command to get the status of a module

Hey! So, you can see if the module is hidden or not using the hidden tag when calling http://localhost/api/module/ and the name of the module. You can read more about it in here.

Also, I just now found a bug that sending show or hide through the API doesn't update the status. I'll fix it for the next update.

Let me know if it's anything else I can help you!
Cheers :D

I tried to use the mmm-api module. It installs fine and when I load the main module it gives an error “EADDRINUSE”.
Seems like api module starts the main module twice or something.

Since version 2.0.0 the API is already installed by default with Remote Control. You don't need to add the module to work.

I am actually stuck not knowing how to implement this api feature. I tried calling http://ip-of-mirror/api/test and I ended up with {"success":false,"message":"Forbidden: API Key Not Provided!"}
How do I get an api key? Or do I insert any string in my config under the mmm-remote control module
apiKey: “anystring”

Using this part of the wiki!

Also, check every item of the wiki to understand every change in Remote Control

Thank you. It’s working 😊

Forgive me for being a noob but I was able to do the show alert successfully. How do I show a module, I could not find it in the wiki for showing a module.
Is it http://192.168.29.202:8080/api/module/MMM-Strava/apiKey=mirrormirror
can you please give me an example with a module.

Sure! For example, to show the module you should use:
http://192.168.29.202:8080/api/module/MMM-Strava/show?apiKey=mirrormirror
And if you want to hide the same module, use:
http://192.168.29.202:8080/api/module/MMM-Strava/hide?apiKey=mirrormirror

All that is explained in here, or using the docs integrated with Remote Control:
http://192.168.29.202:8080/api/docs

From there, you can press the button Authorize, fill it with your apiKey, and test every endpoint available.

Let me know if you need more help, and I'll be glad to help you! :D

I tried with the above url and now I’m getting
{"success":false,"info":"No API routes found for MMM-Strava."}
Is there any additional steps ?

Try restarting MM and check if every configuration inside config.js is in place. Finally, check if you have the latest version of MM and Remote Control using logs. You can also try using SHOW or HIDE.

If none of the above works, please send me your MM log and config file (Of course with the personal matters such as passwords and api keys censored) and I'll review it for a posible bug ASAP. :D

Edit: Reviewing the error you're getting, it seems that you download a release of Remote Control previous to the 2.2.0 version, because that error no longer exists in newer versions. I encourage you to download the latest version so you can be up to date. Cheers :D

Yes I can confirm it’s working now. Thank you so much.
One last thing I still have no idea is how to bypass lockstring because I have multiple profile set up.

Force should do the trick. Use api/module/MMM/force?apiKey=mirrormirror

Glad to be helpful! :D

So the answer to my original question of how to get the status if a module is hidden or shown is http://192.168.29.202:8080/api/module/MMM-Strava/hidden?apiKey=mirrormirror
I get some output but I don’t know if that’s the correct data. Can you please look into this

You should use http://192.168.29.202:8080/api/module/MMM-Strava?apiKey=mirrormirror
That will give you a response of something like this (Of course with MMM-Strava's module data):

{
  "success": true,
  "data": [
    {
      "index": "0",
      "identifier": "module_0_MMM-Remote-Control",
      "name": "MMM-Remote-Control",
      "path": "modules/MMM-Remote-Control/",
      "file": "MMM-Remote-Control.js",
      "position": "top_right",
      "header": "",
      "configDeepMerge": false,
      "config": {
        "customCommand": {},
        "showModuleApiMenu": true
      },
      "classes": "MMM-Remote-Control",
      "hidden": false,
      "lockStrings": []
    }
  ]
}

Then, you can simply use response.data[0].hidden to check if it's visible. There's no endpoint to check the visibility of the module yet.

Okay thank you so much, you have been really helpful 😊.