Code Monkey home page Code Monkey logo

lovelace-hasl-departure-card's People

Contributors

barbatron avatar clearminds avatar dimmanramone avatar dsorlov avatar fredrikbaberg avatar joakimsyktietoevry avatar matfouc avatar morlic avatar systemcrash avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

lovelace-hasl-departure-card's Issues

My iOS app shows later departure than Web Page

I'm not sure if this is Card-related - but it is quite odd.

I have just observed that the scheduler times in Companion app shows departure times an hour away compared to the same view from a browser. Why? and it is then not useful for anything. I took the screenshots below at 16:38.

Here is the view from Web Browser.
image

And here is the same view from the app taken at exact same time (16:38):

image

Bus line direction filtering i

When selecting bus line direction 1 or 2 and save, the value is again reset to 0. Not sure if this is a bug in the integration, or if my data source doesn't have direction data in it?

image

Card doesnt work in HA 106.x

Hi,

After upgrade to HA 106 im getthing these errors on the card:
"Attempted to assign readonly property"
"Can´t define property "show_cardname": object is not extensible"

Hope its a easy fix!

Only show "Last updated" info if it was updated longer than x minutes ago

With this card working very well and rarely encountering issues, I have stopped looking at the "Last updated" text. I believe this is the case for many others since the text only changes one digit depending on if it was updated 0 minutes or 8 minutes ago.

Because of this reason, I think the updated text only should appear if the last update was more than x minutes ago (this number would be configurable in config, I personally would set it to 0).

Not showing departures

Switched to ResRobot as API (since "SL Departures" stopped giving responses for me a couple of days ago). It doesn't show the departure times. Other elements, such as "Last Updated" and "From"/"To"/"Line" are being showed as expected.

image

The API is giving (presumably correct) responses:
image

HASL version: 3.1.1 (installed via HACS)
HASL Departure Lovelace Card version: 2.6.1 (installed via HACS)

Departure Card Config:

type: custom:hasl-departure-card
header: true
departures: true
deviations: true
timeleft: true
updated: true
name: Departures
adjust_times: true
hide_departed: false
entities:
  - sensor.rr_departure_sensor_740067453_resrobot_departures

Wider time frame for departures

Not sure what the default "time frame" is for departures, but for bus stops with only one or two bus lines passing by it can be 1-2h between each departure so it would be nice to see departures for the next 6-8 hours, or preferably even 24 hours and then limit it by max_departures 5 or similar.

Add a “time_offset”

Requested from @tomoqv

Add a “time_offset” to take into account the amount of time it takes to reach the station, i.e. if it takes 8 minutes to walk to the train, only show departures from now() + 8 minutes onwards.

The thing is, that I would like to conserve space in some of my Lovelace views. Showing a number of departures that are impossible to make from my house adds a few lines of information that is of little or no interest to the person looking for the next possible departure. This is a feature request, so I fully understand if it may be low priority.

Erroneous "last updated"

Hi,

I'm a noob with Home Assistant and the state machine so please bare with me. I could not get the departure card to properly show adjusted time remaining to departure, so I decided to take a look.

I have specified a 300s refresh rate for the sensor, but it seems the culprit of the issue is that the value defined in line 62:

var updatedDate = new Date(entity_data.last_updated);

increment every minute and not every 5 minutes (300s) as expected. It seems the departure data fields refresh every 5 min as expected, but the attributes..next_departure_minutes keep ticking down every minute, which cause the last_changed to have an erroneous value. This disturbs the calculated time remaining.

I tried to google, and I suspect (but I am not sure) that this may be changed behaviour for the last_updated field. So to make it work I had to change the above line to:

var updatedDate = new Date(entity_data.attributes.last_refresh);

I also stumbled upon another issue with the integration which seems unable to properly update the config for the sensor (it always revert to the initial settings), but I see that someone has submitted a PR for that already. But this issue meant that I could not change the primary measure (state?) of the sensor from 'min' to 'updated' to see how that would affect the issue described here. But I think regardless the above is the correct value to use for determining when the sensor data was last read from server.

Add `tap_action`

Requested from @tomoqv

I want to bring up e.g. a pop-up card with more details when tapping the hasl-card.

Widget height/limit to display only departures in one direction

When using the HASL departure card to display departures from my bus stop,
the height of the widget is not respected (height set by CSS with mod_card):

image

image

Additionally, the direction 1,2 gives an empty list of departures, only both directions=0 gives
data. Since we live very close (the stop next to) to the end station, we will never travel the one bus stop to the end station, but rather only want to se the departures in the direction of the city center.

I will try to experiment with limiting number of bus departures, but it would be nice to be able to limit widget height.

Auto Installing Repo in HACS with each reboot

The sensor plugins and departure card repositories being are automatically installed on their system via HACS? I am in the USA so there is no need for the Swedish bus system plugin to be installed. I did not install that repo but it is there. I deleted the card and the sensor repositories, rebooted HA and it returned as a New Repository. Happens every time I reboot and has been doing this for the past few days. To me, this seems like a potential security issue!!

UpdatedDate and new HASL v3 doesn't work

var updatedDate = new Date(entity_data.last_updated);

Hi!

Noted an issue with this card related to the new departure sensors in HASLv3. This card uses the last_updated state attribute but that seems to be triggered frequently even if the data is actually not refreshed. I am not sure if this is something new with v3 but I'm guessing it has something to do with it caching the reponses.

I changed this in my on version to use the attribute last_refresh instead which gives the behavior we want.

NaN in Avgång

In the departure box I get NaN for leaving in x minutes
Screenshot_20230114-102610

attributes in sensor for station:

unit_of_measurement: min
api_result: Ok
scan_interval: 300
refresh_enabled: false
attribution: Stockholms Lokaltrafik
departures:
  - line: '474'
    direction: 1
    departure: 6 min
    destination: Hemmesta
    time: 6
    expected: '2023-01-14T10:22:00'
    type: Buses
    groupofline: blåbuss
    icon: mdi:bus
deviations: []
last_refresh: '2023-01-14 10:15:24'
next_departure_minutes: 0
next_departure_time: '10:30:18'
deviation_count: 0
icon: mdi:train
friendly_name: Slussen

Departure card: 2.6.0
Swedish Public Transport Sensor (HASL): 3.1.0
HASS: 2023.1.4

line issue.

Hi. I have a weird issue.
if i specifies the lines as 181, 184 it will also add 18 to the sensor. despite me not refering to it in the config.
it is the departure sensor

Increase text size?

Is there a way to increase the size of the departure time? I have a dashboard on the wall at home and would like to see the time from further away.

image

Bus name replacement doesn't work

Hi,

I can't make the new name replacement to work.

