Voxxie / lovelace-jumbo-card

A custom lovelace card for the custom Jumbo component.
MIT License
2 stars 0 forks source link

Remove dependency on sensor names #1

Closed peternijssen closed 4 years ago

peternijssen commented 4 years ago

Hi Hans,

Currently your card is coupled to the names of the sensors in the component. See: https://github.com/Voxxie/lovelace-jumbo-card/blob/master/jumbo-card.js#L40 https://github.com/Voxxie/lovelace-jumbo-card/blob/master/jumbo-card.js#L69

I am about to rename some of the sensors, which automatically breaks your card. To avoid this in the future, I suggest to let users enter the entities rather than making them depend in the code.

So I suggest something like the following configuration:

- type: 'custom:jumbo-card'
  time_slots: jumbo.time_slots
  deliveries: jumbo.deliveries 
  basket: jumbo.basket

All none required, so if you don't fill it in, you don't display the info.

So if ever names of sensors are changed, it's not breaking your card :)

An example can be found in my old PostNL Lovelace card if you need some guidance: https://github.com/peternijssen/lovelace-postnl-card/blob/master/src/main.js#L222 https://github.com/peternijssen/lovelace-postnl-card/blob/master/src/main.js#L459

Voxxie commented 4 years ago

I just released v0.2.0 and changed the way a user can define if he want to display curtain parts. If they don't define the entity, that part isn't shown.