Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation on HA 2023.2.4? #11

Open
villalji opened this issue Feb 14, 2023 · 13 comments
Open

Installation on HA 2023.2.4? #11

villalji opened this issue Feb 14, 2023 · 13 comments

Comments

@villalji
Copy link

Hi,
I guess I ´m doing something wrong, but I can ´t manage to install it correctly, and I get an error on the configuration when trying to re-start: "Invalid config for [sensor.berlin_transport]: [sensors] is an invalid option for [sensor.berlin_transport]. Check: sensor.berlin_transport->sensors. (See ?, line ?)."
I have copied the berlin_transport folder as per instructions:

image

and added this to my sensors.yaml:

Berlin Transport
  • platform: berlin_transport
    sensors:
    departures:
    • name: "S Heiligensee" # free-form name, only for display purposes
      stop_id: 900091203 # actual Stop ID for the API
      direction: 900089303 # Tegel Optional stop_id to limit departures for a specific direction (same URL as to find the stop_id)
      walking_time: 8 # Optional parameter with value in minutes that hides transport closer than N minutes
    • name: "Ziegenorter Pfad" # currently you have to add more than one stop to track
      stop_id: 900091253
      direction: 900089303 # Tegel Optional stop_id to limit departures for a specific direction (same URL as to find the stop_id)
      walking_time: 7 # Optional parameter with value in minutes that hide transport closer than N minutes

