@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