Close

Evdev to the rescue

A project log for IR Everything

Multiple IR triggered creations with an IR blaster to make the magic happen

SeanSean 10/21/2021 at 21:261 Comment

With the driver's set to nec, reading multiple devices with evdev is almost trivial. I modified the evdev example code for reading multiple devices with asyncio and I can see which device recurve input and what that event is. With just a slight modification to that, I can filter events so that I only see events with type == 4 and command = 1032. This is the signal I get from my Blaster. A basic if else statement allows me to trigger different actions based on which device reads the event. This is my end goal. The code is almost done. All I have to do is test it with a print() command, then I can add in my smart light controls and call functions to change the lights instead of printing the device. The hard part of this project is done finally. 

There are a few caveats to this, which I might try to solve or I might just work around them. First, there's no guarantee currently that the same sensor will have the same device number on reboot. That's annoying since it means I would have to verify which sensor is which and potentially update the code before running it. I should be able to use udev rules to fix this. 

The second annoying caveat is that the nec drivers get disabled on reboot. I tried using a cron talk to re-enable them on reboot but it isn't working currently. I may spend some time trying to fix this if I get time later. Alternatively I can put a few lines into the command prompt each time the pi restarts. 

Next steps are to finalize the code, make and test the udev rules, and make extension cables for the sensors to check that they work with long cables and don't pick up each other's signals. I'll work on updating cron if I get the chance to, but getting everything else running is higher priority. 

Update: The code is done and tested. There's not enough to say for a whole log. It works exactly as expected. 

Discussions

Sean wrote 10/22/2021 at 14:59 point

Que bueno. No tuve planes de poner todas las detalles aquí, pero si quiere más información puedo explicar mejor. (Español no es mi primer lenguaje)

  Are you sure? yes | no