dylandoamaral / trakt-integration

A Trakt integration for Home Assistant compatible with upcoming media card
MIT License
30 stars 12 forks source link

Sensors attributes in table markdown card #38

Closed GegoSK closed 2 years ago

GegoSK commented 2 years ago

Two days ago, after update from 2022.5.5. to 2022.6.6 all my trakt's markdown cards not working. I am not sure if the issue is related to HA or Trakt integration. Sensors working as before. Could anybody, please, test this code?

    type: markdown
    content: |-
      <table width="100%" >
        <tr>
          <th>Show</th>
          <th> </th>
          <th>Episode</th>
          <th>Date</th>
        </tr>
        <tr>
      {% for item in state_attr('sensor.trakt_upcoming_shows', 'data') %}
      {% if item.airdate %}
        <tr>
          <td width="25%" >{{item.title}}</td>
          <td width="10%" align="center">{{item.number[1:6]|regex_replace(find='E', replace='x', ignorecase=False)}}  </td>
          <td width="45%" >- {{item.episode}}</td>
          <td width="20%" align="center">{{as_timestamp(item.airdate) | timestamp_custom('%d.%b')}}</td>
        </tr>
      {% endif %}
      {% endfor %}

Thank you!

dylandoamaral commented 2 years ago

Hello, I don't think it is related to my card.

GegoSK commented 2 years ago

Hi, ok, I thought. Could you please, test that code, if it is working with any of your trakt sensor? I am trying to find if it is problem in my HA or any HA.

GegoSK commented 1 year ago

In case of someone in future will have same problem. After few evenings and some help. Markdown card works only if I delete few lines in attributes: {'title_default': '$title', 'line1_default': '$episode', 'line2_default': '$release', 'line3_default': '$rating - $runtime', 'line4_default': '$number - $studio', 'icon': 'mdi:arrow-down-bold'}