I wish to create a sensor based on the contens of a local file

I hope I am using the correct terms in the topic heading. The details are:

  1. I have a JSON file on the HA disc (/homeassistant/quota.txt)
{
        "tx": 155946651,
        "rx": 1671159037
}
  1. I would like to be able to display a sensor containing these values in a lovelace dashboard.

I see that there is a File Integration but I am unable to find any examples using it. Is that the way to go? Are there other routes?

Regards, Martin

Core: 2024.8.0
Supervisor: 2024.08.0
Operating System: 12.4
Frontend: 20240806.1

No.

https://www.home-assistant.io/integrations/file/#sensor

Thanks. I can pre-process the file:

{  "tx": 155946651,  "rx": 1671159037 }

… will that help? Or am I barking up the wrong tree"?

M.

Yes.

What is a valid path? Is your screenshot an example or working? Is it absolute (/homeassistant/www/community) or relative (/www/community).
Why are both reporting:
image

frontend:
  extra_module_url:
    - /local/hacsfiles/lovelace-card-mod/card-mod.js
allowlist_external_dirs:
  # - /www/community
  # - /homeassistant/www/community #un-rem one at a time...
 
##Removed by MPR 04/01/2024
# Added by MPR 11/9/23
#sensor:  

In the above snippet from my configuration.yaml, what is the meaning of “/local/”

M.

Allowlist goes under homeassistant.

frontend:
  extra_module_url:
    - /local/hacsfiles/lovelace-card-mod/card-mod.js
homeassistant:
  allowlist_external_dirs:
    - /www/community
    - /homeassistant/www/community #un-rem one at a time...

/local is a short-cut for /config/www

Thank you Tom,
Okay, first couple of hurdle bounded (well, surmounted anyway!). So how do I test?
I think I have a file in the right place (/local/quota.txt) that looks like this:

{"tx": 158427195,"rx": 1703395903}

I think I have created a File integration:

Where/how do I read the contents of the file quota.txt?
M.

The file sensor integration will poll the file for updates every 10 seconds or so.

Oh… Then something is not right?

M.

Most likely your file path.

Seems as if only the /config/ works?

homeassistant:
  allowlist_external_dirs:
    #- /local/
    #- /local/hacsfiles
    - /config/     #Works.....????
    - /config/www/ #Does not work?

But I’m probably doing it all wrong?
M.

Did you restart home assistant after creating the www folder?