New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposed v2.0.0-dev] Extensible REST API, Dynamic Menus, and Socket Communications, plus other updates #104
Conversation
- Moved monitor controls into their own function and added toggle and status - Bug fixes for incorrect responses and hung responses on bad GET calls.
Incorporate new translations from Varguit
Fix README Formatting
This looks awesome. |
Hopefully I will find a few hours until the end of this year to merge this. |
Thanks! I had a good base to start from, though... The last big thing I wanted to add is custom remote menu items, dynamically loaded from the "guessed" API functions. This will allow for tap and send notifications, and, as long as the other module developer follows the standard notification conventions, you don't have to specifically "add" support for other modules to control them. Item's can also be loaded from a user's config or json file. |
- Automatically generated from the API to control the different modules you have installed, based on their `notificationReceived` function.
@Jopyth OK -- I'm done adding major features for now, if you have any questions when you get around to looking at the changes, please let me know. The last feature set I added was for Dynamic Menus --
Both of these are in the spirit of expanding control to other modules, but do so in a way that this module doesn't have to be manually updated to support everyone else's modules individually. I have a few more ideas that I'll implement and push at a later date (such as live module position changes without a restart, and the ability to enter text for a Module Controls menu item (most likely something like a long-press to open the alert form). |
I hope you don't mind the intrusion, but I really like your module and I've been working on an updated version to truly make it "THE" remote for MagicMirror. If you don't want to incorporate my changes to the original channel, that's fine... I just wanted to share.
Description
I created an updated version with an extensible REST API for controlling everything about your mirror, as well as an upgrade of the
/remote.html
tool to use the module's node_helper socket connection for communication back and forth--instead of get/post calls.Example REST Calls:
Turn on the monitor
GET /api/monitor/on (curl -X GET 'http://magicmirror:8080/api/monitor/on')
Hide All Modules
GET /api/modules/all/hide (curl -X GET 'http://magicmirror:8080/api/modules/all/hide')
Here's the link to the API README and API Documentation. The API also includes the ability to automatically interpret other modules' anticipated notifications to create a "guessed" API to control it (created from MMM-API). Modules' can also send a notification to this module to explicitly declare their own API actions.
Inspiration
I've now written several modules and end of constantly including similar functions into my code (things like monitor control, module switching, etc.) for the different modules and I wanted to start migrating to a "One Remote to Rule Them All"-style module. @Jopyth's module is an awesome base with a lot of the functions needed already built in, but I also wanted to have a better RESTful interface (inspired by @juzim's MMM-API module incorporated in natively so I could control the mirror from my home automation devices. Eventually, I'll scrub my other modules like MMM-OnScreenMenu and MMM-KeyBindings to just call the functions from this module and keep them focused on their own key features.
Key Features and Changes
Added:
modules.json
from the MagicMirror wiki, based on @eouia's MMM-Remote-Control-Repository.Changed:
remote.html
and thenode_helper.js
to use direct SocketIO communication back and forth instead of separate HTTP calls.