Hi,
I am trying to create a counter of pills left in my medicine box.
For that use I have made two helpers:
input_number: Package_size
input_number: current_count
Now I have one automation that decrements the current_count by one, everytime I push a button when I have taken my medicine.
Now when I buy a new package I want another automation that adds the package size to the current_count.
For the sake of simplicity I have tried to harcode the number in the first place, but this doenst work:
Thanks for the hint. For a hard coded number this works like a charm now. But I don’t seem to get it working for another input Number. So instead of 50 how would the syntax be for adding a value of another Input Number?
I tried different options. For example:
value: "{{ states('input_number.current_count') | int + {{ states('input_number.package_size') | int + 50 }} }}"
Hi - @123 provides, as usual , the correct syntax. You had an extra set of double braces that confused the interpreter.
One suggestion is to test templates in the developer template first (I always do that) to make sure it works correctly before implementing it. It’s a great testing feature provided by HA and might be the one I use the most for development…
BTW, there’s an existing method to indicate a problem has been solved (as opposed to adding the word [Solved] to the title). Simply select the post that contains the solution (the one that revealed how to correct the problem) and tick its Solution tag. Only one post in the thread can be assigned the Solution tag and only you, the author of this topic, can select it (and the forum moderators).
After you have marked the post with the Solution tag, a link to the post will automatically appear below your first post. In addition, a check-mark will also appear next to the topic’s title. This helps other users, with similar questions, find answers.
You’re using the Picture Elements card which is one of Home Assistant’s standard set of cards. None of the the standard cards support templates (except for the Markdown card). That’s why you’re getting an error message.