Hi,
What I’m trying to do is retrieve two times from a simple REST API, and do some automations with it
My JSON looks like this
{
"start": "20:33",
"stop": "20:34"
}
When I use the this code in my sensors.yaml
- platform: rest
resource: MyURL
name: starting_time_from_rest
device_class: timestamp
value_template: "{{ today_at(value_json.start) }}"
scan_interval: 10
The value of the starting_time_from_rest
is formatted like this 2023-02-25T19:33:00+00:00
.
I can create an automation based on this and this works fine.
But because I need 2 sensors from the same API end point, but I don’t want to poll the same endpoint twice. After reading the docs I ended up with this code in my configuration.yaml . (Doesn’t work when I put it in sensors.yaml)
rest:
scan_interval: 10
resource: MyURL
sensor:
- name: "starting_time_from_rest"
value_template: "{{ today_at(value_json.start) }}"
- name: "stopping_time_from_rest"
value_template: "{{ today_at(value_json.stop) }}"
But now the value of the starting_time_from_rest
is formatted like this 2023-02-25 20:33:00+01:00
, so the time went one hour up and +00:00 changed to +00:00 (differant timezones?) and now the automation doesn’t work anymore.
Again no clue why this is the case and how to fix this… Any help here?