The custom card you are using looks old. Unavailable sensors are usually fixed by going through the options for the integrations in the integrations section. You would need to enable debugging and check the logs to see if there are any errors to troubleshoot.
Yes, i’m using the beta. If you just use sensor.mail_image_system_path
as the trigger, you’ll run into the issue I’m referring to. The mail_image_system_path only updates once a day now, which means that the trigger won’t trip but once a day, and if I restart my HA, I need to manually trigger the automation to force the update. I think we’ll need another trigger so the camera path is updated at boot, or we could update the camera definition to something other than /config/custom_components/mail_and_packages/mail_none.gif
Got it!. That must have sorted it!. Thank you so much!
Not critical but is there an easy way to add to the code so that each message is on a diferent line? Like
line breaks in old school html
For some reason all of my pictures are displaying again. Not sure if I changed anything other than maybe clearing cache. Question on the pictures. I know that they show up sometime after the emails are received ( I believe for me five minutes). When does it change to no mail? I know yesterday I saw the pictures of my mail and last night it showed no mail. Also could anything be setup for the amazon picture to change from the picture of the delivery to a picture showing no delivery after a certain period, i.e 24 hours?
Midnight I believe.
And I think the Amazon image is like an alpha thing that Firstof9 was working on. Good idea with the no image after a period of time, might want to open an issue on GitHub for it so it can be tracked/logged. In the meantime could probably create a generic image and an automation to change the image path kinda like what is done with the mail image.
There is no longer a reason to update the camera to /config/custom_components/mail_and_packages/mail_none.gif using an automation. When the integration does not find mail images in the email, the generated random named gif file is the no mail image.
Since the local file camera doesn’t currently support templating for the file_path every restart resets the path to whatever you have defined in the configuration for the file_path.
There are two options to fix your issue.
- You can use the
sensor.mail_updated
as the trigger. This updates each time the integration checks email. It doesn’t appear to trigger the automation on the first run after a restart since it starts while home assistant is still loading. The second check will trigger the automation and update the camera.
- alias: "Update USPS Mail Camera"
trigger:
- platform: state
entity_id: sensor.mail_updated
action:
- service: local_file.update_file_path
data_template:
entity_id: camera.mail_usps
file_path: "{{ states('sensor.mail_image_system_path') }}"
- Have two automations to update the file. One using any sensor that update due to mail change (sensor.mail_usps_mail, sensor.mail_updated, sensor.mail_image_system_path, etc). The second automation would be the same but use the home assistant platform start event as the trigger. Once the message that states things are still loading, home assistant officially is started and triggers the update to the camera.
- alias: "Update USPS Mail Camera"
trigger:
- platform: state
entity_id: sensor.mail_updated
action:
- service: local_file.update_file_path
data_template:
entity_id: camera.mail_usps
file_path: "{{ states('sensor.mail_image_system_path') }}"
- alias: "Update USPS Mail Camera"
trigger:
platform: homeassistant
event: start
action:
- service: local_file.update_file_path
data_template:
entity_id: camera.mail_usps
file_path: "{{ states('sensor.mail_image_system_path') }}"
Thanks, I think you’ve confirmed what I was seeing. I think I’m going to run a combination of your examples
alias: Update USPS Mail Camera
trigger:
- platform: state
entity_id: sensor.mail_updated
- platform: homeassistant
event: start
action:
- service: local_file.update_file_path
data:
file_path: '{{ states(''sensor.mail_image_system_path'') }}'
entity_id: camera.mail_usps
mode: single
I believe my issue with it not displaying is related to me not understanding how to implement the card correctly.
My automation from the card directions is:
- id: '123456001'
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: >
{% if state_attr('sensor.mail_usps_mail','image') == None %}
/config/custom_components/mail_and_packages/mail_none.gif
{% else %}
/config/www/mail_and_packages/{{ state_attr('sensor.mail_usps_mail','image') }}
{% endif %}
This sets the image, now I do not understand the camera settings as the old directions say to use:
camera:
- platform: local_file
file_path: /config/www/mail_and_packages/mail_today.gif
name: mail_usps
I believe this is my issue as this points to the mail_today.gif file. How do I have the camera point to the new random file name or is it better to use:
gif_sensor: sensor.mail_image_url
Currently my card is setup to use
gif_sensor: sensor.mail_image_url
and the camera
is setup as false.
camera_entity: camera.mail_usps
camera: false
As I said sometimes this works and sometimes it doesn’t. Not sure why. It looks like the integration is setup correctly. Problem with how I am using the card.
Thanks. Sorry for my confusion in using the integration and card.
Bill
If you are going the camera route the automation needed was provided in the post you replied to. The path set in the the camera entity is fine, the first time the automation is triggered it will get replaced with the path from the sensor.mail_image_system_path
.
If you choose to go the GIF route, you simply set the gif sensor to sensor.mail_image_url.
In the custom card config UI (pre-release v0.06) you toggle the blue switch above either GIF Sensor or Camera Entity depending on which you decide to use which is the same as the yaml below.
image: true
gif_sensor: sensor.mail_image_url
camera: true
camera_entity: camera.mail_image_url
I’ve gone the GIF route and cannot get an image to populate when using the sensor.mail_image_url.
My previous working config is:
type: 'custom:mail-and-packages-card'
name: Mail Summary
updated: sensor.mail_updated
details: true
image: true
fedex_packages: sensor.mail_fedex_packages
ups_packages: sensor.mail_ups_packages
usps_packages: sensor.mail_usps_packages
amazon_packages: sensor.mail_amazon_packages
usps_mail: sensor.mail_usps_mail
camera: false
packages_delivered: sensor.mail_amazon_packages_delivered
packages_in_transit: sensor.mail_ups_delivering
gif: /local/mail_today.gif
But I don’t have a gif sensor listed. I do have the sensor.mail_image_system_path and sensor.mail_image_url available, but these don’t produce an image, only the url to the image.
What am I doing wrong?
3.1 wiki documentation is up. Those who were active in feature discussions and beta testing, please review for any holes or misinformation.
From your screen shot you are not using the pre-lease version 0.06 of the custom card that pairs with the 3.x version of the integration. The GIF field is now a Entity drop down similar to the Camera entity.
Ah, I thought I had it, thank you for the clarification, I usually just do the automatic updates. I’ll get it installed.
Well, I’m completely stumped. I’m not getting the images with this configuration:
type: 'custom:mail-and-packages-card'
name: Mail Summary
updated: sensor.mail_updated
details: true
image: true
gif_sensor: sensor.mail_image_url
camera: false
fedex_packages: sensor.mail_fedex_packages
ups_packages: sensor.mail_ups_packages
usps_packages: sensor.mail_usps_packages
amazon_packages: sensor.mail_amazon_packages
usps_mail: sensor.mail_usps_mail
packages_delivered: sensor.mail_amazon_packages_delivered
packages_in_transit: sensor.mail_ups_delivering
camera_entity: sensor.mail_image_url
I’ve also tried substituting sensor.mail_image_system_path for sensor.mail_image_url and no change.
I tried using the camera instead, but more of the same, just not working. Also, using v0.3.1 on the integration, v0.06 on the frontend.
Lastly, I tried the external selection, and there’s no change. BTW, the GIF containing the USPS images is in the /config/www/mail_and_packages folder.
Maybe my question wasn’t clear. I tried the automation above and I did not understand the “system_path”. Am I to substitute the system path in the automation with the “true system path” i.e. /config/www/mail_and_packages/? I have read the new docs and see that the example camera setup still points to mail_today.gif. Since the name was changed to random, I never see this file in my mail_and_packages directory. I must be missing a step.
You can simplify the automation to change the image. Just add both triggers to the same automation. It should trigger if either are true.
No, per the example:
- alias: "Update USPS Mail Camera Path"
trigger:
- platform: state
entity_id: sensor.mail_updated
action:
- service: local_file.update_file_path
data_template:
entity_id: camera.mail_usps
file_path: "{{ states('sensor.mail_image_system_path') }}"
This will use the new sensor to update the camera image.
I made a small edit to that section to point to the ‘No Mail’ image, which is how I have my camera setup on my Home Assistant.
Not using camera and all is working again. I removed the camera from my yaml (had camera false). I let you know tomorrow if it changes.
Would you mind sharing your config? Since the update, I’m also struggling. I have the gif method configured and cannot for the life of me get the image back in the card.
I only have the lovelace card and the integration configured, no automation. Is it required, or is that only for the camera to refresh the image?
The automation is only to have the camera refresh the image.