Add note extended cron syntax note croniter (#19541)

This commit is contained in:
Leonidas Loucas 2021-10-26 08:31:00 -07:00 committed by GitHub
parent 275de96f26
commit 31fe320370
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,8 +55,8 @@ offset:
type: time
type: integer
cron:
description: This option is *mutually exclusive* of `cycle` and `offset`. It provides an advanced method of defining when should the counter be reset. It follows common [crontab syntax](https://crontab.guru).
required: false
description: This option is *mutually exclusive* of `cycle` and `offset`. It provides an advanced method of defining when should the counter be reset. It follows common [crontab syntax](https://crontab.guru) but extended to support more advanced scheduling. See the [croniter](https://github.com/taichino/croniter) library.
required: true
type: string
net_consumption:
description: Set this to True if you would like to treat the source as a net meter. This will allow your counter to go both positive and negative.
@ -172,6 +172,20 @@ automation:
entity_id: utility_meter.monthly_energy
```
Assuming your utility provider cycle is offset from the last day of the month
- cycles at 17h00 on the last day of the month
a cron(extended syntax used for last day of month) based utility meter can be used:
```yaml
utility_meter:
monthly_energy:
source: sensor.energy
name: Monthly Energy
cron: "0 17 L * *"
```
## Advanced Configuration for DSMR users
When using the [DSMR component](/integrations/dsmr) to get data from the utility meter, each tariff (peak and off-peak) has a separate sensor. Additionally, there is a separate sensor for gas consumption. The meter switches automatically between tariffs, so an automation is not necessary in this case. But, you do have to setup a few more instances of the `utility_meter` component.