Scrypted 2024 update: Detection from Frigate

From my earlier post, we learned how to utilize Scrypted to forward a Frigate re stream to Homekit while having secured-video. Now, the current detection method written about was the built-in object detection, which, to say the least, wasn’t the best.

A list of items required to utilize Frigate’s detection and save a lot of CPU power:

  • The MQTT and “Dummy Switch” Plugins available in the plugin management interface.
  • The host information, and user information for your MQTT server.
  • MQTT-Explorer (optional)

Setting up your first MQTT “device”. Under the MQTT plugin, select “add new device” and select the motion-sensor.ts template.

Once you have opened the new device, say Back_Yard as in the example below, we will need to do two things. The first, is add the general subcription url, username, and password. Please note to do it in each device, as setting global subscription information caused this to not work in the current version of Scrypted.

The second is edit the template with frigate, the name of our camera, and the topic to listen to. I chose “motion” as i wanted all motion detections. That being said, you can use whichever detection topics you are already using. This can include people, cars, dogs, cats, etc. Utilizing MQTT-Explorer, you can get a visual of all of the different topics in your MQTT server.

mqtt.subscribe({
    // this example expects the device to publish either ON or OFF text values
    // to the mqtt endpoint.
    'frigate/back_yard/motion': value => {
        return device.motionDetected = value.text === 'ON';
    },
});

mqtt.handleTypes(ScryptedInterface.MotionSensor);

Once you have clicked the save icon for the script, you can hit the “play” icon. You should now go to the console to ensure you are connected before continuing (as shown below)

Now, to change the detection method, we must go to each camera, select the extetions, and select “custom motion sensor”. This will allow you to select your motion sensor you created with the MQTT plugin earlier.

Once you have selected this, remove your old Camera detection from the extention list for this camera, and go either send a “ON” topic with MQTT explorer, or go and walk in front of the camera to ensure that everything is working. You should be able to see inside your “event” explorer (pictured below) to ensure that everything is working correctly. If you have any issues, please feel free to post a comment and I will check when I can to assist!


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Appliance - Powered by TurnKey Linux