MMM-Remote-Control icon indicating copy to clipboard operation
MMM-Remote-Control copied to clipboard

Feature Request: Listening for changes in other modules

Open Fabrizz opened this issue 1 year ago • 0 comments

Description

It would be nice to have a (disabled by default) option to make the module send the web API action to the MM2 notification/event bus. And It could be pretty easy to implement! (See below)

Example:

  1. I set the display brightness to 70% using the API
  2. MMM-Remote control processes the change
  3. Module sends the change to the MM2 event bus

Changelog

https://github.com/Jopyth/MMM-Remote-Control/blob/fb20bd483540ebb6eef0c8495cecd807d5dd1e0e/node_helper.js#L688

The query could be resent here to the fronted so it can be sent to the MM2 event bus.

executeQuerysendSocketNotification → module → MM2 notification

Requirements

~~I think it could be fairly easy to implement this as a middleware in express, after the request is made and authorized the module could just send a RC_WEBAPI_SET (or similar) notification with the payload/endpoint~~. (Optionally the config entry could be an array to match the feature in the api to resend, filtering what is resended).

As said in "changelog", the best idea would be to get the query and just resend it to the MM2 event bus

Additional info

Why?

Compatibility with other modules that use MMM-Remote-Control. Im writing MMM-HomeKit, that adds native homekit support for MM2, exposing accessories to control modules/the mirror. I would love to use MMM-Remote-Control as the endpoint for things like screen brightness, on/off/reboot/etc, and having the info reflected on the Homekit app even if not made by it could be nice:

https://github.com/Jopyth/MMM-Remote-Control/assets/65259076/34b1d486-f709-4b5c-be7e-522cff445b61

Example with HA and MMM-OnSpotify / MMM-LiveLyrics

Fabrizz avatar Mar 08 '24 01:03 Fabrizz