MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Notifications and commands help please.

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    4 Posts 2 Posters 1.8k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Q Offline
      qwertyjon
      last edited by qwertyjon

      Hi all, I’m new here so be gentle. I’m by no means a coder or anything like that, however with plenty of tutorials and this awesome forum I’ve managed to get the majority of my mirror set up how I like it. My question is the notification system:

      I’m using pikrellcam to look after the camera on my Pi3, this can receive commands:

      echo "motion_enable on" > ~/pikrellcam/www/FIFO
      echo "motion_enable off" > ~/pikrellcam/www/FIFO
      

      My idea is to use MMM-NetworkScanner to ping my mobile, then broadcast the relevant command
      i.e. if I’m at home - turn motion detect off, when I go out - turn motion detect on.

      I can get it to ping my phone, and broadcast notifications, but I have no idea how to get it to issue commands - any ideas?

      Am I even going about this the right way?

      Thanks in advance, Jon.

      1 Reply Last reply Reply Quote 0
      • P Offline
        Privacywonk
        last edited by

        as part of the configuration file for MMM-NetworkScanner there is an “occupiedCMD” and “vacantCMD” that you could try setting with the command sequence above. I haven’t used this tool yet so I am unsure what sort of commands can be passed.

        Q 1 Reply Last reply Reply Quote 0
        • Q Offline
          qwertyjon @Privacywonk
          last edited by

          @Privacywonk Thanks for your idea, tried it today and it just comes up with ‘Please create a config file’.
          I tried putting the command inside { }, " ", and ’ '.

          Any other ideas?

          1 Reply Last reply Reply Quote 0
          • P Offline
            Privacywonk
            last edited by Privacywonk

            So I did some quick googling over coffee this morning. I think there is a two part suggestion for you. Please note, this will require research and testing which I have not done, this is just directional.

            1. Install MMM-RemoteControl - https://github.com/Jopyth/MMM-Remote-Control
            2. Add some custom code to the MMM-Remote-Control module to handle requests for turning on/off the motion device.

            In MMM-Remote-Control’s node_helper.js module, you can find the “MONITORON” code:

            if (query.action === "MONITORON")
            		{
            			exec("tvservice --preferred && sudo chvt 6 && sudo chvt 7", opts, function(error, stdout, stderr){ self.checkForExecError(error, stdout, stderr, res); });
            			return true;
            }
            

            Notes:

            • query.action defines a trigger word for the MMM-RemoteControl to listen for.
            • exec() - executes a command on the OS
            • The rest is for error checking that the external command executed.

            In your case, we could define the following:

            if (query.action === "MOTIONON")
            		{
            			exec("echo "motion_enable on" > ~/pikrellcam/www/FIFO", opts, function(error, stdout, stderr){ self.checkForExecError(error, stdout, stderr, res); });
            			return true;
            }
            
            if (query.action === "MOTIONOFF")
            		{
            			exec("echo "motion_enable off" > ~/pikrellcam/www/FIFO", opts, function(error, stdout, stderr){ self.checkForExecError(error, stdout, stderr, res); });
            			return true;
            }
            
            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy