Ya stuffing all the searches into the table would make it much larger lol
So with the latest beta getting rid of the option for non-rotating image names*, whatās the best way to update the image path for the camera? The new image URL sensor gives a URL path. I can hack a way together with NodeRed by stripping the leading url path to just get the file name and then pass that through to a file_path update if needed. But it also appears that this change would break the wiki example for the camera: https://github.com/moralmunky/Home-Assistant-Mail-And-Packages/wiki/Example-Automations-and-Templates#camera
*
Mini-rant: I get this change in light of the security bulletin for HASSā¦but Iām frustrated. I already had moved my image out of the www directory and I donāt want it accessible to the internetā¦at least not through an image path (even randomly generated). Is there a way to make it so that if your path directory is in /www you have to use the random generated file name but if you move it outside of that directory (in my case /config/images/mail_and_packages
) you donāt have to use the random file name? It just creates a lot more automation requirements and things that could break IMO.
Edit to add caveat: Iām testing in a dev HASS instance right now and thereās no mail today so if when thereās mail there still is a image_name attribute Iāll try to make it work.
So with the latest beta b33, are the secure images being successfully created for anyone else? Iām looking in the /config/www directory for the add-on and not seeing them created. The official lovelace card displays a broken image as well. Iāve got the camera entity updating automatically like in the wiki as well.
So it looks like there is a difference in the new sensor that is in the new version and the old attribute for the filename. The filename in the attribute is not getting updated correctly. This would be why I was having a lot of trouble with the instructions in the wiki.
The changes added to the latest beta are part of an effort to accomplish three things.
- Streamline/simplify configuration
- Eliminate the risk of inadvertently sharing confidential information at a standard path
- Reduce image related help requests
sensor.mail_image_url
provides the needed URL for iOS notifications and display in the custom card (future update).
sensor.mail_image_system_path
provides the file_path portion of the automation that updates a user created camera entity. Appears the file name is currently missing from this sensor in the beta.
Also, this as a first step to explore the possibility of creating a camera entity from within the integration so no extra set up is needed for the image or camera.
Feedback and discussion is welcome in the feature request related to this change.
The image name is still listed as an attribute of sensor.mail_usps_mail
. There should be no affect on the Update USPS Mail Camera
automation example. Unless a bug was inadvertently included in the code If a user previously stored the image in a place other than /config/www/mail_and_packages/
, the automation would need to be updated to reflect the standardized path in the beta.
The integration can figure out the path to the config directory and internal/external domain of the HASS install. That combined with a standard image path within the install helps create universal solution to get the paths needed for the different ways to display the image.
Last I checked the www directory is where the image has to be stored to include it in iOS notification (maybe Android too?). So that is the one I chose to suggest in the feature request.
The goal, not yet there, is that this would work for everyone with random file names
- alias: "Update USPS Mail Camera"
trigger:
- platform: state
entity_id: sensor.mail_usps_mail
action:
- service: local_file.update_file_path
data_template:
entity_id: camera.mail_usps
file_path: {{ states('sensor.mail_image_system_path') }}
Feedback and discussion are welcome on the feature request.
Ah, missed that that was the Github issue. Iāll chime in over there too.
I agree with these goals. But it also goes back to some of the YAML v. Integration arguments where power users donāt like features/options being taken away. I have no issues with the defaults being random image. But I do think that forcing the path to be in /local actually takes away a security feature, which is putting it in a different directory all together and making it not publicly accessible at all.
I donāt use the HASS app for the notification (iOS or Android. I instead use Telegram/Matrix, which allows you to pass through a local file without issues (so the image doesnāt need to be publicly accessible). I also believe (though havenāt been able to confirm and it may be iOS only) that you can use the camera stream directly without having to make it accessible. See Dynamic attachments | Home Assistant Companion Docs. Iāve run into issues with the GIF part tbh but that may be more that I use Matrix as my chat which has lackluster image/gif support ATM.
I totally understand the goal and making this more user friendly. But I remember when I initially tried out the auto image rotation thing I had trouble getting it to work nicely with NodeRed, which is something a lot of people use. Found my post on this: Mail and Packages: Custom component for UPS, FEDEX, and USPS - #340 by fuzzymistborn . I can stay on my current version for now but as you know, USPS/UPS/Fedex like to mess with things so Iāll need to update at some point in the future and right now this pretty much breaks the integration for me.
Anyway, rant over, itās time for bed.
All 3 sensors should have the same exact filename.
I canāt seem to get this functioning. Just updated to b34
But config check shows
I can see the state is set
Your indention looks off.
Same. I copied the indentiation just now from Mail and Packages: Custom component for UPS, FEDEX, and USPS
Is that line 9?
Try:
file_path: >
{{ states('sensor.mail_image_system_path') }}
Iāve been following, and I got the automation to work, but the state value is wrong.
alias: Update USPS Mail Camera
trigger:
- platform: state
entity_id: sensor.mail_usps_mail
action:
- service: local_file.update_file_path
data:
file_path: |
{{ states('sensor.mail_image_system_path') }}
entity_id: camera.mail_usps
mode: single
If you fire the automation manually, itāll sync up, it should be firing when the sensor updates. Iām confirming this now, just waiting for my up date timer to go off.
EDIT: oh your filename became out of sync, I think this happens on restart. I saw the same thing, still confirming.
EDIT 2: Yup looks like the sensor isnāt updating properly, Iāll get it sorted.
That did it for me, thanks for the quick response.
ditto, works here now. Thanks for this and all of the other little fixes over the last couple weeks.
Now - I canāt wait for homekit camera to be working I would be so stoked.
On latest beta and email from USPS come in today and showed I had 10 pieces of mail. 9 of the 10 were there and the 10th it couldnāt display. Probably the usual larger item they canāt scan. That said, I got an email telling me we have 10 pieces of mail today and shows that in HA, but the image shows No Mail. Any thoughts?