Custom sensor templating

Good morning all!

need a hand with a custom template that i frankensteined together, any help would be much appreciated

    friendly_name: 'DLI / PPFD'
    value_template: >-
      {% set PPFD = ((states('sensor.tyebd241qeiagryjzu') | float %}
      {% set DLI = ((PPFD)) * (3600 * 12) / 1,000,000) %}
    unit_of_measurement: 'DLI'

i understand DLI isnt a unit of measure where its actually something like umols/2

basic idea use one value ,sensor.tyebd241qeiagryjzu, to create a new value using the converting equation

  - sensor:
      - name: 'DLI_PPFD'
        state: >-
          {% set ppfd = ((states('sensor.tyebd241qeiagryjzu') | float %}
          {% set dli = ((ppfd)) * (3600 * 12) / 1,000,000) %}
          {{ dli }}

This is done as though you would put in configuration.yaml. Adjust if you are including files. Sensor will be " sensor.dli_ppfd " (lower case).

I would not use a unit of measurement. You know what it is.

1 Like

@mikeybatoz using commas in your template creates a list, not a number. There are also too many parentheses. To make sure your template is correct, use the template tool available in the developer tools.

1 Like

for the win! thank you both

whatever @walrus_parka did worked in developer tools

sorry too much cut and paste and not enough checking!

1 Like

you are all fantastic thank you!!!

Which ESPHOME PPFD sensor did you use?

Pulling data with a tsl5291 , you have to create a filter, I had another light sensor that came from Amazon I used the case and filter from to make life easier

I meant to say tsl2591 sorry fat thumbs