Sure, I will post all the automation’s i have tried.
- id: '1573838226495'
alias: Line Crossed
description: ''
trigger:
- entity_id: binary_sensor.study_camera_line_crossing
from: 'off'
platform: state
to: 'on'
condition: []
action:
- data:
caption: Motion Detected
disable_notification: false
target: '[Telegram Group ID]'
url: http://user:[email protected]/ISAPI/Streaming/channels/101/picture
service: telegram_bot.send_photo
- id: '1574335919858'
alias: Line Crossed 02
description: ''
trigger:
- entity_id: binary_sensor.study_camera_line_crossing
from: 'off'
platform: state
to: 'on'
condition: []
action:
- data:
entity_id: camera.study_camera
filename: /share/security/studyCam/studycam_{{ now ().year }}_{{ now().month}}_{{now().day
}}_{{ now ().hour }}_{{ now ().minute }}.jpg
service: camera.snapshot
- data:
caption: Motion Detected
disable_notification: false
file: /share/security/studyCam/studycam_{{ now ().year }}_{{ now ().month}}_{{now().day
}}_{{ now ().hour }}_{{ now ().minute }}.jpg
target: '[Telegram Group ID]'
service: telegram_bot.send_photo
- id: '1574356580433'
alias: Line Crossing 3
description: ''
trigger:
- entity_id: binary_sensor.study_camera_line_crossing
from: 'off'
platform: state
to: 'on'
condition: []
action:
- data:
data:
photo:
- caption: Motion Detected
url: http://user:[email protected]/ISAPI/Streaming/channels/101/picture
message: Motion Detected
service: notify.telegram_notifications
Below is the setup of the components.
Notifications:
telegram_bot:
- platform: webhooks
api_key: [API Key]
parse_mode: html
allowed_chat_ids:
- '[Telegram Group ID]'
notify:
- name: telegram_notifications
platform: telegram
chat_id: '[Telegram Group ID]'
Motion Sensor
binary_sensor:
- platform: hikvision
host: 10.0.0.21
username: user
password: pass
name: Study Camera
customize:
field_detection:
delay: 10
line_crossing:
delay: 10
Camera (This is the current config, but i have tried many variations)
camera:
- platform: generic
name: Study Camera
still_image_url: http://user:pass10.0.0.21/ISAPI/Streaming/channels/101/picture
stream_source: "rtsp://user:[email protected]:554/Streaming/Channels/102"
authentication: digest
username: user
password: pass
verify_ssl: false
content_type: image/png
I also have the current setup in NodeRed
[{"id":"d58d235f.601db","type":"chatbot-telegram-send","z":"47b53e8c.3fa31","bot":"3a5b5d6b.5c5192","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":1010,"y":200,"wires":[]},{"id":"2c674204.4ba82e","type":"chatbot-conversation","z":"47b53e8c.3fa31","name":"Start Conversation","botDevelopment":"3a5b5d6b.5c5192","botProduction":"","chatId":"xxxxxxx","userId":"","transport":"telegram","store":"","x":350,"y":200,"wires":[["ae30f562.9a97f8","c78bb7fd.805768","bdfad32b.66c2a"]]},{"id":"ae30f562.9a97f8","type":"http request","z":"47b53e8c.3fa31","name":"","method":"GET","ret":"bin","paytoqs":false,"url":"http://10.0.0.21/ISAPI/Streaming/channels/101/picture","tls":"","persist":false,"proxy":"","authType":"digest","x":590,"y":200,"wires":[["6dc6ab5e.b079f4"]]},{"id":"6dc6ab5e.b079f4","type":"chatbot-image","z":"47b53e8c.3fa31","name":"","filename":"","image":"","caption":"","x":790,"y":200,"wires":[["d58d235f.601db"]]},{"id":"c78bb7fd.805768","type":"chatbot-waiting","z":"47b53e8c.3fa31","waitingType":"upload_photo","x":680,"y":280,"wires":[["d58d235f.601db"]]},{"id":"bdfad32b.66c2a","type":"debug","z":"47b53e8c.3fa31","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":450,"y":300,"wires":[]},{"id":"85ce3687.490308","type":"server-state-changed","z":"47b53e8c.3fa31","name":"Line Crossing","server":"5fe5263.a1c9fd8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.study_camera_line_crossing","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"x":90,"y":200,"wires":[["bdfad32b.66c2a","2c674204.4ba82e"],[]]},{"id":"6b1f46b4.84ebb8","type":"inject","z":"47b53e8c.3fa31","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":300,"wires":[["2c674204.4ba82e"]]},{"id":"3a5b5d6b.5c5192","type":"chatbot-telegram-node","z":"","botname":"DEV","usernames":"xxxxxxx","providerToken":"","polling":"300","store":"","log":"","parseMode":"","debug":false,"webHook":"","connectMode":"polling"},{"id":"5fe5263.a1c9fd8","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true}]
Each one of these work 100% when I trigger them manually. It is only when actual motion is detected that it fails about 80% of the time. Below is a screenshot of the motion triggers in HA, a total of 36 triggers in the passed 30 minutes. (Thanks to the spider making a web around the camera). Out of these 36 triggers I received 4 notifications on telegram.