Navigation

    MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    MagicMirror² v2.15.0 is available! For more information about this release, check out this topic.

    LIRC AUTOMATION

    Development
    automation coding gpio lirc pir python sensor
    2
    4
    48
    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.
    • sranj
      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
        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

        sranj 1 Reply Last reply Reply Quote 0
        • sranj
          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
            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

            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 Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy