I’m looking for some help because i’m starting to loose faith that I can resolve it.
It sounds easy. Send a picture with telegram.
The story:
I set up a security cam outside my house. The software i’m running is Agent DVR and it runs on my Windows server 2016. It takes a picture when it sees a person,dog or cat. I want so sent that picture with Home assistant to my phone with Telegram.
The first thing I tried to do is to connect a nfs share to my HA. My thinking was that it would be easyer to have the pictures localy avalible in HA but I can’t get it to work because I keep getting errors. “Error running command: mount -t nfs3 Windowsserver2016:/camerabeelden /media
, return code: 255”. Looking in other topics i’m not the only one with this problemen so I gave up.
What i’m thinking of right now is to use the API of Agent DVR to get information into Homeassistant but I have no clue how to start. What I want to do is the following.
- Get the picture name :
http://Windowsserver2016:8090/q.json?cmd=getcameragrabs&oid=1&ot=2
The result I get:
{“total”:72,“results”:[{“name”:“2022-01-02_15-33-58_492.jpg”,“time”:“1641145734680.49”,“tags”:“person”},{“name”:“2022-01-02_15-33-55_250.jpg”,“time”:“1641145734649.47”,“tags”:“person”},{“name”:“2022-01-02_15-33-53_713.jpg”,“time”:“1641145734629.48”,“tags”:“person”},{“name”:“2022-01-02_14-48-38_844.jpg”,“time”:“1641145734615.47”,“tags”:“person”},{“name”:“2022-01-02_14-48-36_991.jpg”,“time”:“1641145734601.43”,“tags”:“person”}], “last”:637767461346014346} - Extract the picture name:
2022-01-02_15-33-58_492.jpg - Use this jpg into the next url:
http://Windowsserver2016:8090/grabimage.jpg?oid=1&fn=2022-01-02_15-33-58_492.jpg"
This url I can then use in a automation:
alias: '-Test- Telegram - Stuur me een foto wanneer er beweging is.'
description: ''
trigger:
- platform: mqtt
topic: Agent/cameras/achtertuin/deepstack
condition: []
action:
- service: telegram_bot.send_photo
data:
url: >-
http://192.168.2.8:8090/grabimage.jpg?oid=1&fn=2022-01-02_15-33-58_492.jpg
mode: single
Is this posible what I want to do?
Is it posible to use variables in automations?
Is there maby a easyer way to do this?