nordpool icon indicating copy to clipboard operation
nordpool copied to clipboard

Re-usable template not working - with negative numbers?

Open ArveVM opened this issue 1 year ago • 2 comments

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: https://github.com/ArveVM/nordpool_additional_cost/issues/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.

ArveVM avatar Dec 12 '23 14:12 ArveVM

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.

Hellowlol avatar Dec 12 '23 20:12 Hellowlol

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.

ArveVM avatar Dec 12 '23 21:12 ArveVM