silviokennecke / ha-custom-components

Custom components I use in my home assistant installation
GNU General Public License v3.0
6 stars 4 forks source link

How to install? #4

Closed kellerassel007 closed 11 months ago

kellerassel007 commented 1 year ago

I can't figure out how to install this custom component card?

Blueheadings commented 11 months ago

Same here, please leave a reply and tell us 🙏

Dale81 commented 11 months ago

I came for the same reason. Just integrated the JS into ressources but the sample code is not working as the card type is not recognized. Thanks for any info on how to intall properly :)

roellhe3 commented 11 months ago

Hi @kellerassel007 , @Blueheadings , @Dale81 for me its working - here my few steps

  1. place the script in this location: /config/www/community/public-transport/connection.card.js
  2. open the page in Browser (if you don´t see the "resources" in the menu) http://[my HA URL]/config/lovelace/resources
  3. Add Resource with URL: /hacsfiles/public-transport/connection.card.js as JavaScript-Module

I guess this made the trick - I am using HACS for other integrations and they are stored there as well using the same folder alias "/hacsfiles" instead of "/config/www/community". Using "/local/" or "/config/www/community" was not working for me.

  1. restart HA
  2. create a manual card with this code:
    type: "custom:public-transport-connection-card"
    title: Nächste Bahn
    entity: sensor.[name of my Deutsche Bahn sensor]
    departure_station: [departure name]
    arrival_station: [arrival name]
    attributes:
    description: products
    departure_time: departure
    departure_delay: delay
    arrival_time: arrival
    arrival_delay: delay_arrival
    next_departure_time: next
    next_arrival_time: next_on

everything in [brackets] need to been adjusted to your needs...

Thats it

kellerassel007 commented 11 months ago

Hi @kellerassel007 , @Blueheadings , @Dale81 for me its working - here my few steps

1. place the script in this location:
   `/config/www/community/public-transport/connection.card.js`

2. open the page in Browser (if you don´t see the "resources" in the menu)
   `http://[my HA URL]/config/lovelace/resources`

3. Add Resource with URL:
   `/hacsfiles/public-transport/connection.card.js`
   as JavaScript-Module

I guess this made the trick - I am using HACS for other integrations and they are stored there as well using the same folder alias "/hacsfiles" instead of "/config/www/community". Using "/local/" or "/config/www/community" was not working for me.

4. restart HA

5. create a manual card with this code:
type: "custom:public-transport-connection-card"
title: Nächste Bahn
entity: sensor.[name of my Deutsche Bahn sensor]
departure_station: [departure name]
arrival_station: [arrival name]
attributes:
  description: products
  departure_time: departure
  departure_delay: delay
  arrival_time: arrival
  arrival_delay: delay_arrival
  next_departure_time: next
  next_arrival_time: next_on

everything in [brackets] need to been adjusted to your needs...

Thats it

Awesome, that worked for me, thanks a lot!