Finally, I copied the berlin-transport-timetable-card.js file to www folder, and added it to the resources. (but I cannot see the card yet, I guess I have to re-start... which I can't as I get an error in the config.

image

help please?

@vas3k
Copy link
Owner

vas3k commented Feb 14, 2023

Try to restart your Home Assistant first. And then add sensors to your configuration yml again

@villalji
Copy link
Author

Thanks Vasily, still no luck, same error: "Invalid config for [sensor.berlin_transport]: [sensors] is an invalid option for [sensor.berlin_transport]. Check: sensor.berlin_transport->sensors. (See ?, line ?)."

since I have a separate sensors.yaml (all sensors I have there work fine), I have addapted your code:

image

what am I doing wrong?

Oh, and thanks a lot for creating this, I hope I can make it work!

@vas3k
Copy link
Owner

vas3k commented Feb 14, 2023

Thanks Vasily, still no luck, same error: "Invalid config for [sensor.berlin_transport]: [sensors] is an invalid option for [sensor.berlin_transport]. Check: sensor.berlin_transport->sensors. (See ?, line ?)."

It seems that because of this error it prevents Home Assistant from restarting completely, so the sensor remains unloaded. Try removing (or temporarily commenting out) it from sensors.yml altogether, restart HA and add it again. But don't remove the files!

Plus, check the logs when restarting. If the sensor loads with an error, there will be some information about it.

@villalji
Copy link
Author

villalji commented Feb 14, 2023

Thanks again Vasily, Done. commented the sensor section in sensors.yaml, restarted HA, no errors. removed comments from the sensor section, tried to re-start. Same error preventing it.

Edit: I managed to get this part working, I removed the "sensors" part and, strangely enough, the sensors are now created fine!
this is how the entry looks in my sensors.yaml file:
image
What I have problems generating now is the lovelace card, it does not seem to be able to find it...
image

@devcpu
Copy link

devcpu commented Feb 16, 2023

Same problem here by trying to add card to lovelace.
Home Assistant 2023.2.5 Frontend 20230202.0 - latest

@villalji
Copy link
Author

Hi, it is working erratically for me. it has started to show the card only today, only sometimes, and only in the PC browser. It does not show in the iphone or ipad apps.
image

@devcpu
Copy link

devcpu commented Feb 17, 2023

The Sensor works fine for me. I add the /local/berlin-transport-timetable-card.js as ressource, as you can see in pic below.
grafik

Also I can add an element card, the sensor will work, but unfortunately, it show one entry only (and no so nice).
grafik

When I try to add the time-table-card I got this:
grafik
Whats wrong?

@villalji
Copy link
Author

Hi there, I managed to make the cards work both in the PC browser as well as in the mobile apps.
what I did is to add the berlin-transport-timetable-card.js into a folder:

/local/berlin-transport-timetable-card/berlin-transport-timetable-card.js

then, in the resources I added the card as follows:

/hacs/berlin-transport-timetable-card/berlin-transport-timetable-card.js

that did the trick, I read in some forums that sometimes HA expects custom cards to be in "hacs" entry,
Now the card is refreshing the sensors totally fine. Thanks @vas3k !! great card!

@devcpu
Copy link

devcpu commented Feb 22, 2023

@villalji
I try your solution without success. What folder you mean with /local/berlin-transport-timetable-card/berlin-transport-timetable-card.js? config/local? config/www/local? or other?
In the end I put berlin-transport-timetable-card.js to everywhere without any success.

├── automations.yaml
├── blueprints
├── configuration.yaml
├── custom_components
│   ├── berlin_transport
│   │   ├── berlin-transport-timetable-card.js
│   │   ├── const.py
│   │   ├── departure.py
│   │   ├── __init__.py
│   │   ├── manifest.json
│   │   ├── mypy.ini
│   │   ├── __pycache__
│   │   │   ├── const.cpython-310.pyc
│   │   │   ├── departure.cpython-310.pyc
│   │   │   ├── __init__.cpython-310.pyc
│   │   │   └── sensor.cpython-310.pyc
│   │   └── sensor.py
│   ├── berlin-transport-timetable-card.js
│   ├── hacs
│   └── local
│       ├── berlin_transport
│       │   └── berlin-transport-timetable-card.js
│       └── berlin-transport-timetable-card
│           └── berlin-transport-timetable-card.js
├── deps
├── home-assistant.log
├── home-assistant.log.1
├── home-assistant.log.fault
├── home-assistant_v2.db
├── home-assistant_v2.db-shm
├── home-assistant_v2.db-wal
├── local
│   ├── berlin_transport
│   │   └── berlin-transport-timetable-card.js
│   ├── berlin-transport-timetable-card
│   │   └── berlin-transport-timetable-card.js
│   └── berlin-transport-timetable-card.js
├── scenes.yaml
├── scripts.yaml
├── secrets.yaml
├── tts
└── www 
    ├── berlin_transport
    │   └── berlin-transport-timetable-card.js
    ├── berlin-transport-timetable-card.js
    ├── home-assistant-berlin-transport
    │   └── berlin-transport-timetable-card.js
    ├── berlin-transport-timetable-card.js
    └── local
        ├── berlin_transport
        │   └── berlin-transport-timetable-card.js
        ├── berlin-transport-timetable-card.js
        └── home-assistant-berlin-transport
            └── berlin-transport-timetable-card.js

@devcpu
Copy link

devcpu commented Feb 22, 2023

Of course, I add /hacs/berlin-transport-timetable-card/berlin-transport-timetable-card.js as front end resource.

Is there any way to get logging infos to debug the problem. To flying blind is very frustrating.

@villalji
Copy link
Author

Of course, I add /hacs/berlin-transport-timetable-card/berlin-transport-timetable-card.js as front end resource.

Is there any way to get logging infos to debug the problem. To flying blind is very frustrating.

HI, what an did is to create a folder and copy the file into it:
/local/berlin-transport-timetable-card/berlin-transport-timetable-card.js
And as you say, add /hacs/berlin-transport-timetable-card/berlin-transport-timetable-card.js
To the resources.
It worked for me!. Just one stupid question, did you re-start HA after these changes?
Also, remember to refresh the screen in the card…
Good luck!

@sieren
Copy link

sieren commented Mar 11, 2023

The error could be because youre pasting the config code through the UI instead of using the YAML Config:
Instead of

- type: custom:berlin-transport-timetable-card
  show_stop_name: true # show or hide the name of your stop in card title
  max_entries: 8 # number of upcoming departures to show (max: 10)
  entities:
    - sensor.stop_id_900110001 # use your entity IDs here
    - sensor.stargarder_str # they might be different from mine

try

type: custom:berlin-transport-timetable-card
show_stop_name: true # show or hide the name of your stop in card title
max_entries: 8 # number of upcoming departures to show (max: 10)
entities:
  - sensor.stop_id_900110001 # use your entity IDs here
  - sensor.stargarder_str # they might be different from mine

@oderturm
Copy link

Thanks for your solutions. For me its working with the hacs path of the /hacs/berlin-transport-timetable-card/berlin-transport-timetable-card.js.
Please keep in mind to logout / login the browser session to avoid caching problems with the js file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants