Hello folks,
I have also tried with no avail to use this integration.
Not sure what went wrong but my Home Assistant would not restart propperly anymore.
I have then written my own rest yaml code and this works for me. However it is not as simple as having a config file. You would need to adapt my implementation with the timingpointcodes that apply to your needs.
# OVAPI - public transport information
# Utrecht Neude Busstation
- resource: "https://v0.ovapi.nl/tpc/50000360"
scan_interval: 10
sensor:
- name: "utr_neude_debilt_bus1"
value_template: >
{% set busdata = value_json["50000360"]["Passes"].items() | list %}
{% set ns = namespace(count = 1) %}
{% set data = namespace(trips=[]) %}
{% for x in busdata -%}
{%- if x[1]["LinePublicNumber"] == "77" and (x[1]["TripStopStatus"] != "CANCEL") and (x[1]["TripStopStatus"] != "PASSED") and (x[1]["TripStopStatus"] != "ARRIVED") %}
{% set datapoint = ns.count %}{% set line = x[1]["LinePublicNumber"] %}{% set destination = x[1]["DestinationName50"] %}{% set ttd = (((as_timestamp(x[1]["ExpectedDepartureTime"]) - as_timestamp(now())) | round) / 60) | round(0) %}{% set status = x[1]["TripStopStatus"] %}{% set expected = x[1]["ExpectedDepartureTime"] %}{% set data.trips = data.trips + [(ttd, line, destination, status, expected)] %}{% set ns.count = ns.count + 1 %}{% endif %}{%- endfor %}
{% set busses = data.trips | sort(0) %}
{% set bus1 = "nodata" %}
{% set bus2 = "nodata" %}
{% set bus3 = "nodata" %}
{% if (data.trips | count) <1 %}
{% elif (data.trips | count) <2 %}
{% set bus1 = busses[0] %}
{% elif (data.trips | count) <3 %}
{% set bus1 = busses[0] %}
{% set bus2 = busses[1] %}
{% else %}
{% set bus1 = busses[0] %}
{% set bus2 = busses[1] %}
{% set bus3 = busses[2] %}
{% endif %}
{{ bus1 }}
- name: "utr_neude_debilt_bus2"
value_template: >
{% set busdata = value_json["50000360"]["Passes"].items() | list %}
{% set ns = namespace(count = 1) %}
{% set data = namespace(trips=[]) %}
{% for x in busdata -%}
{%- if x[1]["LinePublicNumber"] == "77" and (x[1]["TripStopStatus"] != "CANCEL") and (x[1]["TripStopStatus"] != "PASSED") and (x[1]["TripStopStatus"] != "ARRIVED") %}
{% set datapoint = ns.count %}{% set line = x[1]["LinePublicNumber"] %}{% set destination = x[1]["DestinationName50"] %}{% set ttd = (((as_timestamp(x[1]["ExpectedDepartureTime"]) - as_timestamp(now())) | round) / 60) | round(0) %}{% set status = x[1]["TripStopStatus"] %}{% set expected = x[1]["ExpectedDepartureTime"] %}{% set data.trips = data.trips + [(ttd, line, destination, status, expected)] %}{% set ns.count = ns.count + 1 %}{% endif %}{%- endfor %}
{% set busses = data.trips | sort(0) %}
{% set bus1 = "nodata" %}
{% set bus2 = "nodata" %}
{% set bus3 = "nodata" %}
{% if (data.trips | count) <1 %}
{% elif (data.trips | count) <2 %}
{% set bus1 = busses[0] %}
{% elif (data.trips | count) <3 %}
{% set bus1 = busses[0] %}
{% set bus2 = busses[1] %}
{% else %}
{% set bus1 = busses[0] %}
{% set bus2 = busses[1] %}
{% set bus3 = busses[2] %}
{% endif %}
{{ bus2 }}
- name: "utr_neude_debilt_bus3"
value_template: >
{% set busdata = value_json["50000360"]["Passes"].items() | list %}
{% set ns = namespace(count = 1) %}
{% set data = namespace(trips=[]) %}
{% for x in busdata -%}
{%- if x[1]["LinePublicNumber"] == "77" and (x[1]["TripStopStatus"] != "CANCEL") and (x[1]["TripStopStatus"] != "PASSED") and (x[1]["TripStopStatus"] != "ARRIVED") %}
{% set datapoint = ns.count %}{% set line = x[1]["LinePublicNumber"] %}{% set destination = x[1]["DestinationName50"] %}{% set ttd = (((as_timestamp(x[1]["ExpectedDepartureTime"]) - as_timestamp(now())) | round) / 60) | round(0) %}{% set status = x[1]["TripStopStatus"] %}{% set expected = x[1]["ExpectedDepartureTime"] %}{% set data.trips = data.trips + [(ttd, line, destination, status, expected)] %}{% set ns.count = ns.count + 1 %}{% endif %}{%- endfor %}
{% set busses = data.trips | sort(0) %}
{% set bus1 = "nodata" %}
{% set bus2 = "nodata" %}
{% set bus3 = "nodata" %}
{% if (data.trips | count) <1 %}
{% elif (data.trips | count) <2 %}
{% set bus1 = busses[0] %}
{% elif (data.trips | count) <3 %}
{% set bus1 = busses[0] %}
{% set bus2 = busses[1] %}
{% else %}
{% set bus1 = busses[0] %}
{% set bus2 = busses[1] %}
{% set bus3 = busses[2] %}
{% endif %}
{{ bus3 }}
My TimingPointCode of interest is: 50000360
Line Number I am interested in is: 77
I only want to see the next 3 departure times.
I also exclude departure records that contain CANCEL, PASS or ARRIVED as these do not add value if I want to see when the next bus will depart.
If you can reuse my code, feel free.
Here is a UI visualisation I use for these results:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: custom:mushroom-title-card
title: Schedule 77 Neude
- type: vertical-stack
cards:
- type: custom:mushroom-template-card
primary: >-
{% if states("sensor.utr_neude_debilt_bus1") == "nodata" %}"No
Data Available"{% else %}Next Bus in {{
states("sensor.utr_neude_debilt_bus1").replace("(",
"").replace(")", "").replace("'", "").split(',')[0] }} minutes{%
endif %}
secondary: >-
{% if states("sensor.utr_neude_debilt_bus1") == "nodata" %}"No
Data Available"{% else %}{{
states("sensor.utr_neude_debilt_bus1").replace("(",
"").replace(")", "").replace("'", "").split(',')[1] }} {{
states("sensor.utr_neude_debilt_bus1").replace("(",
"").replace(")", "").replace("'", "").split(',')[2] }}
{{ states("sensor.utr_neude_debilt_bus1").replace("(",
"").replace(")", "").replace("'", "").split(',')[3] }}{% endif %}
icon: mdi:bus-clock
multiline_secondary: true
entity: sensor.utr_neude_debilt_bus1
icon_color: >-
{% if states("sensor.utr_neude_debilt_bus1") == "nodata" %}grey{%
elif states("sensor.utr_neude_debilt_bus1").replace("(",
"").replace(")", "").replace("'", "").split(',')[3] | trim ==
"DRIVING" %}green{% else %}blue{% endif %}
tap_action:
action: more-info
hold_action:
action: none
double_tap_action:
action: none
- type: custom:mushroom-template-card
primary: >-
{% if states("sensor.utr_neude_debilt_bus2") == "nodata" %}"No
Data Available"{% else %}Bus in {{
states("sensor.utr_neude_debilt_bus2").replace("(",
"").replace(")", "").replace("'", "").split(',')[0] }} minutes{%
endif %}
secondary: >-
{% if states("sensor.utr_neude_debilt_bus2") == "nodata" %}"No
Data Available"{% else %}{{
states("sensor.utr_neude_debilt_bus2").replace("(",
"").replace(")", "").replace("'", "").split(',')[1] }} {{
states("sensor.utr_neude_debilt_bus1").replace("(",
"").replace(")", "").replace("'", "").split(',')[2] }}
{{ states("sensor.utr_neude_debilt_bus2").replace("(",
"").replace(")", "").replace("'", "").split(',')[3] }}{% endif %}
icon: mdi:bus-clock
multiline_secondary: true
entity: sensor.utr_neude_debilt_bus2
icon_color: >-
{% if states("sensor.utr_neude_debilt_bus2") == "nodata" %}grey{%
elif states("sensor.utr_neude_debilt_bus2").replace("(",
"").replace(")", "").replace("'", "").split(',')[3] | trim ==
"DRIVING" %}green{% else %}blue{% endif %}
tap_action:
action: more-info
hold_action:
action: none
double_tap_action:
action: none
- type: custom:mushroom-template-card
primary: >-
{% if states("sensor.utr_neude_debilt_bus3") == "nodata" %}"No
Data Available"{% else %}Bus in {{
states("sensor.utr_neude_debilt_bus3").replace("(",
"").replace(")", "").replace("'", "").split(',')[0] }} minutes{%
endif %}
secondary: >-
{% if states("sensor.utr_neude_debilt_bus3") == "nodata" %}"No
Data Available"{% else %}{{
states("sensor.utr_neude_debilt_bus3").replace("(",
"").replace(")", "").replace("'", "").split(',')[1] }} {{
states("sensor.utr_neude_debilt_bus1").replace("(",
"").replace(")", "").replace("'", "").split(',')[2] }}
{{ states("sensor.utr_neude_debilt_bus3").replace("(",
"").replace(")", "").replace("'", "").split(',')[3] }}{% endif %}
icon: mdi:bus-clock
multiline_secondary: true
entity: sensor.utr_neude_debilt_bus3
icon_color: >-
{% if states("sensor.utr_neude_debilt_bus3") == "nodata" %}grey{%
elif states("sensor.utr_neude_debilt_bus3").replace("(",
"").replace(")", "").replace("'", "").split(',')[3] | trim ==
"DRIVING" %}green{% else %}blue{% endif %}
tap_action:
action: more-info
hold_action:
action: none
double_tap_action:
action: none
Bon Chance and happy coding