Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-usable template not working - with negative numbers? #360

Open
ArveVM opened this issue Dec 12, 2023 · 2 comments
Open

Re-usable template not working - with negative numbers? #360

ArveVM opened this issue Dec 12, 2023 · 2 comments

Comments

@ArveVM
Copy link

ArveVM commented Dec 12, 2023

Version of the custom_component

0.0.14

Homeassistant version

2023.12.1

Configuration

Add your configuration here.

Describe the bug

Trying to be more clever than I am,, having created a small monster of a re-usable template (which in itself is a good idea), but it doesnt work in the time-array/attributes

the templates and more info here:
ArveVM/nordpool_additional_cost#7

so when adding to the current price of 193,813 øre the template that gives -0.42516 NOK i get a price of 242,618 Øre,
(when trying some template-result that give positive amounts, the calculations are correct) . .

image

Debug log


Add your logs here.

@Hellowlol
Copy link
Collaborator

I have no idea what you’re trying to do there. But generally keep the template as simple as possible. Verify that a simple example works before you increase the complexity. Remember that now() is patched as always refer to the current hours what ever that may be.

@ArveVM
Copy link
Author

ArveVM commented Dec 12, 2023

End goal is to have a re-usable template where many people can contribute to to keep updated with never ending changes in tariffs.
The re-usable template is deployed/updated through HACS so we can lower threshold to keep tariffs updated for everyone.

So the template rely on some input and now() for hour/date/month and current_price to calculate vat/subsidy etc

So if I try to add just the transport cost it works fine through the entire day and changed with tarrif changes
But if I try calculate the price including subsidies the calculation goes bananas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants