moralmunky/Home-Assistant-Mail-And-Packages-Custom-Card

card looks different than documentation.

avd706 opened this issue ยท 16 comments

Installed via HACS, got the card to show in lovelace.

When I go to configure, it looks different than the documentation. See screenshot.

Home Assistant Supervised in a Docker container.

Screenshot_20200825_120740

JOHLC commented

I have seen this happen randomly myself

Also the mail summary sensor in the wiki of the mail and packages integration is a very long output of text, in the image on this repo of the mail summary sensor it's a nice short and sweet text output. What is the code of the template sensor used for the one in the documented image?

JOHLC commented

Also the mail summary sensor in the wiki of the mail and packages integration is a very long output of text, in the image on this repo of the mail summary sensor it's a nice short and sweet text output. What is the code of the template sensor used for the one in the documented image?

I made my own,

            {% macro deliveries_sentence() -%}
            
            {%- if states("sensor.mail_packages_delivered")|int == 0 -%}
            {%- else -%}
            {{states("sensor.mail_packages_delivered")|int}}
            {%- endif -%}
            {{' '}} 
            {%- if states("sensor.mail_packages_delivered")|int == 1 -%}
            package has been delivered.{{' '}}
            {%- endif -%}
            {%- if states("sensor.mail_packages_delivered")|int >= 2 -%}
            packages have been delivered.{{' '}}
            {%- endif -%}
            
            {%- if states("sensor.mail_usps_mail")|int == 0 -%}
            {%- else -%}
            {{states("sensor.mail_usps_mail")|int}}{{' '}} 
            {%- endif -%}
            {%- if states("sensor.mail_usps_mail")|int == 1 -%}
            piece of mail will be delivered.{{' '}}
            {%- endif -%}
            {%- if states("sensor.mail_usps_mail")|int >= 2 -%}
            pieces of mail will be delivered.{{' '}}
            {%- endif -%}
            
            {%- if states("sensor.mail_usps_delivering")|int == 0 -%}
            {%- else -%}
            {{states("sensor.mail_usps_delivering")|int}}{{' '}} 
            {%- endif -%}
            {%- if states("sensor.mail_usps_delivering")|int == 1 -%}
            USPS package will be delivered.{{' '}}
            {%- endif -%}
            {%- if states("sensor.mail_usps_delivering")|int >= 2 -%}
            USPS packages will be delivered.{{' '}}
            {%- endif -%}
            
            {%- if states("sensor.mail_ups_delivering")|int == 0 -%}
            {%- else -%}
            {{states("sensor.mail_ups_delivering")|int}}
            {%- endif -%}
            {{' '}} 
            {%- if states("sensor.mail_ups_delivering")|int == 1 -%}
            UPS package will be delivered.{{' '}}
            {%- endif -%}
            {%- if states("sensor.mail_ups_delivering")|int >= 2 -%}
            UPS packages will be delivered.{{' '}}
            {%- endif -%}
            
            {%- if states("sensor.mail_fedex_delivering")|int == 0 -%}
            {%- else -%}
            {{states("sensor.mail_fedex_delivering")|int}}
            {%- endif -%}
            {{' '}} 
            {%- if states("sensor.mail_fedex_delivering")|int == 1 -%}
            FedEx package will be delivered.{{' '}}
            {%- endif -%}
            {%- if states("sensor.mail_fedex_delivering")|int >= 2 -%}
            Fedex packages will be delivered.{{' '}}
            {%- endif -%}
            {%- endmacro %}
            {{deliveries_sentence()}}

This is happening to me too. Is there a fix?

Doesn't look like the browser is rendering it correctly. Try emptying catch, different browser, all that jazz. Maybe even an uninstall, reinstall.

I'm also getting this issue.

Tried it in Firefox, Chrome, and Edge. (latest stable versions of each).

HomeAssistant v0.118.0, running in docker.

Browser cache cleared in every instance. Card uninstalled and reinstalled multiple times.

Also getting the issue, plus my card isn't showing up at all (doesn't look like that was necessarily mentioned before, may make a new issue):
image

