I’m trying to get a rest sensor working with 2 variables in the payload. yesterday and tomorrow.
if i fill in the dates manual its working, but i don’t know how to do this with templates/ or something else.
In the working config below i would like to change 2021-11-02 to [yesterday] and 2021-11-03 to [tomorrow].
- platform: rest
name: "frank_energy_prices"
resource: https://frank-api.nl/graphql
method: POST
value_template: "{{ value_json.data.marketPricesElectricity[0].priceIncludingMarkup }}"
payload: '{"query": "query MarketPrices { marketPricesElectricity(startDate: \"2021-11-02\" endDate: \"2021-11-04\") { till from marketPrice priceIncludingMarkup } }"}'
scan_interval: 60
headers:
Content-Type: application/json
json_attributes:
- data
I’m now trying to do this with the commandline sensor, but i have some issues with the variables. if i run the script direct in the console of hassos it works, but not if i start it from the commandline sensor.
the TODAY variable is working, but not the TOMORROW & YESTERDAY variables.