sensor:
rest:
resource_template : https://api.open-meteo.com/v1/meteofrance?latitude={{ state_attr('device_tracker.ioniq_5_location', 'latitude') }}&longitude={{ state_attr('device_tracker.ioniq_5_location', 'longitude') }}¤t=temperature_2m&timezone=auto
scan_interval: 900
sensor:
- name: "outsidetemp_ioniq5"
value_template: "{{ value_json['current']['temperature_2m'] }}"
unit_of_measurement: "°C"
#were am i going wrong with this
1 messages · Page 1 of 1 (latest)
tried this instead too and no cigar
scan_interval: 900
sensor:
- name: temp_outside_ioniq5"
value_template: "{{ value_json['current'] }}"
unit_of_measurement: "°C"```
Why have you made a sensor key under the rest key? Should just be name and value_template
Like the examples on the rest integration page
sensor:
- platform: rest
resource: http://ip.jsontest.com
name: External IP
value_template: "{{ value_json.ip }}"
I am basically just trying to pull temp from cars location were ever it is.
ill try that
was basing it of this sensor that does not work for my location
- resource_template : https://api.open-meteo.com/v1/meteofrance?latitude={{ state_attr('device_tracker.ev6_location', 'latitude') }}&longitude={{ state_attr('device_tracker.ev6_location', 'longitude') }}¤t=temperature_2m&timezone=auto
scan_interval: 900
sensor:
- name: "meteofrance_kia_ev6"
value_template: "{{ value_json['current']['temperature_2m'] }}"
unit_of_measurement: "°C"```
Not sure if this is your only problem, but you have a space between resource_template and the colon (:)
nope but here is the results of the correct url https://api.pirateweather.net/forecast/z7IVWeCj32O98XvvTfhvy06SIf73NNmA/51.32234547689273%2C 0.880053894814543
I just want the sensor to add the temprature from location of the car.
OK well first thing you should do is pull out that resource template into developer tools template editor and double check it's returning the right url
The results in that template would get you this URL:
Looks like you’ve posted templates for both, actually. Which one are you really using?
pirate weather as meteo does not support my location
the meteo one is a working sample from someone else i was trying to replicate
even this template shows in dev tools as value json is undefined
Not the whole thing, just the resource_template
so if I use a working meteo url and put this in dev template editor
platform: rest
resource: https://api.open-meteo.com/v1/meteofrance?latitude={{ state_attr('device_tracker.ioniq_5_location', 'latitude') }}&longitude={{ state_attr('device_tracker.ioniq_5_location', 'longitude') }}¤t=temperature_2m&wind_speed_unit=mph&timezone=GMT
scan_interval: 900
name: outsidetemp_ioniq5
value_template: "{{ value_json['current']['temperature_2m'] }}"
No
Just put everything after "resource_template:" from your non-working example into the template editor
same thing value_json undefined
so for example the resource is working on meteo https://api.open-meteo.com/v1/forecast?latitude=51.3148&longitude=0.8886¤t=temperature_2m&timezone=GMT
the template without the value template tells me it watching for changes to location
but the moment I add the value template to try to get it to get temprature from resource it has a hissy fit.
Yeah. Like I said... 5 times now you should only put the resource template in there. Everything else is meaningless at this point
Now take that constructed url from the template editor and put it in your browser
yes that gives me the values, but I want them values to create a template sensor
to pull the temprature in based on this
What does the url give you in your browser
{"latitude":51.32,"longitude":0.87999964,"generationtime_ms":0.012993812561035156,"utc_offset_seconds":0,"timezone":"GMT","timezone_abbreviation":"GMT","elevation":12.0,"current_units":{"time":"iso8601","interval":"seconds","temperature_2m":"°C"},"current":{"time":"2024-12-13T09:00","interval":900,"temperature_2m":4.0}}
OK that's good, it's returning something sensible at least
So the next thing I would do is making sure you are using the right keys. I see no option to have sensor as a key in a rest sensor
You just define name, value_template etc at the same level as resource_template
I got it working by adapting conditions to pirate weather, but a lot more code