Comments (6)
Also, it would be great if we could replace to the thumbnail URL directly, instead of having to get the event ID, call, the API, then get the thumbnail image... same might apply to the image itself, as it seems the /api/events/{ID}/img is fairly slow compared to just pulling /storage/events/{GUID}.jpeg (understandable, as it's calling the DB and what not).
from last-watch-ai.
On second thought... another solution might be that instead of having randomly generated GUID used within /storage/events/GUID.jpeg, maybe using some simple hashing like MD5 or so based on the original file name (i.e. %image_file_name%), that way no need to call the API to get the storage location, as long as you already have the original filename
from last-watch-ai.
For anyone interested, for the comment above (about been able to get the direct image link, instead of a link that tries to "download" the image), I made a minor change in my local PayloadHelper.php and it's working great. I just added the following line before the "return $replaced;":
$replaced = str_replace('%image_path%', $event->imageFile->getPath(), $replaced);
This works great for my use case which is BI sending alert images to Last-Watch-AI, which then triggers a web-hook that triggers a push notification to a PWA. When the user clicks on the PWA's notification is a direct link to the Last-Watch_AI image that triggered the event. This is way faster than the /api/events/{ID}/img call
from last-watch-ai.
I actually have some changes in the dev branch to clean up the substitution variables and standardize them across the different automation types. The substitution code was pretty rushed so I'm not surprised that you found some gaps there. I'll see about adding some variables for direct jpg links for the event and the thumbnail rather than the resource url.
from last-watch-ai.
See acb73d2
Changed image_url to use the storage link instead of the resource link as you suggested. Added a new variable for the resource link which is still useful for embedding download links which retain the original file name.
I had already fixed the issues you described but I've been busy the last few weeks and haven't released it. Web request substitutions are fixed and tested, but I started adding substitutions for MQTT automations and I haven't written those tests yet. Once I write the tests for MQTT I'll do a new release. Until then you can pull dev if you want. I actually use the dev branch for my home automation and everything has been working fine.
Thanks for your support!
from last-watch-ai.
This is great, will pull the dev branch. Thanks!
from last-watch-ai.
Related Issues (20)
- Adding web request automation returns error HOT 4
- Interface to edit automations HOT 3
- Add continuous build integration
- Mqtt Posting? HOT 5
- Unable to subscribe to automations
- Dev branch add vendor/autoload and compose to dockerfile HOT 4
- Builds on docker hub? HOT 1
- Alert via webhook and read snapshot-URL? HOT 4
- Intensive CPU HOT 9
- No image display on web interface. HOT 5
- ARM64 Jetson Nano HOT 1
- Idea: Gallery view or thumbnails in Detection Events webpage HOT 2
- Build failing? HOT 3
- No processing? HOT 6
- Feature suggestion: Dark mode HOT 1
- Profile matching no longer using full path but filename only HOT 1
- Ignore SSL exceptions in automation
- Passing additional variables via HA API body HOT 1
- Question: Negative doesn't seem to work as expected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from last-watch-ai.