Ok what’s a float filter, and what is the syntax for making it into a template? Like this?
sensors:
enteringhumidity:
unit_of_measurement: '%'
value_template: {% set temperature = states(‘sensor.mainroomtemperaturec’) | float %}
{% set relHumidity = states(‘sensor.outdoorhumidityecowittgw’) | float %}
{% set absHumidity = states(‘sensor.outdoor_absolutehumidity’) | float %}
{% set absTemperature = temperature + 273.15 %}
{% set relHumidity = absHumidity %}
{% set relHumidity = relHumidity * absTemperature %}
{% set relHumidity = relHumidity / 2.1674 %}
{% set relHumidity = relHumidity / relHumidity**((17.67 * temperature) / (243.5 + temperature)) %}
{% set relHumidity = relHumidity / 6.112 %}
{{ relHumidity | round(2) }}
something is wrong I think. Also can I have two things in the config that say
Sensors: or do I have to put all things under sensors: under just one sensors: thing.
So it looks mathematically like it’s saying the sensor is greater than the math I put? What does the > sign actually mean? Is this all part of how the Jinja thing works?
This is where the majority of the documentation is:
But there is something somewhere that explains the difference between: >- and |, from memory >- means that if there are multiple lines of output in the template, line breaks will be ignored so that the template renders as a single line, instead of multiple lines.
Also, i got this in logs and no entering_humidity sensor?
The entity definition format under template: differs from the platform configuration format. See Template - Home Assistant
Where have you tried to put it in your configuration yaml, template: is a top level thing, like sensor:, binary_sensor:, light: and switch: it does not go in under sensor:
Which should not be in there, or at least they should be updated to the new template format. They are using the old platform: template format under sensors.
I don’t have time to edit them all now for you, but you should also be aware, that there is no need to have multiple - sensor: lines, taking your first 2 sensors, this would be the format:
Ok so I removed the sensor: thing for all of them except the top one but it gave me a message that onto is specifically regarding this thing I added because it references the stuff in it and says it’s related to template
Invalid config for [template]: invalid template (TemplateSyntaxError: unexpected char ‘‘’ at 28) for dictionary value @ data[‘sensor’][12][‘state’]. Got '{% set temperature = states(‘sensor.mainroomtemperaturec’) | float(0) %} {% set relHumidity = states(‘sensor.outdoorhumidityecowittgw’) | float(0) %} {% set absHumidity = states(‘sensor.outdoor_absolutehumidity’) | float(0) %} {% set absTemperature = temperature + 273.15 %} {% set relHumidity = absHumidity %} {% set relHumidity = relHumidity * absTemperature %} {% set relHumidity = relHumidity / 2.1674 %} {% set relHumidity = relHumidity / relHumidity**((17.67 * temperature) / (243.5 + tempe… (See /config/configuration.yaml, line 18).
I tried with and without the - directly after the > and it said the same thing
I don’t even think my phone has that lol. I’ll just do it on my laptop when I get home I’m not copy pasting it that many times. I wouldn’t have figured it out lol
The >- vs |- is not really important in a template sensor, since its not shown, but if the code is used in a Lovalace card, then it can have a meaning.
If you use it in a Lovelace card, then you can also add the - to the {%, like {%- and -%}. to remove line breaks.