maybe not just yet… Answer to self: The following curl command spits out the required data:
curl -X GET "https://www.dus.com/api/sitecore/flightapi/WaitingTimes?lang=de" -H "X-Requested-With:XMLHttpRequest"
The returned data then looks as follows:
{"data":[{"id":1,"name":"Sicherheitskontrolle A","waitingTime":1,"gateTerminal":"A","waitingTimeText":"1 Min"},{"id":2,"name":"Sicherheitskontrolle B","waitingTime":3,"gateTerminal":"B","waitingTimeText":"3 Min"},{"id":3,"name":"Sicherheitskontrolle C","waitingTime":3,"gateTerminal":"C","waitingTimeText":"3 Min"}],"serviceType":"Internal","hasError":false,"internalErrorMessage":"","errorCode":""}
Thanks to ChatGPT I was able to figure out how to add it to HomeAssistant. First create a REST Sensor:
sensor:
- platform: rest
name: "DUS Waiting Times Raw"
resource: "https://www.dus.com/api/sitecore/flightapi/WaitingTimes?lang=de"
headers:
X-Requested-With: "XMLHttpRequest"
scan_interval: 60
value_template: "OK" # Placeholder value
json_attributes:
- data
Then create 3 template sensors within the same (sensor) section:
- platform: template
sensors:
terminal_a_waiting_time:
friendly_name: "DUS Terminal A Waiting Time"
unit_of_measurement: "min"
value_template: >-
{% set items = state_attr('sensor.dus_waiting_times_raw', 'data') | selectattr('gateTerminal', 'equalto', 'A') | list %}
{{ items[0].waitingTime if items else 'unknown' }}
terminal_b_waiting_time:
friendly_name: "DUS Terminal B Waiting Time"
unit_of_measurement: "min"
value_template: >-
{% set items = state_attr('sensor.dus_waiting_times_raw', 'data') | selectattr('gateTerminal', 'equalto', 'B') | list %}
{{ items[0].waitingTime if items else 'unknown' }}
terminal_c_waiting_time:
friendly_name: "DUS Terminal C Waiting Time"
unit_of_measurement: "min"
value_template: >-
{% set items = state_attr('sensor.dus_waiting_times_raw', 'data') | selectattr('gateTerminal', 'equalto', 'C') | list %}
{{ items[0].waitingTime if items else 'unknown' }}
et voila - three new entities with the security waiting times for Düsseldorf airport security. Love it
Regards,
Klayman