I have a multi-part return journey each day, and it’d be really helpful to get a notification about what’s happening with my route. So far, I’ve got part of it working, but I need some guidance!
I started with this:
sensor:
- platform: uk_transport
app_id: !secret ukt_app_id
app_key: !secret ukt_app_key
scan_interval: 3600
queries:
# Journey 1
- mode: train
origin: GLO # Glossop http://www.railwaycodes.org.uk/crs/CRSg.shtm
destination: MAN # Man Piccadilly http://www.railwaycodes.org.uk/crs/CRSm.shtm
- mode: train
origin: MAN # Glossop http://www.railwaycodes.org.uk/crs/CRSg.shtm
destination: SPT # Stockport http://www.railwaycodes.org.uk/crs/CRSs.shtm
# Journey 2
- mode: train
origin: SPT # Stockport http://www.railwaycodes.org.uk/crs/CRSs.shtm
destination: MAN # Glossop http://www.railwaycodes.org.uk/crs/CRSg.shtm
- mode: train
origin: MAN # Man Piccadilly http://www.railwaycodes.org.uk/crs/CRSm.shtm
destination: GLO # Glossop http://www.railwaycodes.org.uk/crs/CRSg.shtm
So, this works but I get two sensor responses called sensor.next_train_to_man
and sensor.next_train_to_man_2
. I thought I could change the sensor:
prefix to look like this:
sensor out:
- platform: uk_transport
app_id: !secret ukt_app_id
app_key: !secret ukt_app_key
scan_interval: 3600
queries:
# Journey 1
- mode: train
origin: GLO # Glossop http://www.railwaycodes.org.uk/crs/CRSg.shtm
destination: MAN # Man Piccadilly http://www.railwaycodes.org.uk/crs/CRSm.shtm
- mode: train
origin: MAN # Glossop http://www.railwaycodes.org.uk/crs/CRSg.shtm
destination: SPT # Stockport http://www.railwaycodes.org.uk/crs/CRSs.shtm
sensor in:
- platform: uk_transport
app_id: !secret ukt_app_id
app_key: !secret ukt_app_key
scan_interval: 3600
queries:
# Journey 2
- mode: train
origin: SPT # Stockport http://www.railwaycodes.org.uk/crs/CRSs.shtm
destination: MAN # Glossop http://www.railwaycodes.org.uk/crs/CRSg.shtm
- mode: train
origin: MAN # Man Piccadilly http://www.railwaycodes.org.uk/crs/CRSm.shtm
destination: GLO # Glossop http://www.railwaycodes.org.uk/crs/CRSg.shtm
That didn’t help
Is there any way to force the name of the sensor that is returned? Ideally, I’d have sensor.next_train_from_glo_to_man
and sensor.next_train_from_spt_to_man
…
The reason I need to have the extra context is because the outbound journey happens sometime between 05:30 and 07:45, and the inbound happens sometime between 14:30 and 16:45, so I only really need to get the “next train times” in those slots, so I wanted to use an automation to run those checks then, to keep my API limits down (four sensors are killing me )