#Templating problem

1 messages ยท Page 1 of 1 (latest)

fickle canyon
#

Problens are here:

      value_template: "{{('states.'~weightsensor~'.state' | float(0) - input_number.weightdiff
        | float(0)) < ('states.'~okoksensor~'.state' | float(0)) < ('states.'~weightsensor~'.state')
        | float(0) +  input_number.weightdiff | float(0)) }}"
#

Among then where did those tilde's come from?

#

float - float < float < float + float is a heck of a mess as well.

#

I'd be tempted to create variables out of the code creating the floats, then the actual value template would be readable.

#

Bottom line, look for examples on how to build your tempate statement. The BP is basically correct.

ebon tapir
fickle canyon
#

You are welcome

fickle canyon
#

BTW, this works just fine. Snipped from one of my BP's where humidity is a sensor entity.

    # Convert !input to variable
  humidity_now_var: !input 'humidity'
    # Get current Humidity from Sensor
  humidity_now_val: '{{ states(humidity_now_var) | float(set_val) }}'

I see the string concat ~ in the jinga2 docs now, but have never used it... Sorry to offend you.

ebon tapir
#

Not offended, but bit pissed off ๐Ÿ™‚ As you can see from my code , I am not here to be lazy, spent a lot of time reading and trying and even found the ~ . Hence I was not so happy with all your comments and finnally no solve. But by getting back to me , I forgot it again. ๐Ÿ™‚
Let me try if I can convert/ammend your snip into my code.

fickle canyon