Full card config:
type: 'custom:mail-and-packages-card'
name: Mail Summary
updated: sensor.mail_updated
details: true
image: false
deliveries_message: sensor.mail_delieveries
packages_delivered: sensor.mail_packages_delivered
packages_in_transit: sensor.mail_packages_delivered
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

Version: 0.0.4
HA Version: 0.118.5

Getting this error: Uncaught (in promise) TypeError: this.hass.states[this._config.deliveries_message] is undefined

image

In the main error message, it is stating the problem is with what you are specifying for the deliveries_message config item. You have sensor.mail_delieveries configured for this. Does sensor.mail_delieveries exist? It is not a sensor that the integration creates. You must create a delivery message sensor yourself, please see the WIKI.

This is left out of the integration on purpose so they can customize as they see fit.

Also the mail summary sensor in the wiki of the mail and packages integration is a very long output of text, in the image on this repo of the mail summary sensor it's a nice short and sweet text output. What is the code of the template sensor used for the one in the documented image?

@jes1417 The code I use for the sensor template simply states the number of mail pieces and the number of packages being delivered, leaving the breakdown of who they are coming from in the card. Please note that Amazon is not included in the packages in transit or delivered totals.

- platform: template
  sensors:
    mail_deliveries_message:
      friendly_name: "Deliveries Summary"
      value_template: > 
        {# Deliveries Sentence #}
          {% macro deliveries_sentence() -%}
                {%- if states("sensor.mail_usps_mail")|int == 0 -%}
                  No
                {%- else -%}
                  {{states("sensor.mail_usps_mail")|int}}
                {%- endif -%}
              {{' '}} 
                {%- if states("sensor.mail_usps_mail")|int <= 1 -%}
                  mail
                {%- else -%}
                  pieces of mail
                {%- endif -%}
              {{' '}}will be delivered.{{' '}} 
                {%- if states("sensor.mail_packages_in_transit")|int == 0 -%}
                  No
                {%- else -%}
                  {{states("sensor.mail_packages_in_transit")|int}}
                {%- endif -%}
              {{' '}} 
                {%- if states("sensor.mail_packages_in_transit")|int == 1 -%}
                  package is
                {%- else -%}
                  packages are
                {%- endif -%}
              {{' '}}in transit.{{' '}}
          {%- endmacro %}
        {{deliveries_sentence()}}

Also getting the issue, plus my card isn't showing up at all (doesn't look like that was necessarily mentioned before, may make a new issue):
image

Full card config:
type: 'custom:mail-and-packages-card'
name: Mail Summary
updated: sensor.mail_updated
details: true
image: false
deliveries_message: sensor.mail_delieveries
packages_delivered: sensor.mail_packages_delivered
packages_in_transit: sensor.mail_packages_delivered
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

Version: 0.0.4
HA Version: 0.118.5

Getting this error: Uncaught (in promise) TypeError: this.hass.states[this._config.deliveries_message] is undefined

image

I have all of the above issues and when I first set my card up, the quoted sub-issue below also happened to me. For the sub-issue, deleting the card and trying again fixed it.
However, the documentation still doesn't seem to reflect the many options that are now available for the card, per this actual issue.

Home Assistant sometimes has issues picking up the JS for the card after initial installation and refreshing the front end. I have yet to find a solution on the custom card side to correct this.

The documentation intentionally leaves out a full listing of YAML code, the visual card editor is preferred for completing the set up. Current limitations in Home Assistant require the user to start by creating a manual card with the minimum options using the provided YAML in the readme. Finishing the setup in the visual editor is inline with Home Assistant's direction for cards. Hopefully one day, custom cards will be able to be included in the 'Add Card' menu and the manual step will no longer be needed.

Information about the delivery message sensor have been added to the readme.

Custom cards are definitely able to be included in the add card menu.
image

Great to know, do you have instructions on how to do it?

Not sure why this was closed. The documentation still needs to be updated. The picture in the documentation and the accompanying instructions do not explain how the additional options work. This is what we see using the provided YAML from the documentation:
54756398-0588-49F7-886B-F44953726ECC
1E7919E7-B19D-426A-82CB-06F25CC21A60

Write it up and I'll post it. The labeling was fixed earlier in this issue and I feel they are self explanatory.