Read the statement by Michael Teeuw here.
Quick Question regarding Magic Mirror cache
-
Hi!
Recently I have been using Magic Mirrors alert system, along with the RESTful(ish) Api to show an image from my home security camera.Example API POST request:
"http://192.168.2.48:8080/api/v1/modules/alert/show_ALERT?timer=10500&imageUrl=http://192.168.2.18:9920/security/values/2&imageHeight=220px";
Where the image is being served on a custom security web server.
Everything is working quite nicely using the API module, however, it would seem that the magic mirror server is keeping an image in a cache and will repeat the same image over and over despite the POST request sending it a more current image.
Is there a way to clear the Magic Mirrors cache?
Perhaps a command I can send through the API prior to giving the Alert module the new image?I hope this question is making sense to the lead developers.
I can go into more detail and explain the workflow further if this isn’t making sense to anyone.
Many thanks!
-
Upon further research, perhaps it is Electron which is cache the image.
And I might be wrong but it looks as though clearing cache has to happen in the core of the application.
Something like “session.Clear()”
-
This is a very interesting question!
I have been thinking about all those calls to the font-awesome site that is (probably?) being continually generated every time a module refreshes. Just to re-fetch the same few icons… Seem crazy to me.
-
@chef The
POST
request isn’t sending it an image, it’s sending the URL to the image (e.g.http://192.168.2.18:9920/security/values/2
). The problem is, it already has a cached copy of that image. I suggest you append a timestamp to trickelectron
into re-fetching the same image/resource.You want to pass it a URL-encoded value, so use
%3F
as?
and just append your timestamp, like so:http://192.168.2.48:8080/api/v1/modules/alert/show_ALERT?timer=10500&imageUrl=http://192.168.2.18:9920/security/values/2%3F {INSERT TIMESTAMP HERE}&imageHeight=220px
-
@ninjabreadman said in Quick Question regarding Magic Mirror cache:
http://192.168.2.48:8080/api/v1/modules/alert/show_ALERT?timer=10500&imageUrl=http://192.168.2.18:9920/security/values/2%3F
{INSERT TIMESTAMP HERE}&imageHeight=220pxThaaaaank you sir! absolutely spot on! Now Alexa will describe the person in the security image (using M$ cognitive sense API), and the mirror in the kitchen flashes the security image as an alert.
Pretty bad@$$ actually!
-
@e3v3a so it would seem that the cache is in place to keep those images from a constant request situation.
However, now that you mention using FA icons on the alerts; I wasn’t able to successfully request FA images in my alerts.
Do you have an example of how you are doing it I could see?
-
@chef
You project sound awesome! IS it private, or will you share it with us? -
@e3v3a Sure I can share it!
There is a bit of a setup to get things rolling, but in the end, the security camera/alexa/Cognitive neural network is quite on point.
The best part is that if the neural network does get confused, the image is sent to the magic mirror anyway. So, Alexa will apologize for not being able to gather image information but will remind you to look at the magic mirror alert.
However, in both instances, the security camera image is posted on the mirror.