Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95445

How to add 3 days to now()

$
0
0

@Xa4.Jens wrote:

I am using an equation to activate a template sensor for a waste notification. The waste is collected on Thursday, so the switch can be switched on Friday. With the current formula, this only happens on Sunday. How can I add 3 days to now () so that the new week begins at friday?

> # switch restafval
>   - platform: template
>     sensors:
>       restafval:
>         friendly_name: "Restafval"          
>         value_template: '{{ ((now().strftime("%U") | int) / 4)-0.25 == (((now().strftime("%U") | int) / 4)-0.25) | round(0) }}'
>         icon_template: mdi:trash-can 
>  
> # switch GFT
>   - platform: template
>     sensors:
>       gft:
>         friendly_name: "GFT"          
>         value_template: '{{ ((now().strftime("%U") | int) / 2) == ((now().strftime("%U") | int) / 2) | round(0) }}'
>         icon_template: mdi:apple
>           
> # switch Plastic
>   - platform: template
>     sensors:
>       plastic:
>         entity_id: sensor.date
>         friendly_name: "Plastic"
>         value_template: '{{ ((now().strftime("%U") | int) / 4)-0.75 == (((now().strftime("%U") | int) / 4)-0.75) | round(0) }}'
>         icon_template: mdi:bottle-wine´

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95445

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>