vdbrink / vdbrink.github.io

Home Automation Documentation Tips and Tricks for applications like NODE-Red, Home Assistant.
19 stars 1 forks source link

Update page with template examples #5

Closed TheFes closed 1 month ago

TheFes commented 1 month ago

Hi,

I've taken the liberty to make updates to your template page. Note that I'm not finished yet, I will continue when I find some more time.

I've rewritten the first part to the modern format, and also added some explanation on that. I also corrected some templates which were not correct (as I also mentioned on Facebook a few days ago).

Also added a unique_id everywhere, and added an availability template where needed.

TheFes commented 1 month ago

Marked as draft for now, as I'm still working on it

vdbrink commented 1 month ago

@TheFes Thanks for your input! Let me know when you're finished then I can review the PR.

TheFes commented 1 month ago

Done

TheFes commented 1 month ago

Sorry, made a mistake with the T-shirt one image

forgot to put everything under - sensor: there. Maybe you can add it yourself, otherwise I can create a PR for it.

TheFes commented 1 month ago

It should have been:

# Sourcecode by vdbrink.github.io
# configuration.yaml
template:
  - sensor:
      - name: "Wear outside"
        unique_id: sensor_wear_outside
        icon: mdi:tshirt-crew
        state: >-
          {% set temp = states('sensor.tempest_temperature_feels_like_rounded') | float %}
          {% if temp <= 5 %}
            winter jacket and hand gloves
          {% elif temp <= 14 %}
            softshell
          {% elif temp <= 18 %}
            thin jacket
          {% else %}
            T-shirt
          {% endif %}
        availability: "{{ 'sensor.tempest_temperature_feels_like_rounded' | has_value }}
vdbrink commented 1 month ago

I updated the page with your fix