Skip to content

Could not convert string to float #213

@Wopples

Description

@Wopples

Discussed in #211

Originally posted by Wopples October 23, 2024
Here's my template:

{% set s = {"B": 13.72,"C": 1.220,"D": 13.72,"E": 0.830,"CF": 0.3333,"CP": 128.99,"ENV": 1.0195,"BHE": 10.89,"WKK": 5.04,"BA": 12.3606,"BTW": 1.21 } %}
{% if states('calendar.belgium') == 'off' %}
  {% if now().isoweekday() < 6 %}
    {% if now().hour >= 7 and now().hour < 22 %}
      {{((s.B+s.C*((1-s.CF)*current_price+s.CF*s.CP))*s.ENV+s.BHE+s.WKK+s.BA)*s.BTW | float }}
    {% endif %}
  {% endif %}
{% else %}
  {{((s.D+s.E*((1-s.CF)*current_price+s.CF*s.CP))*s.ENV+s.BHE+s.WKK+s.BA)*s.BTW | float }}
{% endif %}

It works in the developer tools template but when I paste it in in the Entso configuration it returs an error: "could not convert string to float".
What am I missing?
Thanks for any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions