TP-Link VIGI Camera Lights

Hopefully this is in the correct section.

I found the floodlight toggle switch available on my Reolink cameras incredibly useful, so I have (to some extent) implemented something similar for the VIGI cameras.

I’ve created this python script that allows controlling the white LEDs. It connects to an MQTT broker for control, and takes in a config file for the broker credentials and camera information.

An configuration file with two cameras could look as such:

{
    "mqtt_host": "10.0.0.50",
    "mqtt_username": "MQTTUN",
    "mqtt_password": "MQTTPW",
    "cameras": [
        {
            "name": "front_door",
            "ip": "10.0.0.21",
            "username": "CAMUN",
            "password": "CAMPW"
        },
        {
            "name": "driveway",
            "ip": "10.0.0.22",
            "username": "CAMUN",
            "password": "CAMPW"
        }
}

The script automatically retrieves login tokens and will re-authenticate when they expire.

For each camera specified in config.json, the script will subscribe to the topic vigi_leds/{name}/mode - publish ‘on’ on this topic to turn the white lights on, and ‘off’ (or any other string) to turn them back off. I use a few helper toggles and an automation on the HA side for this.

The script works by changing two settings on the camera - to turn the white LEDs on, it changes the illuminator mode to ‘always on’ and changes the night vision mode to ‘white light’. To turn the LEDs back off, it changes the illuminator mode back to automatic and the night vision mode back to infrared.

The script is licensed under the GPLv3, and may be redistributed or changed with attribution. I know this isn’t particularly elegant or efficient, but it works for my purposes and I hope it can be of use to others as well.