<< return to Vizycam.com

Control of IR Cut filter with libcamera on IMX477 camera

I am working on getting vizy integrated with HomeAssistant.

Some good progress with getting the stream going (happy to write up a full guide)…
using:

  • RaspberryPi OS bullseye 64bit
  • setting up RTSP stream with mediamtx
  • importing RTSP stream with “Stream” integration in HA

So far,so good…

But I am not sure how to control the IR cut filter using standard raspberry pi tools.

In vizy, the IR cut filter is wired to the power board, is that just a GPIO pin passthrough or do we need to use a specific command to control the filter?

Is it possible to control the filter when not running vizy-server?

Ah, think I see what to do… can use the github repo and run the setup.py (I don’t need all the packages in install.sh…

Will try and report back.

Hopefully will be able to just control Filter and infrared LEDs via some simple python calls…

I’ve done some integration of Vizy with HomeAssistant (mostly status and simple commands back and forth).

If you can do what you want from a python script on the Vizy, then it’s possible to send MQTT messages from HomeAssitant as inputs to that script. It’s a little fiddly to get working though. I wonder if there’s an easier way.

In any case, I’d be interested in your results. I haven’t tried to update the Raspberry Pi OS yet, and haven’t attempted to integrate the video stream with HomeAssistant either.

After a fair bit of mucking around, I got this mostly working.

The part that was a bit tricky was getting the power board management tools up.

Here’s a quick summary, but will write up a fuller guide…

  1. install bullseye 64bit and mediamtx
  2. will also need to publish a thumbnail to raspi nginx server
  3. set up Homeassistant with generic camera input
  4. make sure to enable i2c in rapi-config (off by default)
  5. download the vizypowerboard.py
  6. create new virtualenv and make sure that smbus and wiringpi are installed with pip
  7. test from python shell
from vizypowerboard import *
power_board = VizyPowerBoard()

# test buzzer
power_board.buzzer(2000,500)

## turn on/off external IR light
power_board.vcc12(True)
power_board.vcc12(False)

# filter turn off/on
power_board.ir_filter(False)
power_board.ir_filter(True)

# set power to always on
power_board.dip_switches(DIPSWITCH_POWER_DEFAULT_ON)

So, looks good to control the power board with Bullseye. I also tried compiling some of the other libs but got stuck on kcamera. I thought I may need that but it’s not required for the power board control.

Now just a few small tweaks to do

  • start mediamtx process on boot
  • write some python scripts to execute from HA (e.g. switch filter on/off)
  • work out why I have so much infrared spill into the camera from the front light!
  • get motion going too for motion detection/automated recording
1 Like

Wow - great info and thanks for posting!

I’m going to add this to my todo list and I’d be grateful if you’re able to add any more detail.

Thanks again!