MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

LIRC AUTOMATION



  • 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)



  • @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



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



  • @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