teknisksupport / home-assistant-resrobot Goto Github PK
View Code? Open in Web Editor NEWGet departure times for swedish public transportation
Get departure times for swedish public transportation
Logger: homeassistant.components.sensor
Source: custom_components/resrobot/sensor.py:163
Integration: Sensor (documentation, issues)
First occurred: 10:20:36 (6 occurrences)
Last logged: 10:20:37
resrobot: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 357, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
await task
File "/config/custom_components/resrobot/sensor.py", line 163, in async_update
trips = self.filterResults(self._result['Departure'])
KeyError: 'Departure'
Jag har inte gjort några förändringar av integrationen men den uppdaterar inte sensorn längre.
Make adjustments to account for the new API
https://trafiklab.se/api/trafiklab-apis/resrobot-v21/migration-guide/
Changes compared to ResRobot v2.0:
The data previously found in Product can now be found in ProductAtStop
Product is now wrapped in an array
TransportNumber is no longer included. Use ProductAtStop.num or ProductAtStop.displayNumber instead.
JourneyStatus and JourneyDetailRef have been added
Type has a different meaning and different possible values. This field used to indicate the type of the departing/arriving journey, but now indicates the type of location for this departure/arrival
Any applications which made use of the internal ids (id and stopid) should switch over to using the public ids (extId and stopExtId) instead.
Is it possible to get realtime data from buss gps?
The sensors shows no value after latest home assistant update.
mdi:tram
mdi:train
mdi:subway
mdi:ferry
mdi:bus
and so on
Allow for filter types for direction property
examples:
filter:
- line: 4
direction: Centralstationen
type: must_not
filter:
- line: 4
direction: Centralstationen
type: must
filter:
- line: 4
direction: Central
type: contains
It sends too many requests, we will hit max requests per month before end of month with defailt configuration
Trying to use filters to get only specific trains doesn't seem to work, it returns all results, not just the ones in "must". My config is as follows.
- platform: resrobot
key: !secret trafiklab_resrobot_api
fetch_interval: 3
departures:
- stop_id: 740000260
name: Tåg till Malmö - Resrobot
max_journeys: 5
sensors: 5
unit: "🕑"
time_format: "%H:%M"
filter:
- means_of_transport: 2
- means_of_transport: 4
type: "must"
direction: "Malmö"
Hello!
Thank you for a great tool. I used it successfully in my old apartment to track buses from Malmö to Lund with no issues. However, now I try to track SkåneExpressen buss 1 from Malmö C towards Kristianstad. And I think I've tried everything but I haven't been able to find the times yet (tried line 001, tried a different stop_id etc). I don't know if it's caused by a special type of buss (e.g. it's skåneexpressen - I'm not sure that is a factor) or what it might be.
Any tips are welcome!
Thank you in advance,
sensor bussarna:
In order to minimize API calls and follow best practices to minimize requests, it would be great if this component exposed a way for the fetch interval to be changed dynamically, such as from an automation that stops or slows down fetching during the night.
Suggestions:
fetch_interval
as a separate number entity; orfetch_interval
in the config to be the name of an existing entity (like a template sensor or an input number)update_interval<=0
to mean: stop updating completelyFetch departures with time offset (now + x minutes)
also consider adding the offset to #1
It is really out of date
This import has changed in Home Assistant, and with block the integration from starting on > 2021.3.0.
Since it was not used, it need to be removed in this PR.
For more information look att Lallassu/smhialert#7
Jag får error: Entiniteten är ej tillgänglig: sensor.next_bus_departures_0
Home Assistant: core-2022.2.6
Beta 0.13 does only get value for sensor 0.
No error in logs
Solution proposal
Iterate over sensors and check departure time
if now > departureTime then reset states and attributes, rename sensor to name_of_sensors_[n]+1.
then iterate over all sensors and rename n-1
After i added the nullification of data in the sensors (when no matching lines any more)
some things may or may not break
Testing needed
If you want, I can contribute some advanced CI to your repository in a PR. Let me know if you want that.
Hey, I am getting recurring warnings in the logs about state attributes exceeding the maximum size. This happens for each sensor that I am adding.
Is there any way to remedy this?
Example log error:
2024-01-19 10:34:59.061 WARNING (Recorder) [homeassistant.components.recorder.db_schema] State attributes for sensor.helper_buss_till_botulfsplatsen exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
2024-01-19 10:34:59.062 WARNING (Recorder) [homeassistant.components.recorder.db_schema] State attributes for sensor.helper_bussar_fran_gastelyckan_o exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
2024-01-19 10:34:59.063 WARNING (Recorder) [homeassistant.components.recorder.db_schema] State attributes for sensor.helper_bussar_fran_botulfsplatsen exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
And my configuration:
sensor:
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.