I add this replacement (with " as per the documentation:

image

But still get the unreplaced name:

image

Opening editor again, the " characters around the strings are gone:

image

⚠️ Information: Future card configuration changes.

Hi.

A change in how lovelace cards are set up in Home Assistant 0.105 increases performance, but enables cards to accidentally modify their own configuration in the loaded lovelace configuration.

I'm going through the cards in the HACS default repository, and noticed that your card may be susceptible to this. Looking through your code it seems you may modify parts of the config object passed to your card in setConfig.

The result could be that your card does not work well with the GUI editors or that parts of the configuration start showing up multiple times.

At some point in the future, it is likely that the configuration will be frozen before being passed to setConfig. At this point, your card will fail entirely when it tries to modify the configuration object.

There are several ways to fix/protect agains this problem.

The best is to restructure setConfig such that the configuration is never modified.
Other alternatives are to make a copy of the configuration and work on that instead.

setConfig(config) {
  config = { ...config }; // This works for simple configurations not containing arrays or objects
...
import { deepClone } from "deep-clone-simple";
// https://github.com/balloob/deep-clone-simple

setConfig(config) {
  config = deepClone(config); // This is a safe and fast method
...

or

setConfig(config) {
  config = JSON.parse(JSON.stringify(config)); // This uses built-in functions, but may be slower than deepClone
  ...

Please note that I have not tested your card agains Home Assistant 0.105 or later, but just quickly looked through the code. If I'm mistaken in my assessment, I appologize for taking your time.

See thomasloven/hass-config#6 for more info.

Problem with tap_action after HA upgrade

Hi,
just got a problem with the HASL-card and tap_action after my latest upgrade of HA. This is the lovelace error message:

can't define property "tap_action_entity": Object is not extensible

type: 'custom:hasl-departure-card'
show_cardname: false
header: false
departures: true
timeleft: false
updated: false
offset: 5
hide_departed: true
language: sv-SE
entities:
  - sensor.mossens_ip
  - sensor.alleparken
style: |
  ha-card {
    font-size: 1.2em;
    # height: 150px;
    # width: 300px;
    # margin-top: 0px;
    # margin-bottom: 0px;
  }
tap_action: service
service_config:
  domain: browser_mod
  service: popup
  data:
    title: Avgångar
    card:
      type: 'custom:hasl-departure-card'
      header: false
      departures: true
      deviations: true
      timeleft: false
      updated: true
      name: Tidtabeller
      hide_departed: true
      language: sv-SE
      entities:
        - sensor.alleparken
        - sensor.mossens_ip
        - sensor.alviks_strand
        - sensor.alvik
    deviceID:
      - this

Show "xx min (xx:xx)" all the time?

Is it possible to show "xx min (xx:xx)" all the time? Like "1 min (11:31)" and/or "20 min (11:51)"

I asked about this some time ago. Can't remember if it got implemented. :)

Cannot read properties of undefined (reading 'config')

Hi,
I have the error in the frontend with the hasl-departure-card, seems that the config is undefined. The card configuration is:

type: custom:hasl-departure-card
header: true
departures: true
deviations: true
timeleft: true
updated: true
name: Departures
adjust_times: false
hide_departed: false
language: en-EN
entities:
  - sensor.sl_departure_sensor

The error occurs at line https://github.com/hasl-sensor/lovelace-hasl-departure-card/blob/master/dist/hasl-departure-card.js#L229, this is undefined. If I change this.config to config it works fine, but it still seems like and odd bug, I would expect to reach this from the parent closure. Perhaps a right solution would be to bind getEntitiesContent on line 240?

Error message when "Update: true"

I am using HASL to get the departure times for a bus stop using the SL Realtidsinformation 4 API.

In the HASL depature card, I would like to set the option "Update: true", so that I know when the data on the card is out of date. However, when I do this, I get the error ! "this is undefined". (Before some recent update this error used to say "Cannot read properties of undefined (reading 'config')". I get the same error independent of the bus stop used.

Is there anything I can do to work around this issue (apart from setting "Update: false")?

Standard setup throwing "this is undefined"

Adding the card as instructed renders "this is undefined" in the card header. It seems to be picking up the JS file, but that the JS during runtime is throwing the error.

I tried both adding it via HACS and manually. HASL as data feed seems to getting the data correctly, since I can see departure times when viewing the entity in HA.

File location for the JS script (when adding via HACS) is .../www/community/lovelace-hasl-departure-card/hasl-departure-card.js

HA-version: 2023.2.2
HACS-version: 1.30.1 (20220906112053)

Browser used: Firefox v108.

When running in Chromium, the error displayed is instead "Cannot read properties of undefined (reading 'config')", but my guess is that the origin is the same..?

Card config us exactly as mentioned in docs, which the only change being the entity line:
sensor.sl_departure_sensor_2193_hasl_sl_departures

Fullt Kiosk Browser fails randomly

Having a dashboard published to both a Fire Hd and a Samsung Android tab. Both are running the Fully Kiosk Browser.
9 out of 10 the departure card shows like in the screenshoot (pardon the mirror reflection). So it works sometimes

Going to a computer and test the same dashboard it looks fine

64B2626B-2181-4CA1-93BF-F8A9EAD1EEB2

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.