Preview image via cloud upload and cleanup after #51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I spent way too much time troubleshooting this issue where previewing an image works only once and every subsequent attempt to preview an image will display the first image. For some reason, the Meural device caches the image. I verified this by making API calls directly to the local webserver. I also found someone mentioned this issue here.
This had been bugging me for a while since I wanted to display the image from the front door when someone rings the doorbell. So for a while, I had automation where I used
preview_image
to display the image from the front door, then restart the Meural, so subsequent attempts to preview the image would work. Obviously, this wasn't ideal, so I looked into the APIs and figured out a way to upload the image first to the cloud and then use the id to preview it, waiting for 2 minutes before deleting it from the cloud.Bonus: You can include a bunch of metadata to the uploaded image, so the image preview looks great.
Screenshot
P.S. I know this is kind of a hack to work around the preview service, so I am totally ok with closing this MR without merging. I am just going to leave this here, so if anyone struggling with this issue knows what to do :)