how to get HA to pull an image from BI and send to my Telegram?

tung256

Getting the hang of it
Joined
Feb 3, 2017
Messages
121
Reaction score
30
i found this URL works to grab and image and display on browser: how can i make it work to send to my Telegram? i thought this would work but it does not:
Code:
alias: test blue iris send photos
trigger:
  - platform: time
    at: "23:00:00"
action:
  - data:
      url: http://admin:pass123@192.168.1.121:81/image/garage?s=50
      caption: park space in garage
    service: telegram_bot.send_photo
mode: single
 

kjinxx2

Pulling my weight
Joined
Dec 1, 2020
Messages
155
Reaction score
215
Location
USA
Typically you would list the service and then data second - this may just be presentational and I haven't tested it but I would expect

YAML:
alias: test blue iris send photos
trigger:
  - platform: time
    at: "23:00:00"
action:
  - service: telegram_bot.send_photo
    data:
      url: http://admin:pass123@192.168.1.121:81/image/garage?s=50
      caption: park space in garage
mode: single
Also - is that URL actually returning just an image or is the camera serving up a webpage (some index.html or something) which contains the image? Maybe navigate to the URL and use developer tools to ensure the URL of the image.
 

tung256

Getting the hang of it
Joined
Feb 3, 2017
Messages
121
Reaction score
30
One of the abilities of the Action Set is to take a snapshot, then the next could be to use curl with parameters to locate that snapshot and send it via Telegram.
OK. that's pretty good but sometimes i dont want to send via alerts from BI. sometimes i wanna know if there is space in my front yard. for example, this one is working great with my Amcrest NVR to check if there is space in the front yard:

Code:
alias: telegram Park  send photo from front camera
trigger:
  - platform: event
    event_type: telegram_command
    event_data:
      command: /park
action:
  - data:
      url: http://192.168.1.90/cgi-bin/snapshot.cgi?channel=2
      authentication: digest
      username: admin
      password: pass123
    service: telegram_bot.send_photo
mode: single
doing the same thing with BI nvr does not work off course...
 

tung256

Getting the hang of it
Joined
Feb 3, 2017
Messages
121
Reaction score
30
Also - is that URL actually returning just an image or is the camera serving up a webpage (some index.html or something) which contains the image? Maybe navigate to the URL and use developer tools to ensure the URL of the image.
im not sure what you are asking but this is what i see when i copy and paste into Firefox:
1724208223419.png
 

kjinxx2

Pulling my weight
Joined
Dec 1, 2020
Messages
155
Reaction score
215
Location
USA
im not sure what you are asking but this is what i see when i copy and paste into Firefox:
View attachment 201585
I don't think you actually have a URL to an image - I think you have a URL to a webpage that is displaying an image... so you'd have to figure out what the actual URL of the image is (which may be complicated).. let me think if there would be a better solution using HA and maybe NodeRed. What type of camera are you using?
 

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
18,541
Reaction score
43,612
Location
Alabama
OK. that's pretty good but sometimes i dont want to send via alerts from BI. sometimes i wanna know if there is space in my front yard. for example, this one is working great with my Amcrest NVR to check if there is space in the front yard:

doing the same thing with BI nvr does not work off course...
Of course it'll work with BI but with a different URL as below. Have you looked in BI's built-in "Help" under "Administration" => "HTTP Interface" ?

If you issue this HTTP command below with a browser, it will place a snapshot in BI's "New" folder (as configured with my BI). To include the BI server's authentication in the URL, go to BI's "Settings" => "Web Server" => "Advanced" and UNcheck "use secure session keys and login page"
Code:
http://BI-user:BI-password@BI-server-IP:BI-port/admin?camera=x&snapshot
(X = camera shortname)

For example, this works with my BI and places a snapshot in BI's "New" folder:
Code:
http://BI-user:BI-password@192.168.200.250:81/admin?camera=Cam57&snapshot
 

tung256

Getting the hang of it
Joined
Feb 3, 2017
Messages
121
Reaction score
30
For example, this works with my BI and places a snapshot in BI's "New" folder:
Code:
http://BI-user:BI-password@192.168.200.250:81/admin?camera=Cam57&snapshot
this partially works for me. if i run in my Firefox, i see this in the browser
1724263244525.png
BI program auto opens the JPG screenshot.
and it is also present in the NEW folder as you mentioned
1724263294923.png


