@Cr4z33 indeed, strange, I will check my code this evening (I did it by “memory” since this morning…).
Read the statement by Michael Teeuw here.
Posts
-
RE: [MMM-Remote-Control](v2-dev) Extensible REST API, Dynamic Menus, and Socket Communications, plus other updates
-
RE: [MMM-Remote-Control](v2-dev) Extensible REST API, Dynamic Menus, and Socket Communications, plus other updates
Just replace related lines by the following ones (it’s approx. around line 610) into your node.js :
if (["MONITORTOGGLE", "MONITORSTATUS", "MONITORON"].indexOf(action) !== -1) { screenStatus = exec(monitorStatusCommand, opts, (error, stdout, stderr) => { if (stdout.indexOf("power status: standby") !== -1 || stdout.indexOf("false") !== -1) { // MODIF DONE HERE // Screen is OFF, turn it ON status = "off"; if (action === "MONITORTOGGLE" || action === "MONITORON") { exec(monitorOnCommand, opts, (error, stdout, stderr) => { this.checkForExecError(error, stdout, stderr, res, { monitor: "on" }); }); this.sendSocketNotification("USER_PRESENCE", true); return; } } else if (stdout.indexOf("power status: on") !== -1 || stdout.indexOf("true") !== -1) { // MODIF DONE HERE // Screen is ON, turn it OFF status = "on"; if (action === "MONITORTOGGLE") { this.monitorControl("MONITOROFF", opts, res); return; -
RE: MMM-GroveGestures
No, if it’s works by sending the request, it should work with Gesture also!
-
RE: [MMM-Remote-Control](v2-dev) Extensible REST API, Dynamic Menus, and Socket Communications, plus other updates
No. From my understanding, you only need to modify the customcommands into your config file not in the node.js.
The one you mention into your post (extract of node.js) are the default ones, don’t modify them.
What you need to modify into node.js are the ouput conditions as I posted above because the way the node.js is written (and how it’s explained on git) those commands will only work if your ouput are :
customCommand: { monitorOnCommand: 'shell command to turn on your monitor', monitorOffCommand: 'shell command to turn off your monitor', monitorStatusCommand: 'shell command to return status of monitor, must return either "HDMI" or "true" if screen is on; or "TV is Off" or "false" if it is off to be recognized' }That’s why we need to replace those conditions into the node.js by the one we get with our TV’s (which are different than the “true” / “flase” “TV is on” etc… but are “power status : stand by” and “power status: on”).
Clear now??
-
RE: [MMM-Remote-Control](v2-dev) Extensible REST API, Dynamic Menus, and Socket Communications, plus other updates
This is what I did on my side :
if (["MONITORTOGGLE", "MONITORSTATUS", "MONITORON"].indexOf(action) !== -1) { screenStatus = exec(monitorStatusCommand, opts, (error, stdout, stderr) => { if (stdout.indexOf("TV is off") !== -1 || stdout.indexOf("false") !== -1) { // REPLACE "TV is off" or "false" by "power status: standby" // Screen is OFF, turn it ON status = "off"; if (action === "MONITORTOGGLE" || action === "MONITORON") { exec(monitorOnCommand, opts, (error, stdout, stderr) => { this.checkForExecError(error, stdout, stderr, res, { monitor: "on" }); }); this.sendSocketNotification("USER_PRESENCE", true); return; } } else if (stdout.indexOf("HDMI") !== -1 || stdout.indexOf("true") !== -1) { // REPLACE "HDMI" OR "true" by "power status: on" // Screen is ON, turn it OFF status = "on"; if (action === "MONITORTOGGLE") { this.monitorControl("MONITOROFF", opts, res); return;At least this is what worked for me.
-
RE: [MMM-Remote-Control](v2-dev) Extensible REST API, Dynamic Menus, and Socket Communications, plus other updates
@Cr4z33 same as me…let’s try to cross check our node helper .js to see if they are written the same on line 610 and 620.
-
RE: [MMM-Remote-Control](v2-dev) Extensible REST API, Dynamic Menus, and Socket Communications, plus other updates
@Cr4z33
Strange, it worked for me… FMI, what output do you get in the terminal with “echo pow 0 | cec-client -s -d 1”.
When the screen is ON? When the screen is “OFF”? -
RE: MMM-GroveGestures
@Benjaminh86
Not really…“MONITORON” is already an action which is managed by MMM-REMOTECONTROL so you don’t need MMM-Notificationtrigger for that.
You just need MMM-GroveGesture to send it :
"UP": { notificationExec: { notification: "REMOTE_ACTION", payload: { action: "MONITORON", }, // you don't need to refer to a module name for the MONITORONN action (only necessary for HIDE and SHOW) }But you need to make sure that MMM-REMOTEControl is configured in the right way so that when it receives “MONITORON” it sends the right command (depending if you use HDMI, CEC, etc…)
Regards
-
RE: [MMM-Remote-Control](v2-dev) Extensible REST API, Dynamic Menus, and Socket Communications, plus other updates
@Cr4z33
So, the ouput you got in the terminal by sending the “pow 0” command is in line with what is written into node helper.js line 610 / 620? -
RE: [MMM-Remote-Control](v2-dev) Extensible REST API, Dynamic Menus, and Socket Communications, plus other updates
@Cr4z33
Make trials with your terminal :- Turn screen on by pasting that in your terminal : echo on 0 | cec-client -s -d 1
- Check the feedback status sent by the TV by putting that in terminal : echo pow 0 | cec-client -s -d 1
- Remind the result
Do exactly the same with turn off :
- Turn screen on by pasting that in your terminal : echo standby 0 | cec-client -s -d 1
- Check the feedback status sent by the TV by putting that in terminal : echo pow 0 | cec-client -s -d 1
- Remind the result
The 2 results you will get should be updated in node.js line 610 / 620.
-
RE: [MMM-Remote-Control](v2-dev) Extensible REST API, Dynamic Menus, and Socket Communications, plus other updates
@Cr4z33
Please check the output of echo pow when your screen is on and off.
The original setting related to screen status into the node.js was NOK for me. (indeed, it is something like “ON” / “OFF” / “HDMI” etc…) but my TV was answering with “power status: on” and “power status: standby”.
So I had to modify line 610 and 620 with my own.BTW, @shbatm , would be better if those parameters could be configurable also.
Regards
-
RE: [MMM-Remote-Control](v2-dev) Extensible REST API, Dynamic Menus, and Socket Communications, plus other updates
Hi @shbatm
I already asked this question on git issues on Jopyth’s version but I just figured out that you are the guy behind the custom menu!Would it be possible to have an action item for a menu?
I mean, when you click on the menu, it opens the menu but also as the ability to trigger an action.
Regards
-
RE: MMM-GroveGestures
Here is an extract of mine that should help you to understand. You just have to tweak the notification and pages based on your setup.
{ // 22 module: "MMM-GroveGestures", position: "top_right", config: { autoStart: true, //When Mirror starts, recognition will start. verbose:true, // If set as `true`, useful messages will be logged. recognitionTimeout: 1000, //Gesture sequence will be ended after this time from last recognized gesture. cancelGesture: "WAVE", //If set, You can cancel gesture sequence with this gesture. visible: true, //Recognized gesture sequence will be displayed on position idleTimer: "0", // `0` for disable, After this time from last gesture, onIdle will be executed. defaultCommandSet: "DEFAULT_MODE", commandSet: { "DEFAULT_MODE": { "LEFT": { notificationExec: { notification: "PAGE_INCREMENT", } }, "RIGHT": { notificationExec: { notification: "PAGE_DECREMENT", } }, }, "0": { // this corresponds to the page N° sent back by MMM-Pages "LEFT": { notificationExec: { notification: "PAGE_INCREMENT", } }, "RIGHT": { notificationExec: { notification: "PAGE_DECREMENT", } }, "UP": { notificationExec: { notification: "CALEXT2_SCENE_NEXT", payload: null, } }, "DOWN": { notificationExec: { notification: "CALEXT2_SCENE_PREVIOUS", payload: null, } }, }, "1": { "LEFT-RIGHT-LEFT": { notificationExec: { notification: "REMOTE_ACTION", payload: { action: "SHOW", module: "module_13_MMM-BackgroundSlideshow", }, } }, "RIGHT-LEFT-RIGHT": { notificationExec: { notification: "REMOTE_ACTION", payload: { action: "HIDE", module: "module_13_MMM-BackgroundSlideshow", }, } }, "UP-DOWN-UP": { notificationExec: { notification: "REMOTE_ACTION", payload: { action: "SHOW", module: "module_14_MMM-BackgroundSlideshowInfo", }, } }, "DOWN-UP-DOWN": { notificationExec: { notification: "REMOTE_ACTION", payload: { action: "HIDE", module: "module_14_MMM-BackgroundSlideshowInfo", }, } }, "LEFT": { notificationExec: { notification: "PAGE_INCREMENT", } }, "RIGHT": { notificationExec: { notification: "PAGE_DECREMENT", } }, "UP": { notificationExec: { notification: "ARTICLE_MORE_DETAILS", } }, "DOWN": { notificationExec: { notification: "ARTICLE_LESS_DETAILS", } }, "CLOCKWISE": { notificationExec: { notification: "BACKGROUNDSLIDESHOW_NEXT", } }, "ANTICLOCKWISE": { notificationExec: { notification: "ARTICLE_PREVIOUS", } }, }, "2": { "LEFT": { notificationExec: { notification: "PAGE_INCREMENT", } }, "RIGHT": { notificationExec: { notification: "PAGE_DECREMENT", } }, "UP": { notificationExec: { notification: "SWD_NEXT", } }, "DOWN": { notificationExec: { notification: "SWD_PREV", } }, "FORWARD-BACKWARD": { notificationExec: { notification: "SWD_PAUSE", } }, "BACKWARD-FORWARD": { notificationExec: { notification: "SWD_PLAY", } }, } }, commandSetTrigger: { "DEFAULT_MODE": "DEFAULT_MODE", "PAGE_NUMBER_IS": (payload) => { return payload } // this is what set the right command set based on MMM-Pages feedback "PAGE_NUMBER_IS" }, } }, { //22 module: "MMM-NotificationTrigger", config: { useWebhook: false, triggers: [ { // Is hiding the compliments module when newsfeed article is toggled fullscreen trigger: "ARTICLE_MORE_DETAILS", fires: [ { fire: "REMOTE_ACTION", payload: { action: "HIDE", module: "module_6_compliments", }, } ] }, { // Is showing the compliments module again when newsfeed is minimized. trigger: "ARTICLE_LESS_DETAILS", fires: [ { fire: "REMOTE_ACTION", payload: { action: "SHOW", module: "module_6_compliments", }, } ] }, { // Is triggering PAGE NUMBER NOTIFICATION when pages is changing trigger: "PAGE_DECREMENT", fires: [ { fire: "QUERY_PAGE_NUMBER", } ] }, { // Is triggering PAGE NUMBER NOTIFICATION when pages is changing trigger: "PAGE_INCREMENT", fires: [ { fire: "QUERY_PAGE_NUMBER", } ] }, { // Slideshow_Show. trigger: "SLIDESHOW_SHOW", fires: [ { fire: "REMOTE_ACTION", payload: { action: "SHOW", module: "module_13_MMM-BackgroundSlideshow", }, } ] }, { // Slideshow_Hide. trigger: "SLIDESHOW_HIDE", fires: [ { fire: "REMOTE_ACTION", payload: { action: "HIDE", module: "module_13_MMM-BackgroundSlideshow", }, } ] }, { // SlideshowInfo_Show. trigger: "SLIDESHOWINFO_SHOW", fires: [ { fire: "REMOTE_ACTION", payload: { action: "SHOW", module: "module_14_MMM-BackgroundSlideshowInfo", }, } ] }, { // SlideshowInfo_Hide. trigger: "SLIDESHOWINFO_HIDE", fires: [ { fire: "REMOTE_ACTION", payload: { action: "HIDE", module: "module_14_MMM-BackgroundSlideshowInfo", }, } ] }, { // Is showing the compliments module again when newsfeed is minimized. trigger: "ARTICLE_LESS_DETAILS", fires: [ { fire: "REMOTE_ACTION", payload: { action: "SHOW", module: "module_6_compliments", }, } ] }, { // AT START - Is hiding MMM-ImageSlideshow at start. trigger: "ALL_MODULES_STARTED", fires: [ { fire: "REMOTE_ACTION", payload: { action: "HIDE", module: "module_13_MMM-BackgroundSlideshow", }, }, { fire: "REMOTE_ACTION", payload: { action: "HIDE", module: "module_14_MMM-BackgroundSlideshowInfo", }, }, { fire: "QUERY_PAGE_NUMBER", }, { fire: "PAGE_INCREMENT", }, ] }, { // SHUTDONW - turns screen off and shutdown pi trigger: "SCREENOFFSHUTDOWN", fires: [ { fire: "REMOTE_ACTION", payload: { action: "MONITOROFF", }, }, { fire: "REMOTE_ACTION", payload: { action: "SHUTDOWN", }, }, ] } ] } }, -
Getting Google Contacts birthdays into Calendar
Hi,
For those interested in below issue solving :
-
Google Contact birth calendar doesn’t offer .ics so it’s impossible to get it automatically into MM calendar
-
I’ve wrote a quick google script that you can use as below :
1/ Create an empty personnal “birthday calendar” into Google Agenda (remind the ID of the calendar into calendar parameters for later)
2/ Create a new google script which you can store into your Google drive
3/ Paste below code into the script :
function Sync_Birth_Cal() { // Calendars adress (ID) var calendarSource = CalendarApp.getCalendarById("THE ID OF YOUR CONTACT CALENDAR"); var calendarDestination = CalendarApp.getCalendarById("THE ID OF THE CREATED CALENDAR"); // Start and End Date definition var Today = new Date(); var StartDeleteDate = new Date(); var EndDeleteDate = new Date(); var StartCopyDate = new Date(); var EndCopyDate = new Date(); StartDeleteDate.setDate(Today.getDate()-400); EndDeleteDate.setDate(Today.getDate()+400); StartCopyDate.setDate(Today.getDate()-360); EndCopyDate.setDate(Today.getDate()+360); // first deletes all datas in calendar var eventToDelete = calendarDestination.getEvents(StartDeleteDate, EndDeleteDate); for (var i = 0; i < eventToDelete.length; i++) { eventToDelete[i].deleteEvent(); } // then copy everything again var eventToCopy = calendarSource.getEvents(StartCopyDate, EndCopyDate); for (var t in eventToCopy){ var newEvent = calendarDestination.createEvent(eventToCopy[t].getTitle(), eventToCopy[t].getStartTime(), eventToCopy[t].getEndTime()); } }4/ Into Google script, Edit, Add trigger (choose the one you want, I personally choose to launch that one every 2 hours, but you can do whatever you want)
5/ You can know use the .ics path of the newly created calendar into your MM calendar
NOTE : it’s the first time I write that kind of stuff. It works for me until now, but there could be some bugs also. Let’s see.
NOTE 2 : be careful… part of the script is deleting calendars events on purpose… So don’t mess up…If needed, back up before.
Regards
-
-
RE: MMM-GroveGestures
@Benjaminh86
I will be able to do it later tonight as not at home for now.
Honestly, I clearly don’t have any knowledge at all neither, I just started MM 2 months ago and never touched to a Raspberry or Javascript or even text edit before…
Just by reading around on MM forums + the incredible community support, I managed it by playing around myself with different modules.
I’m still not an expert, but it works and I’m proud of myself!If you want to understand how it works yourself for purposes of proudness, I would recommend you to :
- Install MMM-Pages (config in config.js is easy)
- Install MMM-RemoteControl (appart from changing the IP adress at the top of your config.js, there is nothing else to do. This will allow you to send notification from your smartphone browser as a matter of testing. And when you will be comfortable, you will see that this will allow you to configurate your own smartphone command app for the mirror, it’s pretty powerful and simple)
- Install MMM-NotificationTrigger (basically, it works like that : if Notification A is received, please send notification B
Start to play with NotificationTrigger and MMM-Pages to do something like this :
- On your smartphone browser (after ahving installed MMM-RemoteControl and configured it) : send some notification like this to MMM-Pages and see if the pages changes :
http://YOURIP:8080/remote?action=NOTIFICATION¬ification=PAGE_INCREMENT""http://YOURIP:8080/remote?action=NOTIFICATION¬ification=PAGE_DECREMENT"Try to configure MMM-NotificationTrigger so that when “PAGE_INCREMENT” is received, it will fire “PAGE_QUERY_NUMBER” (to MMM-Pages that will then respond with “PAGE_NUMBER_IS” + payload “X”, X being the page number).
Try to configure MMM-NotificaitonTrigger so that when “PAGE_NUMBER_IS” is received (with payload), and alert is shown on the mirror with the returned Page Number as a payload.
Once you will have done that, you will have understand how everything works (you will be able to delete the alert shown on the message which was just a test).
If you manage to do that, the MMM-GroveGestures part in the end will be a piece of cake (and don’t worry, the above is not difficult at all if you want to learn by yourself).
I will try to post you a working extract of my config.js this evening. If I forget, please remind me.
Regards
-
RE: MMM-GroveGestures
Hi @Benjaminh86
If it can help you, this is how I’m dealing with it :
- I uses MMM-GroveGestures / MMM-Pages / MMM-Pages indicator / MMM-Notificationtrigger
MMM-Pages allows PAGE_INCREMENT / PAGE_DECREMENT notification reception.
MMM-Pages is allow able to send you the active page number back is you ask for QUERY_PAGE_NUMBER.So basically, in MMM-GroveGesture , I wanted specific gestures depending on the active page :
-
I’ve created one command set per page (1/2/3/4/5)
-
I’ve put PAGE_INCREMENT / DECREMENT as a default gesture (left / right) on all commands sets (as those one are always the same)
-
I’ve put specific up / down / etc… gestures and related notification in different commands set depending on the page.
-
I’ve added a specific fire into MMM-NotificationTrigger so that each time “PAGE INCREMENT / DECREMENT” is triggered, it also fires “PAGE NUMBER IS” back (thanks to “PAGE_QUERY_NUMBER”)
This way, MMM-GrovesGestures always knows on which page I’m and is using the proper command set.
Hope this will help you.
-
RE: MMM-CalendarExt2 not showing icons in calendar
@sworrs no problem.
I will try the debugging method proposed by @Sean this week and keep both of you posted. -
RE: Would this be possible?
Additional .css question :
I’m trying to get the MMM-Spotify module centered (when using a center region / area, it still displays on left side).
Could you please tell me how I should modify custom.css to do that?I don’t know if it’s linked to the spotify.css or the custom.css or if I need to modify the region into the main.css… Also I don’t know really which parameter I should tweak…
Thx already
-
RE: Would this be possible?
@Sean
OK, would be great (at least for my need). I will follow the git to be informed about the next update then. Thx. -
RE: Would this be possible?
@Sean
Hi,Still, would it be possible that MMM-Spotify sends notification when start playing and when end playing as I would like to hide some other modules when this one is playing?
Or is that also possible through .css?
Thx