How to add agilePredict

Hi All

New to Home Assistant. Trying to add the Agile predict sensor from Agile Predict
to the YAML file.
Its given on the site as:

sensor:
- platform: rest
    resource: https://prices.fly.dev/api/G
    scan_interval: 3600
    name: Agile Predict
    value_template:  "{{ value_json[0]['name']}}" 
    json_attributes_path: "$[0]"
    json_attributes:
    - "created_at"
    - "prices"  

I copy and paste to the YAML and although it states the configuration wont prevent start almost every line throws an error., usually not recognised.
Has anyone successfully added this sensor and if so how, Many thanks Pete

Welcome to the forum. Let’s see if I can be of any assistance.

Paste it into the YAML where?

I`m not exactly sure. Heres the site:
https://agilepredict.com/api_how_to

It says:
The GitHub repo includes the necessary yaml files to import the forecast into a sensor in Home Assistant. Alternatively you can simply copy the code from this page into your configuration.yaml file.

Regards Pete

You are not sure where you pasted it?

Those instructions state to paste it into configuration.yaml. What it doesn’t tell you is if you already have a sensor: section, you will get an error if you add a second one.
Did you paste it into configuration.yaml, and if you di was there already a section for sensor: in there.

Mu current configuration.yaml is:

Loads default set of integrations. Do not remove.

default_config:

Load frontend themes from the themes folder

frontend:
themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

So I add in the sensor yaml

Loads default set of integrations. Do not remove.

default_config:

Load frontend themes from the themes folder

frontend:
themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
#Load sensor
sensor:

I then check with developer tools to config and get:
Configuration warnings

Integration error: resource - Integration ‘resource’ not found
Integration error: scan_interval - Integration ‘scan_interval’ not found.
Integration error: name - Integration ‘name’ not found.
Integration error: json_attributes - Integration ‘json_attributes’ not found.
Integration error: json_attributes_path - Integration ‘json_attributes_path’ not found.
Integration error: value_template - Integration ‘value_template’ not found.
Invalid config for ‘rest’ from integration ‘sensor’ at configuration.yaml, line 14: must contain at least one of resource, resource_template. ‘’, got {‘platform’: ‘rest’}

Can you format that so I can see if there is an indentation error?

How to help us help you - or How to ask a good question.

Hi
Your mention of indentation made me have a look at what was copied and pasted in.
I removed one space on the line - platform: rest after pasting in. I now get a green tick and the check configuration now doesn’t throw an error. Is there any info on indentation and formatting structure as it seems critical the number of spaces is correct