Tuya security camera missing motion detected sensor

I have removed Tuya v2 integration and re-configured all my Tuya devices in HA 2021.11 in order to get latest core Tuya optimisations, which is working great! Finally the security ip web camera is supported and viewing and recording of the camera is now possible within HA! :slight_smile:

Yet, I noticed there doesn’t seem to be a sensor to indicate if any motion is detected. I can configure the device and enable or disable motion detection, but the motion detection itself doesn’t seem to be available.
Or is there some other way to get the actual motion detection trigger so I can add automation based on these detections?
Thx!

2 Likes

I just got a Tuya based (LSC) camera as well, and noticed the same. But I found a work around. Using the Tuya app you can use the indicator light to pass the detection trigger to HA

First we need to trigger if we detect motion. For this we go in to the Tuya app, and create a new automation scene. First you have to select your condition. At the bottom is the ‘When device status changes’ option. After that pick the camera you want to use, and then select ‘Motion Detected’ (twice).

Now we want this trigger to turn in to something that HA can understand. And (most of) the Tuya camera’s already got something for this (as if they knew we would need it some day). If you select the ‘Run the device’ option. Select the same camera again. Click on ‘Indicator’ and select On.

Now you can go back to HA. Here you can create a binary sensor based on the camera’s indicator state. Here you can also turn the indicator led back off, for the next motion detection to come in.

I also use some automations to enable and disable the motion detection along with my alarm, to prevent unnecessary notifications and data usage.

3 Likes

Great, thx for this tip! I did something similar by triggering another Tuya smart plug and reading that state in HA, but I didn’t realize you can play with it’s own indicator light too, which is a better approach!

I did the same with my bedroom light, and while writing the post based on that, the realization came I could use the indicator led instead

refer …Cheap Tuya based PIR Battery cameras - how to make them more usable with Home Assistant

look like someone may have added PIR

Thanks for your info. maybe it’s a solution for me.
Do you have an example for the binary sensor and an example of an automation?
Would be helpfull for me.

Of course, happy to help.

This is my binary sensor:

- platform: template
  sensors:
    woonkamer_camera_motion_detected:
      friendly_name: Woonkamer > Schouw Camera | Motion Detected
      value_template: >
        {% if is_state('switch.woonkamer_camera_motion_alarm', 'on') %}
          {{ is_state('light.woonkamer_camera_indicator_light', 'on') }}
        {% else %}
          Off
        {% endif %}

This will set the sensors state based on the indicator light state, if the motion alarm is on. If the motion alarm is off, the sensor state will also be off.

The automation below will turn the indicator light off after it’s been turned on by the scene within the tuya app. This is done to reset the state so it can be triggered again after the camera’s timeout has passed. (Internal timeout of the camera, not the 1 second in the automation)

# Motion Sensor Workaround
- id: woonkamer_schouw_camera_motion_detected
  alias: Woonkamer > Schouw Camera | Motion Detection Enabled
  description: ""
  trigger:
    - platform: device
      type: turned_on
      device_id: 6f7239c8e70201420fba1c64f42df6fc
      entity_id: light.woonkamer_camera_indicator_light
      domain: light
  condition:
    - condition: device
      type: is_on
      device_id: 6f7239c8e70201420fba1c64f42df6fc
      entity_id: switch.woonkamer_camera_motion_alarm
      domain: switch
  action:
    - delay:
        hours: 0
        minutes: 0
        seconds: 1
        milliseconds: 0
    - type: turn_off
      device_id: 6f7239c8e70201420fba1c64f42df6fc
      entity_id: light.woonkamer_camera_indicator_light
      domain: light
  mode: single

Note that this will give you a trigger, but the sensor will not give any duration or other attributes to work with. You can just use those trigger/condition entries to trigger for instance your alarm or light switches

Hi all,

i found solution.

In web config page go to notification card and select email notifications.
Then in node red insert EMAIL MTA node and set port to 25 (i use port 55 because have a problem with 25).

Go to cam config page and set email settings.

[{"id":"743c159c1c72a438","type":"e-mail mta","z":"6dacf3cdedfccbdd","name":"","port":"55","x":100,"y":40,"wires":[["de47b72428e1e0a5"]]},{"id":"8de6c28890c3e544","type":"debug","z":"6dacf3cdedfccbdd","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":530,"y":40,"wires":[]},{"id":"de47b72428e1e0a5","type":"switch","z":"6dacf3cdedfccbdd","name":"","property":"from","propertyType":"msg","rules":[{"t":"eq","v":"kamera1@local","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":230,"y":40,"wires":[["8de6c28890c3e544","050d1bdeaebbecba","b1785061ae6a7b86","5dec1065bfc675c8","b6e22baa9979e2cb"]]},{"id":"050d1bdeaebbecba","type":"api-call-service","z":"6dacf3cdedfccbdd","name":"Zapal halogen","server":"21558702.1482a8","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.halogen_na_dworze","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":560,"y":80,"wires":[["6622396260161aef","b2d7e90b4e9081f5"]]},{"id":"5384abaf0d5cf03c","type":"api-call-service","z":"6dacf3cdedfccbdd","name":"Zgaś halogen","server":"21558702.1482a8","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.halogen_na_dworze","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":320,"y":200,"wires":[[]]},{"id":"b1785061ae6a7b86","type":"delay","z":"6dacf3cdedfccbdd","name":"","pauseType":"delay","timeout":"30","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":140,"y":140,"wires":[["5384abaf0d5cf03c","26a53511993ddacb","0b39bb325edbb3dd"]]},{"id":"5dec1065bfc675c8","type":"api-call-service","z":"6dacf3cdedfccbdd","name":"Zapal wejście","server":"21558702.1482a8","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lampa_wejsciowa","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":560,"y":140,"wires":[[]]},{"id":"b6e22baa9979e2cb","type":"api-call-service","z":"6dacf3cdedfccbdd","name":"Zapal halogen","server":"21558702.1482a8","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lampy_na_tarasie","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":560,"y":200,"wires":[[]]},{"id":"26a53511993ddacb","type":"api-call-service","z":"6dacf3cdedfccbdd","name":"Zgaś wejście","server":"21558702.1482a8","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.lampa_wejsciowa","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":310,"y":260,"wires":[[]]},{"id":"0b39bb325edbb3dd","type":"api-call-service","z":"6dacf3cdedfccbdd","name":"Zgaś taras","server":"21558702.1482a8","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.lampy_na_tarasie","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":310,"y":320,"wires":[[]]},{"id":"21558702.1482a8","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

it works perfect for me!

because with the smart life scenes I could not select the indication light I took a different solution.

In the tuya cloud I selected a virtual sensor that I added with the smart life app.

It is called
Smart Home Pir Motion Sensor Switch/ir Remote Motion Sensor Light Switch
and can be found in motion switch.

Then I created a scene in the smart life app where the motion detected activates said virtual sensor.
After waiting a few seconds the scene should turn off the sensor again.

This sensor can be read from home assistant as a “switch” or you can change it to an alert where the switch becomes hidden (as in my example)

2 Likes

Hi

In my case, the automation scene not work with “Alarm (Humanoid detected)”, that condition does not trigger any event.
But the app Smart Life sends me notifications “Human Body Detected” and i can check the history in message center.
I don’t know if it will be a problem with the camera specifically or with the application and it will continue to happen even if I buy another camera from TUYA

does it happen to anyone?

2 Likes

totally same for me.

1 Like