Read the statement by Michael Teeuw here.
MMM-Hotword (v2) - whole-new-built
-
@Sean Tks for your great work job.
I use hotword to do a lot of thing with smart mirror. But still have a problem bellow:
I’d like to setup a lock function that hide all modun bellow a background screen and waitting only 1 hotword to show it again
Everything seem OK. But when locked, other hotword to interactive with modules still effect in background and lock function can’t prevent this
My question is How to temporary disable all hotword until it unlocks again? Tks! -
@smarthome
Well, hiding/revealing mechanism is only to callhide/show
methods of target modules. During its hiding, what to be done or not will be the responsibility of that target module itself. If some module should be not working during hiding, it is the business of that module. -
@Sean
Is there any “while…do” structure for using “hotword”, if have, we can do this lock function that temporary disable hotword
for example, the hotword to work with MMM Assistant MK2 is “google”
the hotword to lock is “lock_now”, the hotword to unlock is “hello123”
hotword lock detect procedure is background running
The structure is:
while { (("hotword lock detect procedure" )not equal to "lock_now" ) && ("hotword lock detect procedure" )not equal to "unlock_now" ) } do { - setup hotword "google" to interactive MMM Assistant MK2 }
-
@smarthome
In some modules of mine (MMM-Clap and MMM-GroveGestures…) havecommandsMode or commandSet
for different command sets by condition, but not this. I think it could be considerable for your needs. But anyway, I’m quite busy nowadays, so cannot support it immediately. -
@Sean
Can I send double notificationExec to 2 Module with ony 1 hotword
1st to MMM Page-Selector
2nd to Assistant MK2 speaks about this action"open_news": { notificationExec: { notification: "PAGE_SELECT", payload:1 notification: "ASSISTANT_SAY", payload:"Open News page" restart:true, },
Also combine
"open_news": { notificationExec: { notification: {"PAGE_SELECT","ASSISTANT_SAY"} payload:(1,"Open News page"} }, restart:true, },
But in real test, only ASSISTANT_SAY can be executed
How can I do that for both?
Tks!
-
@smarthome
With onlynotificationExec
of MMM-Hotword, you can send only one notification.
There are 2 solutions.- Use
MMM-NotificationTrigger
, it can fire several notifications at a time by one trigger. - You can use
moduleExec
to call inner methods directly.
moduleExec: { module: [], exec: (module) => { if (module.name == "MMM-Page-Selector") { module.notificationRecieved("PAGE_SELECT", 1) } if (module.name == "MMM-AssistantMk2") { module.notificationRecieved("ASSISTANT_SAY", "Open News Page") } } }
(not tested code, but you can catch the concept. You can use
sendNotification
from sender module instead usingnotificationReceived
of target module)PS AMK2 has some TTS-like feature(ASSISTANT_SAY) but I recommend you to use dedicated TTS modules like MMM-TTS or MMM-GoogleTTS.
- Use
-
@Sean
1/Could you give me the code in MMM Notification Trigger2/Your code with ModuleExec didn’t work
3/I’m considering to use MMM TTS/Google TTS, but woud like to l try the simple solution first
-
{ module: "MMM-NotificationTrigger", config: { triggers:[ { trigger: "PAGE_SELECT_1", fires: [ { fire: "PAGE_SELECT", payload: (pl) => {return 1} }, { fire: "ASSISTANT_SAY", payload: (pl) => {return "ASSISTANT_SAY"} } ] } ] } },
PAGE_SELECT_1
from notificationExec of Hotword. -
@Sean
Your notification code didn’t work. Nothing happen :(
Could you check it again, plspayload: (payload) => { //OPTIONAL. transform received payload to what your target module wants.
You mean that: MMM Notification transform only, can not modify the payload then transform?
-
@smarthome
Well, check the log. and tell me whether suspicious logs be there.fire: "PAGE_SELECT", payload: (pl) => {return 1}
is equivalent to
.sendNotification("PAGE_SELECT", 1)
. whateverpl
would come, it will be transfomed(or modified, whatever you want to call) and the fired notification would have1
as payload.