morosanmihail / ha-londontfl Goto Github PK
View Code? Open in Web Editor NEWSimple sensor for Home Assistant to retrieve departures from Transport for London stations.
License: MIT License
Simple sensor for Home Assistant to retrieve departures from Transport for London stations.
License: MIT License
Hi,
Installed the integration today. Itβs showing, but the times are 1 hr earlier. Not sure if this is because itβs in GMT vs. BST. Can this be changed manually somehow?
Tks
Hey,
Great extension!
I have tried with the DLR line and it works, but I can't get any data for Southeastern. Tried few stations (e.g. Lewisham) but there is no data for the whole day.
Any idea?
Thanks
Is it possible to add Thameslink data?
I'm not sure if it's provided by the TfL API or not, though.
Thanks
Great integration!
It's working for central line with Stratford station, however it doesn't seem to pull Greater Anglia stations. The sensor is generated and updating, but there are no attributes.
When I use a platform filter when adding a station I end up with no entity and this error in the logs.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 737, in async_device_update
await task
File "/config/custom_components/london_tfl/sensor.py", line 160, in async_update
self._tfl_data.populate(result, self.filter_platform)
File "/config/custom_components/london_tfl/tfl_data.py", line 35, in populate
self.filter_by_platform(filter_platform)
File "/config/custom_components/london_tfl/tfl_data.py", line 54, in filter_by_platform
self._raw_result = [
File "/config/custom_components/london_tfl/tfl_data.py", line 56, in <listcomp>
if item['platformName'] == self.filter_platform
AttributeError: 'TfLData' object has no attribute 'filter_platform'
I wasn't sure of the format to use for the platform filter so I tried a few variations of Platform 2
and none of them worked. Without the filter it works fine.
Since the switch to summer time a few weeks ago, the time to station is seems not to calculate properly anymore.
Last refresh 12 April 2022, 23:28:34
Departures
- time_to_station: 1383m 25s platform: Platform 2 line: Platform 2 direction: 0 departure: '2022-04-12T22:32:00Z' destination: Bank DLR Station time: '1383' expected: '2022-04-12T22:32:00Z
The time on my HA is set to Europe/London, current TZ=BST. If I switch to view next departure time, rather than time to station, the the time display properly. Issue started the day after we switched to BST.
Can you have a look when you have a few minutes?
Do you have a copy of the yaml you used to configure the custom:hasl-departure-card
in the Readme?
I copied the YAML example from their repo and went from there, but nothing appears to be sticking - I am just left with a blank card.
Data is definitely coming through, as I am able to use the upcoming-media
card with no issues (I just prefer the look of the HACS one π )
ETA: Both this integration and the HASL card added through HACS
Hi. I have added two stations on the TfL Tram network but the status for both are just showing "none".
Integration stopped working overnight. Might be that TfL API was changed or got broken?
So this night the following log was produced:
Logger: homeassistant.helpers.entity
Source: custom_components/london_tfl/tfl_data.py:61
Integration: London TfL ([documentation](https://github.com/morosanmihail/HA-LondonTfL), [issues](https://github.com/morosanmihail/HA-LondonTfL/issues))
First occurred: 01:57:32 (1 occurrences)
Last logged: 01:57:32
Update for sensor.london_tfl_tfl_rail_910ghayesah fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 515, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 743, in async_device_update
raise exc
File "/config/custom_components/london_tfl/sensor.py", line 178, in async_update
self._tfl_data.sort_data(self.max_items)
File "/config/custom_components/london_tfl/tfl_data.py", line 60, in sort_data
self._api_json = sorted(
File "/config/custom_components/london_tfl/tfl_data.py", line 61, in <lambda>
self._raw_result, key=lambda i: i['expectedArrival'], reverse=False
TypeError: string indices must be integers
I tried to remove and re-add the integration, but that fails with the following:
Logger: aiohttp.server
Source: custom_components/london_tfl/config_flow.py:56
Integration: London TfL ([documentation](https://github.com/morosanmihail/HA-LondonTfL), [issues](https://github.com/morosanmihail/HA-LondonTfL/issues))
First occurred: 10:49:55 (3 occurrences)
Last logged: 10:51:11
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 222, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 219, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 173, in post
return await super().post(request)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 70, in post
result = await self._flow_mgr.async_init(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 205, in async_init
flow, result = await task
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 232, in _async_init
result = await self._async_handle_step(flow, flow.init_step, data, init_done)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 335, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/config/custom_components/london_tfl/config_flow.py", line 56, in async_step_user
lines = {item['id']: item['name'] for item in result}
File "/config/custom_components/london_tfl/config_flow.py", line 56, in <dictcomp>
lines = {item['id']: item['name'] for item in result}
TypeError: string indices must be integers
It appears data is not pulling correctly for some stations on the Northern Line.
For example, 'Euston' pulls properly, but 'Battersea Power Station', 'Nine Elms' or 'Bank' don't.
I sort of understand why Bank doesn't (it currently is closed on the Northern Line) but the other two operate as normal, and they return data sucessfully in the tfl api.
Not sure what the issue is: the entities do not have their names converted automatically, but I can see the NaptanID is correct:
Firstly thanks for the great custom component - so easy to install, configure and use with the HASL card.
I used to use the built in UK transport integration for bus times but since the API hits/day limit was reduced from 1000 to 30 (!) its become useless for departure times (and pretty much anything else either).
Just wondered if you have any plans to extend the component to support buses, or indeed any other the other API capabilities?
I would think Buses would follow the same pattern as tube - select bus route, then select stop.
Logger: homeassistant.helpers.entity
Source: helpers/entity.py:519
First occurred: 16:05:51 (1 occurrences)
Last logged: 16:05:51
Updating state for sensor.london_tfl_jubilee_940gzzluwhp (<class 'custom_components.london_tfl.sensor.LondonTfLSensor'>) took 0.548 seconds. Please report it to the custom integration author.
Has been okay for a while but since update now getting WARNING in Log relating to speed of state update
It would be good to add the mdi:tram icon as default for trams rather than using the default train icon.
Hi,
It would be incredibly useful to include bus stop arrivals in this integration! - Unfortunately I'm not a developer myself but if there's anything I can do testing-wise I'd be happy to help of course
Great intergration - i have been using node-red and mqtt to attempt to do the same thing. Obviously an HA intergration is better!
I've added two lines H&C and Circle Line both with Latimer Road. Although it is the correct ID it displays as Edgeware Road as the default for Circle and Hammersmith for H&C.
Not too much trouble to change it manually but is confusing at first.
Thanks again for the effort!
I am looking at the Northern line, and some stations are giving the following problems which can be annoying.
Firstly there is the Southbound - Platform 4
which could be shortened
Then there is the Underground Station
part which can be removed
I want to see how to add configuration to allow users to omit certain phrases with blank spaces for the destinations, as well as for the platform.
@morosanmihail I'm new to HASS modifications, however I'm happy to see where I could make the requested changes, if there are more bits that need changes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.