Coder Social home page Coder Social logo

home-assistant-resrobot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

home-assistant-resrobot's Issues

Error on device update

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.

New API [POTENTIALLY BREAKING]

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.

ResRobot found no trips

Kan du förklara vad jag har gjort fel? Jag skickar med 2 bilder ena med error och en bild på min config och en bild som visar hur det ser ut på min lovelace

image

image

image

Feature request - Allow different filter types

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

Filter issues

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ö"

Unable to find Bus 1 from Malmö C towards Kristianstad

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:

  • platform: resrobot
    key: mysecretapikey
    fetch_interval: 1440
    departures:
  • stop_id: 740000003 # Look in the stops.txt file
    name: Buss 1
    max_journeys: 100 # Number of departures to fetch
    sensors: 6 # Number of sensors to create
    unit: "🕑" # unit_of_measurement
    time_format: "%H:%M" # Do not fetch from NOW but now+n minutes, also consider the departed n minutes before it actually departs, e.g. time it takes you to walk to the bus)
    filter:
  • line: 1
    type: contains
    direction: kristianstad

Feature request: allow updating 'fetch_interval' dynamically

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:

  • expose fetch_interval as a separate number entity; or
  • allow fetch_interval in the config to be the name of an existing entity (like a template sensor or an input number)
  • make update_interval<=0 to mean: stop updating completely

remove unused import

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

Error beta 0.13

Home Assistant: core-2022.2.6
Beta 0.13 does only get value for sensor 0.
No error in logs

Remove old departures if time < now

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

State attributes for sensor.xxx exceed maximum size of 16384 bytes

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:

  • platform: resrobot
    fetch_interval: 30
    key: !secret trafiklab
    departures:
    • stop_id: 740072471
      name: "Buss till Botulfsplatsen"
      max_journeys: 20
      sensors: 3
      unit: "🕑"
      time_format: "%H:%M"
      filter:
      • line: 5
        type: "contains"
        direction: "annehem"
    • stop_id: 740016732
      name: "Bussar från Gastelyckan Ö"
      max_journeys: 20
      sensors: 6
      unit: "🕑"
      time_format: "%H:%M"
      filter:
      • direction: "Lund C"
    • stop_id: 740016981
      name: "Bussar från Botulfsplatsen"
      max_journeys: 20
      sensors: 3
      unit: "🕑"
      time_format: "%H:%M"
      filter:
      • line: 5
        direction: "Lund Råbylund"
    • stop_id: 740016757
      name: "Bussar från Bankgatan"
      max_journeys: 20
      sensors: 2
      unit: "🕑"
      time_format: "%H:%M"
      filter:
      • line: 161
      • line: 162

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.