Hi @123… I’m trying something similar, attempting to paraphrase the yaml from Restful as:
sensor:
- platform: rest
name: "Deepwater Bend Tides"
resource: https://api.willyweather.com.au/v2/Y***my-API-here***/locations/33389/weather.json?forecasts=tides&days=7&startDate={{ now().strftime("%Y-%m-%d") }}
method: GET
scan_interval: 86400
sensor:
- name: 'Deepwater Bend tides - 1'
value_template: "OK"
json_attribute_path: "$.forecasts.tides.days[0].entries[0]"
json_attributes:
- "dateTime"
- "height"
- "type"
- name: 'Deepwater Bend tides - 2'
value_template: "OK"
json_attribute_path: "$.forecasts.tides.days[0].entries[1]"
json_attributes:
- "dateTime"
- "height"
- "type"
- name: 'Deepwater Bend tides - 3'
value_template: "OK"
json_attribute_path: "$.forecasts.tides.days[0].entries[2]"
json_attributes:
- "dateTime"
- "height"
- "type"
- name: 'Deepwater Bend tides - 4'
value_template: "OK"
json_attribute_path: "$.forecasts.tides.days[0].entries[3]"
json_attributes:
- "dateTime"
- "height"
- "type"
- name: 'Deepwater Bend tides - 5'
value_template: "OK"
json_attribute_path: "$.forecasts.tides.days[1].entries[0]"
json_attributes:
- "dateTime"
- "height"
- "type"
- name: 'Deepwater Bend tides - 6'
value_template: "OK"
json_attribute_path: "$.forecasts.tides.days[1].entries[1]"
json_attributes:
- "dateTime"
- "height"
- "type"
- name: 'Deepwater Bend tides - 7'
value_template: "OK"
json_attribute_path: "$.forecasts.tides.days[1].entries[2]"
json_attributes:
- "dateTime"
- "height"
- "type"
- name: 'Deepwater Bend tides - 8'
value_template: "OK"
json_attribute_path: "$.forecasts.tides.days[1].entries[3]"
json_attributes:
- "dateTime"
- "height"
- "type"
- name: 'Deepwater Bend tides - 9'
value_template: "OK"
json_attribute_path: "$.forecasts.tides.days[2].entries[0]"
json_attributes:
- "dateTime"
- "height"
- "type"
- name: 'Deepwater Bend tides - 10'
value_template: "OK"
json_attribute_path: "$.forecasts.tides.days[2].entries[1]"
json_attributes:
- "dateTime"
- "height"
- "type"
- name: 'Deepwater Bend tides - 11'
value_template: "OK"
json_attribute_path: "$.forecasts.tides.days[2].entries[2]"
json_attributes:
- "dateTime"
- "height"
- "type"
- name: 'Deepwater Bend tides - 12'
value_template: "OK"
json_attribute_path: "$.forecasts.tides.days[2].entries[3]"
json_attributes:
- "dateTime"
- "height"
- "type"
Sample JSON from the Rest GET is:
{
"location":{
"id":33389,
"name":"Pine River - Deepwater Bend Boat Ramp",
"region":"Sunshine Coast",
"state":"QLD",
"postcode":"",
"timeZone":"Australia\/Brisbane",
"lat":-27.299,
"lng":153.0352,
"typeId":14
},
"forecasts":{
"tides":{
"days":[
{
"dateTime":"2022-01-03 00:00:00",
"entries":[
{
"dateTime":"2022-01-03 04:04:00",
"height":0.23,
"type":"low"
},
{
"dateTime":"2022-01-03 10:13:00",
"height":2.68,
"type":"high"
},
{
"dateTime":"2022-01-03 17:31:00",
"height":0.42,
"type":"low"
},
{
"dateTime":"2022-01-03 22:25:00",
"height":1.83,
"type":"high"
}
]
},
{
"dateTime":"2022-01-04 00:00:00",
"entries":[
{
"dateTime":"2022-01-04 04:52:00",
"height":0.24,
"type":"low"
},
{
"dateTime":"2022-01-04 11:02:00",
"height":2.69,
"type":"high"
},
{
"dateTime":"2022-01-04 18:22:00",
"height":0.42,
"type":"low"
},
{
"dateTime":"2022-01-04 23:16:00",
"height":1.83,
"type":"high"
}
]
},
{
"dateTime":"2022-01-05 00:00:00",
"entries":[
{
"dateTime":"2022-01-05 05:39:00",
"height":0.28,
"type":"low"
},
{
"dateTime":"2022-01-05 11:48:00",
"height":2.63,
"type":"high"
},
{
"dateTime":"2022-01-05 19:09:00",
"height":0.44,
"type":"low"
}
]
},
{
"dateTime":"2022-01-06 00:00:00",
"entries":[
{
"dateTime":"2022-01-06 00:05:00",
"height":1.82,
"type":"high"
},
{
"dateTime":"2022-01-06 06:25:00",
"height":0.37,
"type":"low"
},
{
"dateTime":"2022-01-06 12:33:00",
"height":2.53,
"type":"high"
},
{
"dateTime":"2022-01-06 19:53:00",
"height":0.49,
"type":"low"
}
]
},
{
"dateTime":"2022-01-07 00:00:00",
"entries":[
{
"dateTime":"2022-01-07 00:54:00",
"height":1.8,
"type":"high"
},
{
"dateTime":"2022-01-07 07:11:00",
"height":0.49,
"type":"low"
},
{
"dateTime":"2022-01-07 13:16:00",
"height":2.39,
"type":"high"
},
{
"dateTime":"2022-01-07 20:36:00",
"height":0.55,
"type":"low"
}
]
},
{
"dateTime":"2022-01-08 00:00:00",
"entries":[
{
"dateTime":"2022-01-08 01:44:00",
"height":1.78,
"type":"high"
},
{
"dateTime":"2022-01-08 08:00:00",
"height":0.64,
"type":"low"
},
{
"dateTime":"2022-01-08 14:00:00",
"height":2.22,
"type":"high"
},
{
"dateTime":"2022-01-08 21:18:00",
"height":0.59,
"type":"low"
}
]
},
{
"dateTime":"2022-01-09 00:00:00",
"entries":[
{
"dateTime":"2022-01-09 02:39:00",
"height":1.77,
"type":"high"
},
{
"dateTime":"2022-01-09 08:55:00",
"height":0.77,
"type":"low"
},
{
"dateTime":"2022-01-09 14:44:00",
"height":2.06,
"type":"high"
},
{
"dateTime":"2022-01-09 22:01:00",
"height":0.62,
"type":"low"
}
]
}
],
"units":{
"height":"m"
},
"issueDateTime":"2021-10-10 10:09:16",
"carousel":{
"size":2191,
"start":1829
}
}
}
}
But when testing the config I keep getting a “Invalid config for [sensor.rest]: [sensor] is an invalid option for [sensor.rest]. Check: sensor.rest->sensor.” error.
Am I misreading the example? Any thoughts?