National Rail Integration Fork of jfparis

Thanks for this integration! I have an issue where the custom cards show in my dashboard for a while and then disappear. The entities are definitely pulling data from the Darwin API correctly. I can’t work out why.

Can you show me what it looks like when it disappears? Do you get any errors?

There’s nothing at all. It’s as if they don’t exist. There’s no error posted. I’ve tried re-adding the entities, re-adding the cards and rebooting the server.

Can you open the dashboard in chrome, open the developer settings (F12, or select from the chrome settings menu) I think Edge/IE have the same.

Open the console tab and paste any errors here?

mushroom.js?hacstag=444350375421:309 :mushroom: Mushroom :mushroom: - 4.2.1
nationalrail.js?hacstag=89053043376:328 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘displayName’)
at NationalRailCard.render (nationalrail.js?hacstag=89053043376:328:60)
at NationalRailCard.update (lit-element.js?module:160:33)
at NationalRailCard.performUpdate (updating-element.js?module:475:12)
at NationalRailCard._enqueueUpdate (updating-element.js?module:437:25)
render @ nationalrail.js?hacstag=89053043376:328
update @ lit-element.js?module:160
performUpdate @ updating-element.js?module:475
_enqueueUpdate @ updating-element.js?module:437
await in _enqueueUpdate
requestUpdate @ updating-element.js?module:416
set @ updating-element.js?module:161
setConfig @ nationalrail.js?hacstag=89053043376:86
u @ create-element-base.ts:153
(anonymous) @ create-element-base.ts:179
d @ create-element-base.ts:285
l @ create-element-base.ts:242
v @ create-card-element.ts:105
value @ hui-card.ts:123
value @ hui-card.ts:42
value @ hui-section.ts:70
(anonymous) @ hui-section.ts:277
value @ hui-section.ts:276
value @ hui-section.ts:198
value @ hui-section.ts:98
performUpdate @ reactive-element.ts:1327
scheduleUpdate @ reactive-element.ts:1261
_$Ej @ reactive-element.ts:1233
await in _$Ej
requestUpdate @ reactive-element.ts:1208
set @ reactive-element.ts:726
j @ lit-html.ts:1883
_$AI @ lit-html.ts:1825
v @ lit-html.ts:1192
g @ lit-html.ts:1540
_$AI @ lit-html.ts:1384
v @ lit-html.ts:1192
g @ lit-html.ts:1540
_$AI @ lit-html.ts:1384
Z @ lit-html.ts:2183
update @ lit-element.ts:165
performUpdate @ reactive-element.ts:1329
scheduleUpdate @ reactive-element.ts:1261
_$Ej @ reactive-element.ts:1233
await in _$Ej
requestUpdate @ reactive-element.ts:1208
set @ reactive-element.ts:726
value @ hui-dialog-edit-card.ts:326
handleEvent @ lit-html.ts:2018
r @ fire_event.ts:76
(anonymous) @ hui-element-editor.ts:102
Promise.then
value @ hui-element-editor.ts:101
value @ hui-element-editor.ts:89
value @ hui-element-editor.ts:321
(anonymous) @ hui-element-editor.ts:370
fireEvent @ nationalrail.js?hacstag=89053043376:19
_valueChanged @ nationalrail.js?hacstag=89053043376:867
handleEvent @ parts.js?module:462
EventPart.__boundHandleEvent @ parts.js?module:428
r @ fire_event.ts:76
(anonymous) @ ha-form.ts:210
r @ fire_event.ts:76
(anonymous) @ ha-entity-picker.ts:419
setTimeout
value @ ha-entity-picker.ts:418
value @ ha-entity-picker.ts:404
handleEvent @ lit-html.ts:2018
r @ fire_event.ts:76
value @ ha-combo-box.ts:323
handleEvent @ lit-html.ts:2018
x @ property-effects.js:328
R @ property-effects.js:353
E @ property-effects.js:176
(anonymous) @ property-effects.js:263
_propertiesChanged @ property-effects.js:1925
_propertiesChanged @ vaadin-combo-box-mixin.js:446
_flushProperties @ properties-changed.js:384
_invalidateProperties @ property-effects.js:1748
Object.defineProperty.set @ properties-changed.js:170
_selectedItemChanged @ vaadin-combo-box-mixin.js:1130
Y @ property-effects.js:1038
O @ property-effects.js:140
_propertiesChanged @ property-effects.js:1922
_propertiesChanged @ vaadin-combo-box-mixin.js:446
_flushProperties @ properties-changed.js:384
_invalidateProperties @ property-effects.js:1748
Object.defineProperty.set @ properties-changed.js:170
_commitValue @ vaadin-combo-box-mixin.js:977
_onClosed @ vaadin-combo-box-mixin.js:968
_openedChanged @ vaadin-combo-box-mixin.js:623
N @ property-effects.js:231
O @ property-effects.js:140
_propertiesChanged @ property-effects.js:1922
_propertiesChanged @ vaadin-combo-box-mixin.js:446
_flushProperties @ properties-changed.js:384
_invalidateProperties @ property-effects.js:1748
Object.defineProperty.set @ properties-changed.js:170
close @ vaadin-combo-box-mixin.js:431
_overlaySelectedItemChanged @ vaadin-combo-box-mixin.js:1334
__onItemClick @ vaadin-combo-box-scroller-mixin.js:357
nationalrail.js?hacstag=89053043376:686 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘st’)
at NationalRailCard.createRow (nationalrail.js?hacstag=89053043376:686:51)
at NationalRailCard.renderRows (nationalrail.js?hacstag=89053043376:649:22)
at NationalRailCard.render (nationalrail.js?hacstag=89053043376:332:24)
at NationalRailCard.update (lit-element.js?module:160:33)
at NationalRailCard.performUpdate (updating-element.js?module:475:12)
at NationalRailCard._enqueueUpdate (updating-element.js?module:437:25)
createRow @ nationalrail.js?hacstag=89053043376:686
renderRows @ nationalrail.js?hacstag=89053043376:649
render @ nationalrail.js?hacstag=89053043376:332
update @ lit-element.js?module:160
performUpdate @ updating-element.js?module:475
_enqueueUpdate @ updating-element.js?module:437
await in _enqueueUpdate
requestUpdate @ updating-element.js?module:416
set @ updating-element.js?module:161
setConfig @ nationalrail.js?hacstag=89053043376:86
u @ create-element-base.ts:153
(anonymous) @ create-element-base.ts:179
d @ create-element-base.ts:285
l @ create-element-base.ts:242
v @ create-card-element.ts:105
value @ hui-card.ts:123
value @ hui-card.ts:42
value @ hui-section.ts:70
(anonymous) @ hui-section.ts:277
value @ hui-section.ts:276
value @ hui-section.ts:198
value @ hui-section.ts:98
performUpdate @ reactive-element.ts:1327
scheduleUpdate @ reactive-element.ts:1261
_$Ej @ reactive-element.ts:1233
await in _$Ej
requestUpdate @ reactive-element.ts:1208
set @ reactive-element.ts:726
j @ lit-html.ts:1883
_$AI @ lit-html.ts:1825
v @ lit-html.ts:1192
g @ lit-html.ts:1540
_$AI @ lit-html.ts:1384
v @ lit-html.ts:1192
g @ lit-html.ts:1540
_$AI @ lit-html.ts:1384
Z @ lit-html.ts:2183
update @ lit-element.ts:165
performUpdate @ reactive-element.ts:1329
scheduleUpdate @ reactive-element.ts:1261
_$Ej @ reactive-element.ts:1233
await in _$Ej
requestUpdate @ reactive-element.ts:1208
set @ reactive-element.ts:726
value @ hui-dialog-edit-card.ts:326
handleEvent @ lit-html.ts:2018
r @ fire_event.ts:76
(anonymous) @ hui-element-editor.ts:102
Promise.then
value @ hui-element-editor.ts:101
value @ hui-element-editor.ts:89
value @ hui-element-editor.ts:321
(anonymous) @ hui-element-editor.ts:370
fireEvent @ nationalrail.js?hacstag=89053043376:19
_valueChanged @ nationalrail.js?hacstag=89053043376:867
handleEvent @ parts.js?module:462
EventPart.__boundHandleEvent @ parts.js?module:428
r @ fire_event.ts:76
(anonymous) @ ha-form.ts:210
r @ fire_event.ts:76
value @ ha-selector-select.ts:293
handleEvent @ lit-html.ts:2018
(anonymous) @ form-element.ts:116
nationalrail.js?hacstag=89053043376:686 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘st’)
at NationalRailCard.createRow (nationalrail.js?hacstag=89053043376:686:51)
at NationalRailCard.renderRows (nationalrail.js?hacstag=89053043376:649:22)
at NationalRailCard.render (nationalrail.js?hacstag=89053043376:332:24)
at NationalRailCard.update (lit-element.js?module:160:33)
at NationalRailCard.performUpdate (updating-element.js?module:475:12)
at NationalRailCard._enqueueUpdate (updating-element.js?module:437:25)
createRow @ nationalrail.js?hacstag=89053043376:686
renderRows @ nationalrail.js?hacstag=89053043376:649
render @ nationalrail.js?hacstag=89053043376:332
update @ lit-element.js?module:160
performUpdate @ updating-element.js?module:475
_enqueueUpdate @ updating-element.js?module:437
await in _enqueueUpdate
requestUpdate @ updating-element.js?module:416
set @ updating-element.js?module:161
setConfig @ nationalrail.js?hacstag=89053043376:86
u @ create-element-base.ts:153
(anonymous) @ create-element-base.ts:179
d @ create-element-base.ts:285
l @ create-element-base.ts:242
v @ create-card-element.ts:105
value @ hui-card.ts:123
value @ hui-card.ts:42
value @ hui-section.ts:70
(anonymous) @ hui-section.ts:277
value @ hui-section.ts:276
value @ hui-section.ts:198
value @ hui-section.ts:98
performUpdate @ reactive-element.ts:1327
scheduleUpdate @ reactive-element.ts:1261
_$Ej @ reactive-element.ts:1233
await in _$Ej
requestUpdate @ reactive-element.ts:1208
_$Eu @ reactive-element.ts:946
w @ reactive-element.ts:931
i @ hui-section.ts:37
k @ scoped-custom-element-registry.js:385
t @ scoped-custom-element-registry.js:236
value @ hui-view.ts:109
(anonymous) @ hui-view.ts:338
value @ hui-view.ts:337
value @ hui-view.ts:242
value @ hui-view.ts:156
performUpdate @ reactive-element.ts:1327
scheduleUpdate @ reactive-element.ts:1261
_$Ej @ reactive-element.ts:1233
await in _$Ej
requestUpdate @ reactive-element.ts:1208
_$Eu @ reactive-element.ts:946
w @ reactive-element.ts:931
i @ hui-view.ts:62
k @ scoped-custom-element-registry.js:385
t @ scoped-custom-element-registry.js:236
value @ hui-root.ts:937
(anonymous) @ hui-root.ts:611
setTimeout
(anonymous) @ render-status.ts:2
requestAnimationFrame
r @ render-status.ts:2
value @ hui-root.ts:611
_$AE @ reactive-element.ts:1378
performUpdate @ reactive-element.ts:1343
scheduleUpdate @ reactive-element.ts:1261
_$Ej @ reactive-element.ts:1233
await in _$Ej
requestUpdate @ reactive-element.ts:1208
set @ reactive-element.ts:726
j @ lit-html.ts:1883
_$AI @ lit-html.ts:1825
v @ lit-html.ts:1192
g @ lit-html.ts:1540
_$AI @ lit-html.ts:1384
Z @ lit-html.ts:2183
update @ lit-element.ts:165
performUpdate @ reactive-element.ts:1329
scheduleUpdate @ reactive-element.ts:1261
_$Ej @ reactive-element.ts:1233
await in _$Ej
requestUpdate @ reactive-element.ts:1208
set @ reactive-element.ts:726
value @ ha-panel-lovelace.ts:446
saveConfig @ ha-panel-lovelace.ts:390
value @ hui-dialog-edit-card.ts:415
handleEvent @ lit-html.ts:2018

Thanks! It looks like it’s all the details aren’t on the entity attributes. Can you let me know the stations you’ve set up with? Feel free to PM me if you don’t want to share publically.

No prob Weybridge (Wyb) and Waterloo (Wat) and vice versa. Thanks!

Just to add I created a card for EUS - MAN and it works. It previews the departure board in the card configuration GUI when you go through process of creating. This doesn’t happen for WYB - WAT.

Ill try those stations and see what happens/fix

1 Like

So it seems the API is returning trains between those stations but saying they terminate at Barnes. This is throwing my processing off.

I’ll update to remove the train from the list if the destination isn’t found in the calling points.

Will provide an an update in a bit when I have released a fix

I have updated (pushed changes) to remove these trains. I don’t think this is correct but it allows the integration and card to function correctly.

Need to look in to why the API is returning details like this.

1 Like

That has worked. Thank you! I think it’s because there is quirk at Wyb. There are mainline services on SWR that stop at Wyb but there is also the ‘loop’ service that runs on a branch line. It starts/terminates at Weybridge but goes out through Barnes to Waterloo on a different line. These services are not advertised as Weybridge services to stop people making the mistake of getting very slow trains to/from Waterloo when mainline services are available.