Read the statement by Michael Teeuw here.
Profile switching API
-
@paviro response to reading the whole message back
I was under the impression that you could sync up multiple different module configurations based on a face or “code.” For example Billy’s face code tracks the weather in London while Sally’s tracks New York’s.
Response I was too lazy to re-write and only wrote reading the first sentance
I had a stupid idea to make my mirror have 5 base profiles i.e. a weather, default, news, etc. And, I was going to base that profiling off of your code if possible. Also I was wondering if I could use a command from a terminal to change profile so that I could hook it up to a phone or tablet via something like tasker using a ssh. If possible I would love to attempt it but if not than I’ll move that idea to the trash.
-
Furthermore, with some time browsing the forums I found this post
https://forum.magicmirror.builders/topic/10/multiple-layouts-configs
with you saying, “Different layouts based on facial recognition is already implemented here :slight_smile: It should be trivial to write something similar for the other use cases you just mentioned! Have a look at my code for an example.” While not outright saying it; it does sound something like different “profiles” that are able to be switched between.
-
It is but this thread is not about that module! Please go to this topic for that.
Update: I moved your posts to the correct topic, please check next time :) will post an example how to switch profiles later.
-
Okay sorry about that.
My first question is if I would be able to switch out layouts via a command in the Pi’s terminal or via an ssh. And, my second, if I can change layouts from a terminal, is how I would go about making the different layouts.
-
@00conman sure you could. Would be the same thing like I do in my module but you probably would need to serve an API you could then trigger via a terminal :)
-
@00conman it would be worth creating a module that has an API to switch “profiles”. It’s actually extremely doable. But I suggest you open a separate topic for this.
-
Okay I’ll look into it.
-
@00conman
Any progress on this? Facial recognition looks great, but I can’t get approval from my better half to put a camera in the bathroom mirror… Changing profiles using a physical button or a gesture would work perfectly. -
Just thinking out loud here, but you should be able to have a button that cycles through profiles. It might even be possible to use the current Button module (I forgot who wrote it), and use that. Set up a case switch to change profiles. Something sort of like this:
// Warning, pseudo code, will not run as-is var buttonCount = 0; var availableProfiles = 2; if (detect_button_press()) { buttonCount++; if (buttonCount > availableProfiles) buttonCount = 0; switch (buttonCount) { case 0: // Display profile for user 0 break; case 1: // Display profile for user 1 break; case 2: // Display profile for user 2 break; default: // Display default profile } }
Now you can push the button all day long. The only issue here is that you are cycling through the profiles, and for a household that has several, that can become a bit tedious.
Another possibility is to count button presses, so you would switch profiles based on how many times one pushed the button, but that too has its limitations. It works great for single-click, double-click, and possibly a long-press, but anything after that and it gets problematic again. Profile cycling is by far the easiest to implement.
-
@KirAsh4
Thanks for the quick response! I’ll take a look at the BUTTON module. Hopefully it’ll work the way I need it to. Fortunately, I only have 2 profiles I’ll need to cycle thru.