Need Help Displaying Watchman Report file contents (watchman_report.txt) in a Markdown Card

Hello. I have the Watchman integration working correctly, and it produces a file called “watchman_report.txt” in my /config/ folder. I am trying hard to get the results of this displayed in a Markdown Card so that I don’t have to go digging for the file every time it runs, if it fails, so I can see the results.

I have tried adding the following Command Line Sensor to my configuration.yaml file:

# Sensor to display output of Watchman Report to Lovelace
command_line:
  - sensor:
      name: Watchman Report Display
      command: cat /config/watchman_report.txt

And in Lovelace, I have the following Markdown Card configured:

type: markdown
content: |
  ## Watchman Report
  {{ states('sensor.watchman_report_display') }}

But, the card always only shows “unknown” instead of the contents of the watchman_report.txt file.

What am I doing wrong? I greatly appreciate any assistance.

I donot understand what you are trying to do, have you read the documentation? There is an example on how to create a report…is that insufficient for you?
dummylabs/thewatchman: Home Assistant custom integration to keep track of missing entities and services in your config files (github.com)

States are limited to a number of characters, I think 128 or 256. Either way you are likely to exceed that.

But anyway, go with what @vingerha pointed out.

Good morning @vingerha . Yes, I read the documentation. I am simply trying to display the report in a card.

Thank you, @nickrout , that is probably why it is not working. Unfortunate.

Would be nice to at least have a link in my card to display the report, but I can’t figure out how to do that either, as all the links seem to be to HTTP (external links) and cannot work with local files.

Which that code in the doc does, still not sure what is not working or not as expected.
The report is meant to be sent e.g. by email

Ah, I see now. Had to add the code below to the card, and install the card-mod. Thank you.

type: markdown
content: >-
  <h2 class="some"> <ha-icon icon='mdi:shield-half-full'></ha-icon> Watchman report</h2>
  <h3> Missing Services: {{ states.sensor.watchman_missing_services.state }} </h3>
  {%- for item in state_attr("sensor.watchman_missing_services", "services") %}
  <hr><table><tr> <td>  <ha-icon icon='mdi:cloud-alert'></ha-icon> {{ item.id }}
  <a title="{{item.occurrences}}">{{item.occurrences.split('/')[-1].split(':')[0]}}</a>
  </td></tr></table>
  {%- endfor %}
card_mod:
  style:
    ha-markdown:
      $: |
        ha-markdown-element:first-of-type hr{
          border-color: #303030;
        }