Read the statement by Michael Teeuw here.
[MMM-Buttons] Connect multiple buttons to send configurable notifications
-
@Mar Well its not, as if it were documented anywhere in my readme. :( Should probably add this somewhere.
How long are you pressing the button? For a very short time? Note, that if the press is longer than 500ms it will not be registered as a (short) press (it is the
maxShortPressTime
and can be configured).If this is not the case, I am sorry, but I have no real idea how to fix it, without having the same situation on my Pi.
-
@Jopyth I thought this also, and set the short time from 0-1000ms and still will only register the second of a double click.
Its very consistent though, i can get it to work 100% of the time with a double click like opening a folder on the computer. one click doesnt do anything, and I don’t believe the longPress worked at all (But i wasnt using it so not that bothered with it).
Maybe its just the buttons…i just dont have anything else around that i could use to test as a button.
-
@Jopyth Just tested with buttons ripped out from an old monitor and same issue, needed to double click. I suppose i will slowly go through the code and try break it down and see. any advice on which functions to start with?
-
@Jopyth Fixed!! I switched the 1 and the 0 in the watchHandler function of node_helper.js and solved the issue. Must have been backwards with how the button was being interpreted vs set up?
Put the 0 first, then 1.
Now the double click makes sense, the time between the clicks seems to have been what was counted as a valid min press time.
-
@Jopyth Anyway to use one button to switch between profiles? Trying to use profile switches classes and creating the same button on different profiles (classes) but it always runs both buttons so take me back to the default page.
-
@Mar Glad you got it work. :) Did you switch back to the default (regarding the 0 and 1)? Or is it now different than in the main code? Not yet possible to switch between multiple profiles. Could maybe be implemented as an array of notification definitions, instead of a single notification definition and then it cycles through these notifications on each press?
-
@Jopyth No i had to switch the 1 and the 0 to make it work (0 first, then 1) so my code does differ slightly unfortunately. Suppose I’ll have to remember to manually make the change on updates unless it can be made a config option.
That could be a good option. We’d need a way for profile switcher to send over all unique profiles which would make it easy to do, rather than scrape the config file for “classes”.edit: Though I suppose thinking about this not relying on another module would be much quicker fix.
-
What if I want to send an alert show display message when the GPIO port is ON? I mean, is not like a switch that closes the GPIO port, is when you programatically send an outoput GPIO signal to close (lets say a relay). Is there any changes necessary? I can´t make it happen.
{ module: 'MMM-Buttons', config: { buttons: [ { pin: 17, name: "rele", longPress: { title: "Rele longpress", message: 'El rele esta siendo pulsado largo', imageFA: 'power-off', notification: 'SHOW_ALERT', payload: { type: 'notification', title: 'Alerta rele pulsado largo' } }, shortPress: { title: "Rele shortress", message: 'El rele esta siendo pulsado corto', imageFA: 'power-on', notification: 'SHOW_ALERT', payload: { type: 'notification', title: 'Alerta rele pulsado largo' } } } ] } //del config },
-
Anyone have an example of a switching profile using Buttons + ProfileSwitcher ?
-
{ module: 'MMM-ProfileSwitcher', config: { includeEveryoneToDefault: true, ignoreModules: ["alert", "updatenotification"], enterMessages: false, leaveMessages: false, defaultTime: 15000, timers: { "PAGE2":{profile:"default"}, //Switch to defaultClass after defaultTime } } }, { module: 'MMM-Buttons', minShortPressTime: 0, maxShortPressTime: 1000, minLongPressTime: 3000, config: { buttons: [ { pin:23, name: "change_profile_1", longPress: undefined, shortPress: { notification: "CURRENT_PROFILE", payload: "PAGE2" } }, { pin: 22, name: "change_profile_2", longPress: undefined, shortPress: { notification: "CURRENT_PROFILE", payload: "default" } } ] } },