REST result could not be parsed as JSON, but WHY

So I have a valid json file sitting locally on my machine. Several online json validators seem to think the file is valid. But no, not HA. So here is my code:

- platform: rest
    name: sky_condition
    scan_interval: 259200
    force_update: true
    json_attributes:
      - weatherCodeFullDay
      - weatherCodeDay
      - weatherCodeNight
    value_template: >
      OK
    resource: http://localhost:8123/weather_codes.json

Got any ideas?

Tried the File sensor. That was even worse.

TIA

localhost may not be your local machine, especially when running a containerized version like HA Container or HA OS.

Well, if it is Home Assistant serving this file from the built in web server, and weather_codes.json is in the www folder, then you actually want to be using:

http://localhost:8123/local/weather_codes.json

Thanks. I will try that. That was it. Thanks very much.

1 Like