Well, then we can use the homeassistant automation instead.
What i did was using the local_file integration.
I did first mount the external nas drive in homeassistant, and i can browse it while using MEDIA in Homeassistant.
My drive is mounted under MEDIA, in that drive i have a folder named TRIGGERED, in that folder are the FILENAME.jpg images.
Then i have an MQTT entity that posts the filename in an attribute.
for example 202404041200.jpg
it shows like this:
So i know the exact filename what to call when i want it to send to discord.
We need also to setup the local_file entity in your configuration.yaml or like me using packages folder:
So when setting up the automation to update the correct file i use this (action) automation.
So for example when the MQTT entity changes it triggers this action to update the last image.
service: local_file.update_file_path
data:
entity_id: camera.detected_front
file_path: /media/alerts/triggered/{{states('sensor.ai_front_image')}}
Here is how the local_file entity looks like
after that we need an other automation that sends it to discord.
What this local_file integration does is create a special link to access with a token in an attribute:
service: notify.discord
data:
message: ""
target: "YOURCHANNEL ID"
data:
embed:
title: YOUR TITLE
description: YOUR DESCRIPTION
url: https://nolink.org
color: 199363
author:
name: Home Security System
url: YOUR URL U WANT TO USE
icon_url: ICONURL
footer:
text: © YOUR NAME
icon_url: https://www.home-assistant.io
thumbnail:
url: >-
https://YOURNABUCASAURL.ui.nabu.casa{{
state_attr('camera.detected_front', 'entity_picture') }}
image:
url: >-
https://YOURNABUCASAURL.ui.nabu.casa{{
state_attr('camera.detected_front', 'entity_picture') }}
fields:
- name: WHATEVERUWANT
value: "{{state_attr('sensor.YOURSENSR, 'ATTRIBUTE') }}"
inline: time
- name: WHATEVERUWANT
value: "{{state_attr('sensor.YOURSENSR, 'ATTRIBUTE') }}"
- name: what detection
value: "{{state_attr('sensor.YOURSENSR, 'ATTRIBUTE') }}"
- name: extra
value: >-
{{state_attr('sensor.YOURSENSR, 'ATTRIBUTE') }},{{state_attr('sensor.YOURSENSR, 'ATTRIBUTE') }}
inline: false
images:
- >-
https://YOURNABUCASAURL.ui.nabu.casa{{
state_attr('camera.detected_front', 'entity_picture') }}
enabled: true