Skip to content

Home Assistant integration

roleo edited this page Nov 6, 2022 · 9 revisions

tested on Home Assistant >= 2022.06

Custom integration

If you want to integrate your cam automagically, please visit this repo: https://github.com/roleoroleo/yi-hack_ha_integration

Auto-discovery

Release 0.1.4 introduced MQTT auto-discovery for Home Assistant, so the MQTT sensors will be available without any configuration of yaml files. You just need to enable mqtt on the camera. If the sensors don't appear on your dashboard you can find the camera under Settings -> devices and add them from there.

Access the web interface and go to the MQTT section, enable mqtt and set the server parameters (ip, port, authentication, etc...). Optionally set a name for the device under Home Assistant Discovery -> Name. For motion events to work on GK-200MP2-B and S-CAM cameras set Motion event location = 0. All other settings are optional, save configuration and reboot camera.

Screenshot of mqtt discovered device: mqttha

Manual integration

You can also manually configure sensors with the following yaml code. You probably want to configure a custom Topic prefix in the web interface if using these.

Motion Sensor:

mqtt:
binary_sensor:
- state_topic: "home-assistant/kitchen/motion_detection"
name: "Motion detection - kitchen"
payload_on: "motion_start"
payload_off: "motion_stop"
qos: 1

Camera that displays screenshots during a motion detection event:

mqtt:
camera:
- topic: "home-assistant/kitchen/motion_detection_image"
name: "Motion detection image - kitchen"

Image support

This hack implements a standard ONVIF interface, thanks to @KoynovStas - https://github.com/KoynovStas/onvif_srvd

Configure your cam using standard ONVIF integration in Home Assistant. RTSP stream and snapshot feature are supported. PTZ is also supported for models that have it.

Event detection

The only feature not present in ONVIF is the event detection. You can use the MQTT sensors for this purpose.