I’ve been struggling with using the value template to change the value based on something a little more relevant. Using MQTT sensors which return a value of either OFF or ON. I want to translate these into Normal and Low respectively.
My sensor configuration is a follows:
- platform: mqtt
state_topic: "cbus/read/254/56/82/state"
name: Greenhouse NFT Water Level Low
value_template: >
{% if is_state('sensor.greenhouse_nft_water_level_low', 'ON') -%}
NFT Low
{%- else -%}
NFT Normal
{%- endif %}
The sensor itself is currently ON and should be showing ‘NFT Low’. Instead it shows ‘NFT Normal’.
If I put this same value_template code into the Dev Tooling, it shows the correct value of ‘NFT Low’.
{% if is_state('sensor.greenhouse_nft_water_level_low', 'ON') -%}
NFT Low
{%- else -%}
NFT Normal
{%- endif %}
Any assistance would be appreciated while I get my head around HA.
Ahh ok, much appreciated. I love learning new things, but hate it at the same time, hope I get the hang of this sooner rather than later, will be easier on you guys
So, I’m still not sure of the difference between state and value in this instance, they do sound like the same thing.