Tom-Hirschberger / MMM-GPIO-Notifications

Magic Mirror² Module which sends custom notifications based on GPIO events
MIT License
11 stars 3 forks source link

Keep screen on until no more motion is detected. #6

Closed Clintvd closed 1 year ago

Clintvd commented 1 year ago

Hi Tom,

First off all thank you for this guide, it's very helpful. This is more a question than an issue.

I have installed everything correctly and the pir sensor detects my motion and turns off the screen once the (delay) time has passed. So far everything good. But what I want is that the screen remains on until no motion is detected for x amount of time. I hope you can help me with this.

Thank you in advance.

Tom-Hirschberger commented 1 year ago

Hi,

great that you like the guide and the effort was worth it. If i understand correctly you configured MMM-GPIO-Notifications and MMM-Screen-Powersave-Notification, right?

You want your monitor to turn on if motion was detected, keep it on as long as motion is detected (within the delay of MMM-Screen-Powersave-Notification) and turn of the screen if no more motion was detected within the delay, right?

This should be the case if you followed the guide.

Could be please post the two configuration blocks? Did you configure the delay within MMM-GPIO-Notifications or/and MMM-Screen-Powersave-Notification?

Clintvd commented 1 year ago

Hi,

I have set the delay on 30 seconds ( for testing purpose). The thing is, after 30 seconds the screen goes dark and if no further movement is detected it stays dark which is good but when i'm still in front of the sensor(and moving) it goes dark and turns back on again. I could just increase the delay time but my idea was that the mirror goes on and stays on until there is no one in front of it.

My modules below.

module: 'MMM-GPIO-Notifications', config: { '4': { gpio_state: 1, gpio_debounce: 0, delay: 30000, notifications: [ { notification: 'SCREEN_ON', payload: { 'forced': false } }, module: 'MMM-Screen-Powersave-Notification', config: { delay: 30, }\

Tom-Hirschberger commented 1 year ago

Hi,

it looks like you configured the wrong delay (or better let say the the howto is not very good at this point). The delay of the Gpio module causes triggers of the sensor to be ignored for a specific amount of time. The delay of the Screensave module configures how long the screen stays active if no more activity was detected. So you simply need to set the delay of GPIO to a lower value (say 5000ms)...

    { 
        module: 'MMM-GPIO-Notifications',
        config: {
            '4': {
                gpio_state: 1,
                gpio_debounce: 0,
                delay: 5000,
                notifications: [
                    { 
                        notification: 'SCREEN_ON', 
                        payload: { 'forced': false }
                    },
                ]
            }
        }
    },

The Screen will be turned off if no movement has been detected within 45 seconds in this example:

    {
        module: 'MMM-Screen-Powersave-Notification',
        config: {
            delay: 45
        }
    },

Edit: I updated the examples to make this point more clear

Tom-Hirschberger commented 1 year ago

Did this solve your issue?

Clintvd commented 1 year ago

Hi Tom,

It did! Thank you :D .