From 520d926ce27cf8d36799ef7dc03640f84703312b Mon Sep 17 00:00:00 2001 From: Ron Klinkien Date: Mon, 14 Jun 2021 10:45:48 +0200 Subject: [PATCH] Update README.md --- README.md | 60 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 3e5b3f6..80bf341 100644 --- a/README.md +++ b/README.md @@ -46,43 +46,79 @@ You can create 2 extra sensors which hold the type of garbage to pickup today an # Example configuration.yaml entry sensor: + - platform: template sensors: afval_vandaag: - friendly_name: 'Vandaag' + friendly_name: "Vandaag" value_template: >- + {% set afval = '' %} {% if is_state_attr('sensor.hvc_groep_gft', 'day', 'Vandaag') %} - {% set gft = 'Groene Bak' %} + {% set afval = 'Groene Bak' %} {% endif %} {% if is_state_attr('sensor.hvc_groep_papier', 'day', 'Vandaag') %} - {% set papier = 'Blauwe Bak' %} + {% if afval|length %} + {% set afval = afval + ' + Blauwe Bak' %} + {% else %} + {% set afval = 'Blauwe Bak' %} + {% endif %} {% endif %} {% if is_state_attr('sensor.hvc_groep_plastic', 'day', 'Vandaag') %} - {% set plastic = 'Plastic' %} + {% if afval|length %} + {% set afval = afval + ' + Plastic' %} + {% else %} + {% set afval = 'Plastic' %} + {% endif %} {% endif %} {% if is_state_attr('sensor.hvc_groep_restafval', 'day', 'Vandaag') %} - {% set restafval = 'Grijze Bak' %} + {% if afval|length %} + {% set afval = afval + ' + Grijze Bak' %} + {% else %} + {% set afval = 'Grijze Bak' %} + {% endif %} + {% endif %} + {% if afval|length %} + {{afval}} + {% else %} + Geen {% endif %} - {{gft}} {{papier}} {{plastic}} {{restafval}} - platform: template sensors: afval_morgen: - friendly_name: 'Morgen' + friendly_name: "Morgen" value_template: >- + {% set afval = '' %} {% if is_state_attr('sensor.hvc_groep_gft', 'day', 'Morgen') %} - {% set gft = 'Groene Bak' %} + {% set afval = 'Groene Bak' %} {% endif %} {% if is_state_attr('sensor.hvc_groep_papier', 'day', 'Morgen') %} - {% set papier = 'Blauwe Bak' %} + {% if afval|length %} + {% set afval = afval + ' + Blauwe Bak' %} + {% else %} + {% set afval = 'Blauwe Bak' %} + {% endif %} {% endif %} {% if is_state_attr('sensor.hvc_groep_plastic', 'day', 'Morgen') %} - {% set plastic = 'Plastic' %} + {% if afval|length %} + {% set afval = afval + ' + Plastic' %} + {% else %} + {% set afval = 'Plastic' %} + {% endif %} {% endif %} {% if is_state_attr('sensor.hvc_groep_restafval', 'day', 'Morgen') %} - {% set restafval = 'Grijze Bak' %} + {% if afval|length %} + {% set afval = afval + ' + Grijze Bak' %} + {% else %} + {% set afval = 'Grijze Bak' %} + {% endif %} {% endif %} - {{gft}} {{papier}} {{plastic}} {{restafval}} + {% if afval|length %} + {{afval}} + {% else %} + Geen + {% endif %} + ``` And you can group them like so: