balassy / MMM-ModuleToggleButton

MagicMirror module that allows displaying and hiding modules when a hardware button is pushed.
MIT License
6 stars 3 forks source link

Mutliple MMM-ToggleButtons #3

Open JonoGee opened 5 years ago

JonoGee commented 5 years ago

Good afternoon all, On my mirror I am going to build in a semi hidden button in the frame made of the same material that hides modules so it is just a mirror without any distraction. I have set this up perfectly and works lovely. However, I would like to add a second Toggle Button on a different GPIO pin Number to hide a different selection of modules.

When I had a second ToggleButton module to the config file with a diferent Pin, neither of the buttons work. I have included code below...

` { module: 'MMM-ModuleToggleButton', config: { buttonGpioPin: 6, moduleNames: [ 'clock', 'calendar', 'MMM-PushBulletNotifications', 'MMM-page-indicator', 'newsfeed', 'compliments', 'currentweather', 'weatherforecast', 'MMM-AlexaPi', 'MMM-GoogleTasks', 'MMM-History', 'MMM-CountDown', 'MMM-Spotify', 'internet-monitor', 'MMM-portscan', 'MMM-network-signal', 'MMM-BackgroundSlideshow', 'MMM-SystemStats', ] } },

// { // module: 'MMM-ModuleToggleButton', // config: { // buttonGpioPin: 26, // moduleNames: [ // 'clock', // 'MMM-BackgroundSlideshow', // // ] // } // }, `

Can anybody tell me if this is possible or where I am going wrong. THanks in advance.

JonoGee commented 5 years ago

In case it helps these are three optional states of the mirror I am trying to achieve.

  1. Completely Blank.
  2. All modules and background displayed.
  3. Only clock and Background image displayed like a photoframe.

Cheers

balassy commented 5 years ago

Hello @JonoGee, Thanks for using this module and very sorry for your inconvenience. Honestly, I've never tested this module with multiple buttons (maybe that's why I named it singular, not plural ;-)), and checking the code it seems that it is not possible today.

However if you are open to do some manual hacking these steps may work (not tested):

  1. Duplicate and rename the MMM-ModuleToggleButton folder within your mirror's modules folder (e.g. MMM-ModuleToggleButton2).
  2. In your mirror's config refer to one of the modules with the new folder name.
  3. In the new folder in both node_helper.js and MMM-ModuleToggleButton.js change the values TOGGLE_BUTTON_PRESSED and TOGGLE_BUTTON_CONFIG to a new value (e.g. TOGGLE_BUTTON_2_PRESSED and TOGGLE_BUTTON_2_CONFIG).

I'm not sure it will work, but it can be a quick hack. Please let me know.

I'm saving this issue as a feature request.

JonoGee commented 5 years ago

You’re rock n roll man!! Thankyou for taking the time to get back to me. I will certainly try that out. I did kinda try but I lost the plot and got myself really confused when neither button would work. I’ll follow your guidelines and if I have any success tweaking I’ll be sure to share. Have a great evening.

Regards Jonathan Gee

Sent from my iPhone

On 15 Jun 2019, at 09:11, György Balássy notifications@github.com<mailto:notifications@github.com> wrote:

Hello @JonoGeehttps://github.com/JonoGee, Thanks for using this module and very sorry for your inconvenience. Honestly, I've never tested this module with multiple buttons (maybe that's why I named it singular, not plural ;-)), and checking the code it seems that it is not possible today.

However if you are open to do some manual hacking these steps may work (not tested):

  1. Duplicate and rename the MMM-ModuleToggleButton folder within your mirror's modules folder (e.g. MMM-ModuleToggleButton2).
  2. In your mirror's config refer to one of the modules with the new folder name.
  3. In the new folder in both node_helper.js and MMM-ModuleToggleButton.js change the values TOGGLE_BUTTON_PRESSED and TOGGLE_BUTTON_CONFIG to a new value (e.g. TOGGLE_BUTTON_2_PRESSED and TOGGLE_BUTTON_2_CONFIG).

I'm not sure it will work, but it can be a quick hack. Please let me know.

I'm saving this issue as a feature request.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/balassy/MMM-ModuleToggleButton/issues/3?email_source=notifications&email_token=AMGMOWERIL4F6MJW47S42ELP2SP43A5CNFSM4HXZMXMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXYS7EY#issuecomment-502345619, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AMGMOWCYIKJ3LVQTV6N52JDP2SP43ANCNFSM4HXZMXMA.