add daysTo to device state attributes

This commit is contained in:
mampfes
2021-04-01 14:44:09 +02:00
parent 51f67dd7de
commit 82a0fcb638
2 changed files with 27 additions and 6 deletions

View File

@@ -221,6 +221,7 @@ sensor:
leadtime: LEADTIME
value_template: VALUE_TEMPLATE
date_template: DATE_TEMPLATE
add_days_to: ADD_DAYS_TO
types:
- Waste Type 1
- Waste Type 2
@@ -288,6 +289,12 @@ Template string used to format collection dates within the more-info popup.
See [Template Variables](#template-variables) for a list of available variables.
**add_days_to**
*(boolean) (optional, default: ```False```)*
Adds an attribute with the label `daysTo` and the number of days to the next collection to the entity state of the source.
**types**
*(list of strings) (optional)*
@@ -507,6 +514,13 @@ entity: sensor.garbage
type: 'custom:garbage-collection-card'
```
### 13. How can I sort waste type specific entities?
Prerequisites: You already have dedicated sensors per waste type and want to show the sensor with the next collection in a Lovelace card.
Add `add_days_to: True` to the configuration of all sensors you want to sort. This will add the attribute `daysTo` which can be used by e.g. [auto-entities](https://github.com/thomasloven/lovelace-auto-entities) to sort entities by day of next collection.
## How to add new sources
1. Create a new source in folder `custom_components/waste_collection_schedule/package/source` with the lower case url of your service provider (e.g. `abc_com.py` for `http://www.abc.com`).