I ran into a confusing situation to-day and would be grateful for some explanation.
I want to display a value on a Big Number Card on a Lovelace view. This card type suits my needs, I realize that perhaps other cards type could be used and the result formatted to simulate the Big Number Card but in this instance it is my preferred choice. The value is a composition of the values obtained from two sensors plus a little text. My problem is that when I create the new sensor to include the details, I am getting an “unknown” result. Coincidentally I also am changing these values from kph to mps by multiplying by 0.277777778. I have also tried the following code both with an without the factor multiplication.
Would be grate if someone could put me right and explain why I get unknown instead of something like 1.2/2.5 m/s
Sensor 1: sensor.hp2551ae_pro_v1_9_9_wind_speed
Sensor 2: sensor.hp2551ae_pro_v1_9_9_wind_gust
Sensor 3: (the one I want to create) Combo Wind & Gust
Alt 1
- platform: template
sensors:
combo_wind_gust:
friendly_name: "Combo Wind & Gust"
value_template: >
{{ (states('sensor.hp2551ae_pro_v1_9_9_wind_speed') | float * 0.277777778) | round(1) }}/{{ (states('sensor.hp2551ae_pro_v1_9_9_wind_gust') | float * 0.277777778) | round(1) }} m/s
unit_of_measurement: "m/s"
unique_id: ComboWind
icon_template: "mdi:weather-windy"
Alt 2
- sensor:
- name: "Combo Wind & Gust"
unique_id: combo_wind_gust
icon: mdi:weather-windy
unit_of_measurement: "m/s"
state: >
{% set wind = (states('sensor.hp2551ae_pro_v1_9_9_wind_speed') | float(0) * 0.277777778) | round(1) %}
{% set gust = (states('sensor.hp2551ae_pro_v1_9_9_wind_gust') | float(0) * 0.277777778) | round(1) %}
{{ wind }}/{{ gust }} m/s