running the automation in HA also create the JPG file but i dont get the Telegram photo on my phone though :(
1724263431650.png

and this is the Advanced settings. I unchecked the box as you recommended.
1724263580940.png
 

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
18,541
Reaction score
43,612
Location
Alabama
this partially works for me. if i run in my Firefox, i see this in the browser

BI program auto opens the JPG screenshot.
and it is also present in the NEW folder as you mentioned

running the automation in HA also create the JPG file but i dont get the Telegram photo on my phone though :(
Maybe because the HA script doesn't contain the path and or file name of the snapshot that it's supposed to send via Telegram ?
I don't use HA or Telegram so.....:idk:
 

kjinxx2

Pulling my weight
Joined
Dec 1, 2020
Messages
155
Reaction score
215
Location
USA
Maybe because the HA script doesn't contain the path and or file name of the snapshot that it's supposed to send via Telegram ?
I don't use HA or Telegram so.....:idk:
Yes this is exactly right - OP needs to figure out how to either transmit the actual path of the image to HA or transmit the image itself to HA where it can save it locally and transmit to Telegram. I was hoping OP would provide information about his camera so that I could see if there was any way to directly access through HA.

Since it seems that OP just wants a picture sent to telegram every day at 11PM, why not just set blue iris up to trigger an alert w/ snapshot every day at that time?
 

tung256

Getting the hang of it
Joined
Feb 3, 2017
Messages
121
Reaction score
30
Since it seems that OP just wants a picture sent to telegram every day at 11PM, why not just set blue iris up to trigger an alert w/ snapshot every day at that time?
im using a mix of cameras with RTSP and ONVIF.
first up is Tapo: rtsp:/administrator:pass23@192.168.1.197:554/stream1
reolink: rtsp:/admin:pass123@192.168.1.114/h265Preview_01_main
lorex: rtsp:/admin:pass@192.168.1.147:554/cam/realmonitor?channel=1&subtype=0
eufy: rtsp:/admin:pass@192.168.1.149/live0
galayou rtsp:/admin:pass@192.168.1.150:554/live/ch0
amcrest: rtsp:/admin:pass23@192.168.1.27:554

11pm was just an example. easy trigger.
usually i send a msg via Telegram to HA. HA then grab image from amcrest nvr and sends back to Telegram. here's the full yml code working great with an Amcrest NVR:
1724285708791.png


this method should work perfectly fine [tool] Receive Blue Iris Alert Images/Videos on Telegram
BUT for some reason that small TUT program is having a hard time posting the new image to my Telegram account. :( i feel im veryyy close
 

tung256

Getting the hang of it
Joined
Feb 3, 2017
Messages
121
Reaction score
30
@TonyR
when i run this command "http://BI-user:BI-password@BI-server-IP:BI-port/admin?camera=x&snapshot" it puts the JPG file in the NEW folder of my BI machine
how to put the JPG file in my HA machine that has a shared folder on the network? i dont see any option in BI to change snapshot to specific folder like this \\192.168.1.229\config\www\media
i googled and found this Snapshot saved to folder. but looks like the UI in BI has changed
 

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
18,541
Reaction score
43,612
Location
Alabama
i dont see any option in BI to change snapshot to specific folder like this \\192.168.1.229\config\www\media
Using Windows Explorer first create the "Snap" folder nested in the \BlueIris folder ("\BlueIris\Snap")
Then create the folder in BI "Settings" => "Clips and Archiving" as the image below.

BI-snap-Cam57_clips.jpg

Then in the "camera settings" => "Alert" for your camera for the snapshot configure as in the image below.

BI-snap-Cam57.jpg

When you send the HTTP snapshot command however you send it, either manually using a browser or having BI send it periodically in an alert Action Set, the snapshot will appear in the "Snap" folder and it will overwrite the existing snapshot with the latest one. It will be named "&CAM.jpg" with "&CAM" being the camera's short name such as "Cam57.jpg".
 

tung256

Getting the hang of it
Joined
Feb 3, 2017
Messages
121
Reaction score
30
Using Windows Explorer first create the "Snap" folder nested in the \BlueIris folder ("\BlueIris\Snap")
Then create the folder in BI "Settings" => "Clips and Archiving" as the image below.

Then in the "camera settings" => "Alert" for your camera for the snapshot configure as in the image below.

When you send the HTTP snapshot command however you send it, either manually using a browser or having BI send it periodically in an alert Action Set, the snapshot will appear in the "Snap" folder and it will overwrite the existing snapshot with the latest one. It will be named "&CAM.jpg" with "&CAM" being the camera's short name such as "Cam57.jpg".
happy to say everything you suggested works! some of the menus are not the same but i got the gist of it :)
once i send the command, it dumped the JPG file in the folder i wanted. thank you so much for your time and patience with me!
1724337926278.png

now onto googling how to get Telegram to upload that JPG to my phone.
 

tung256

Getting the hang of it
Joined
Feb 3, 2017
Messages
121
Reaction score
30
here is the full yml code in Home Assistant in case someone is googling in the future:
Code:
alias: test blue iris send photos
description: ""
trigger:
  - platform: time
    at: "23:00:00"
condition: []
action:
  - data:
      url: http://admin:pass123@192.168.1.121:81/admin?camera=dining&snapshot
    service: telegram_bot.send_photo
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - service: telegram_bot.send_photo
    data:
      authentication: digest
      file: www/media/dining.jpg
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: delete.file
    data:
      file: /config/www/media/dining.jpg
mode: single
first action trigger the snapshot command to BI
wait 2 seconds
use Telegram to upload to phone
wait 10 s
delete photo. have to set up deletion because BI cannot overwrite the JPG file itself. couldnt do any of the BI part without Tony's help off course
 
Top