Skip to content

Commit

Permalink
Merge pull request #5 from mf-social/update-docs
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
Marc Forth committed Nov 22, 2019
2 parents 21ba1d4 + 47eabdd commit c1d5ee3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ key | required | type | description
`type:` | True | string | Type of date (eg. Birthday)
`date:` | True | string | Date, in format DD/MM/YYYY

The date can be in the future if you want to countdown to the date itself, and then the anniversaries thereafter.

## Usage
Each sensor **requires**:

Expand Down Expand Up @@ -48,7 +50,7 @@ Each sensor is given the following automatically:

```
entity_id: sensor.<type>_<name>
friendly_name: <name> 's <type>
friendly_name: <name> <type>
state: <Days to the date from today>
nextoccur: <Date of next occurance>
years: <Number of years it will be>
Expand All @@ -64,12 +66,14 @@ nextoccur: 17/08/YYYY (either this year or next year as appropriate)
years: However old John will be on his next birthday
sensor.anniversary_our_wedding
friendly_name: Our wedding's anniversary
friendly_name: Our wedding anniversary
state: However many days to 14th February
nextoccur: 14/02/YYYY (either this year or next year as appropriate)
years: How many years you will have been married on that day
```

Note that if the type is 'birthday' the sensor will automatically add an apostrophe.

## Example configuration.yaml entry
An example automation to create and refresh the above two sensors daily would be:

Expand Down Expand Up @@ -128,4 +132,7 @@ Will provide the following lovelace representation:

![Lovelace example](https://community-home-assistant-assets.s3.dualstack.us-west-2.amazonaws.com/original/3X/b/a/ba44600d7f41b1525a3c835d11bcc3bd59815b23.png)

(Thanks to [@myle](https://community.home-assistant.io/u/myle/summary) for this idea )
## Credits
Thanks to [@myle](https://community.home-assistant.io/u/myle/summary) for the idea for the extra attributes and the lovelace presentation.

Thanks to [AJax2012](https://github.com/AJax2012) for the PR that caters for future dates, and makes the apostrophes in the friendly names only append to borthday sensors.
15 changes: 11 additions & 4 deletions info.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
## How it works
This script creates a sensor that a counts down to the next occurrance of a date, like a birthday or anniversary and gives the number of years as an attribute

Requires `python_script:` to be enabled in you configuration

## Installation
Copy the Python script in to your `/config/python_scripts` directory or install via HACS.

## Script arguments
key | required | type | description
-- | -- | -- | --
`name:` | True | string | Name of the date (eg. John)
`type:` | True | string | Type of date (eg. Birthday)
`date:` | True | string | Date, in format DD/MM/YYYY

The date can be in the future if you want to countdown to the date itself, and then the anniversaries thereafter.

## Usage
Each sensor **requires**:

Expand Down Expand Up @@ -38,7 +45,7 @@ Each sensor is given the following automatically:

```
entity_id: sensor.<type>_<name>
friendly_name: <name> 's <type>
friendly_name: <name> <type>
state: <Days to the date from today>
nextoccur: <Date of next occurance>
years: <Number of years it will be>
Expand All @@ -54,12 +61,14 @@ nextoccur: 17/08/YYYY (either this year or next year as appropriate)
years: However old John will be on his next birthday
sensor.anniversary_our_wedding
friendly_name: Our wedding's anniversary
friendly_name: Our wedding anniversary
state: However many days to 14th February
nextoccur: 14/02/YYYY (either this year or next year as appropriate)
years: How many years you will have been married on that day
```

Note that if the type is 'birthday' the sensor will automatically add an apostrophe.

## Example configuration.yaml entry
An example automation to create and refresh the above two sensors daily would be:

Expand Down Expand Up @@ -117,5 +126,3 @@ entities:
Will provide the following lovelace representation:

![Lovelace example](https://community-home-assistant-assets.s3.dualstack.us-west-2.amazonaws.com/original/3X/b/a/ba44600d7f41b1525a3c835d11bcc3bd59815b23.png)

(Thanks to [@myle](https://community.home-assistant.io/u/myle/summary) for this idea )

0 comments on commit c1d5ee3

Please sign in to comment.