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.

    LIRC AUTOMATION

    Scheduled Pinned Locked Moved Development
    automationcodinggpiolircpirpythonsensor
    4 Posts 2 Posters 793 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.
    • sranjS Offline
      sranj
      last edited by sranj

      Hi! I’m relatively new to the world of python and I’ve been learning a lot. I’m coding on a raspberry pi and my goal here is to make a PIR Sensor trigger my IR transmitter to turn on a tv. Currently, if I enter the command “irsend SEND_ONCE SAMSUNG_AA59-00600A_POWER KEY_POWER” it triggers the tv to turn on or off. I know it’s a lot to ask but can anyone give me any sort of direction in coding on how to automate this command or something like that so that it is triggered by the motion sensor and then triggered again after 2 minutes?

      (PIR Sensor is wired to GPIO 4 and the IR Transmitter is wired to GPIO 8 )

      (I posted this recently but felt I did not word it correctly)

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @sranj
        last edited by sdetweil

        @sranj I can’t tell u how to do it, but if u look at the MMM-PIR modules you should see python coding to detect motion on the PIR gpio pins, or nodejs code to do same, and launch python pgms in the background to do whatever.

        or search the forums here for python and gpio, and Google search python pir

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        sranjS 1 Reply Last reply Reply Quote 0
        • sranjS Offline
          sranj @sdetweil
          last edited by

          @sdetweil I already have the pir module all set and that works well, just want it to trigger the ir transmitter

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @sranj
            last edited by sdetweil

            @sranj ok, so u receive the trigger in the node_helper, and need to launch/exec/spawn your python pgm

            so you need the child_process library
            https://nodejs.org/en/knowledge/child-processes/how-to-spawn-a-child-process/

            PIR uses the same library to launch the tvservice command, or vgencmd to blank the screen

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            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
              OSZAR »