I don’t know, it’s your sensor and it’s labeled sensor.seventeentrack_packages_in_transit
I have also the other sensor available, it is called: sensor.seventeentrack_packages_not_found
and it acts exactly as sensor.seventeentrack_packages_in_transit
with the difference that here the status is “none” instead of the actual shipping status. See pictures with the two sensors:
My guess would be a typo, the data is the same. Verify the information you changed when making the sensor is correct.
This is my current setup in the markdown card:
{% set ns = namespace(items = [], count=0) %}
{% for item in state_attr('sensor.seventeentrack_packages_in_transit' , 'packages') %}
{% set sensor = 'sensor.seventeentrack_package_' ~ item.tracking_number %}
{% set ns.count = ns.count + 1 %}
{% set ns.items = ns.items + [ '{}. {} \n Status: {}'.format(ns.count, item.friendly_name, item.info_text) ] %}
{% endfor %}
{{ ns.items | join('\n\n') }}
See attached how my card looks like. As mentioned before currently is listing only the sensor.seventeentrack_packages_in_transit values
. I would to modify the above seen code to display also the sensor.seventeentrack_packages_not_found
values. Can you help me what to change in the code to achieve this?
I’m not sure if you’re joking or what… Just look at the code, find the entity_id and change it to the one you want. You don’t need to be able to even read code to know what to change.
Sorry for not being clear enough: I don’t want anther markdown card with the sensor.seventeentrack_packages_not_found
values, but I want to see all 24 shipments in one card regardless if they are in transit (listed by the sensor.seventeentrack_packages_in_transit
entity) or not (listed by the sensor.seventeentrack_packages_not_found
entity). By simply copying the code above and changing the entity name it does the job, but the number at the beginning of each shipment won’t add up, it will list the 16 in transit items (from 1 to 16) and it will list the 8 not found items (with numbers from 1 to 8). I would like to see the numbering to be continuous from 1 to 24.
I am very grateful for your support and by no means I am joking with you. Before I wrote you I have checked the Jinja2 documentation to see if I find answer to my question, but I couldn’t find any solution.
ah ok, Just duplicate the center bit
{% set ns = namespace(items = [], count=0) %}
{% for item in state_attr('sensor.seventeentrack_packages_in_transit' , 'packages') %}
{% set sensor = 'sensor.seventeentrack_package_' ~ item.tracking_number %}
{% set ns.count = ns.count + 1 %}
{% set ns.items = ns.items + [ '{}. {} \n Status: {}'.format(ns.count, item.friendly_name, item.info_text) ] %}
{% endfor %}
{% for item in state_attr('sensor.seventeentrack_packages_not_found' , 'packages') %}
{% set sensor = 'sensor.seventeentrack_package_' ~ item.tracking_number %}
{% set ns.count = ns.count + 1 %}
{% set ns.items = ns.items + [ '{}. {} \n Status: {}'.format(ns.count, item.friendly_name, item.info_text) ] %}
{% endfor %}
{{ ns.items | join('\n\n') }}
Thank you very much for your help. It works as intended.