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

ps-strategy-best-save/ps-strategy-lowest-price + tibber #187

Open
Schakus opened this issue Nov 20, 2023 · 34 comments
Open

ps-strategy-best-save/ps-strategy-lowest-price + tibber #187

Schakus opened this issue Nov 20, 2023 · 34 comments
Labels
answerred Assume this is done. Should be closed by issuer. help wanted Extra attention is needed

Comments

@Schakus
Copy link

Schakus commented Nov 20, 2023

Hi,
first of all: thanks for your work!

image
Thats my best save setup, but its always on. I don't know why, lowest price works somehow. Is this a bug?

image
For both there is all the time "no schedule" (I think this bug is already reported), but lowest price seems somehow working. but its ignoring sometimes cheap prices, I don't know why. Hard to debug. Also with not max price.

It would be super nice if we could plot the current price, because I'm plotting the output state already for debugging, but don't know how I could plot the price. do you know how?

Many thanks

@ottopaulsen
Copy link
Owner

In order to evaluate these cases, I need to see the data sent to output 3 for each of them.

@ottopaulsen ottopaulsen added the help wanted Extra attention is needed label Nov 21, 2023
@Schakus
Copy link
Author

Schakus commented Nov 21, 2023

BestSave
{"schedule":[{"time":"2023-11-21T00:00:00.000+01:00","value":true,"countHours":48},{"time":"2023-11-22T23:00:00.000+00:00","value":false,"countHours":null}],"hours":[{"start":"2023-11-21T00:00:00.000+01:00","price":0.3393,"onOff":true,"saving":null},{"start":"2023-11-21T01:00:00.000+01:00","price":0.3339,"onOff":true,"saving":null},{"start":"2023-11-21T02:00:00.000+01:00","price":0.3314,"onOff":true,"saving":null},{"start":"2023-11-21T03:00:00.000+01:00","price":0.3255,"onOff":true,"saving":null},{"start":"2023-11-21T04:00:00.000+01:00","price":0.3313,"onOff":true,"saving":null},{"start":"2023-11-21T05:00:00.000+01:00","price":0.3374,"onOff":true,"saving":null},{"start":"2023-11-21T06:00:00.000+01:00","price":0.36,"onOff":true,"saving":null},{"start":"2023-11-21T07:00:00.000+01:00","price":0.379,"onOff":true,"saving":null},{"start":"2023-11-21T08:00:00.000+01:00","price":0.3867,"onOff":true,"saving":null},{"start":"2023-11-21T09:00:00.000+01:00","price":0.3803,"onOff":true,"saving":null},{"start":"2023-11-21T10:00:00.000+01:00","price":0.3777,"onOff":true,"saving":null},{"start":"2023-11-21T11:00:00.000+01:00","price":0.3776,"onOff":true,"saving":null},{"start":"2023-11-21T12:00:00.000+01:00","price":0.3834,"onOff":true,"saving":null},{"start":"2023-11-21T13:00:00.000+01:00","price":0.3834,"onOff":true,"saving":null},{"start":"2023-11-21T14:00:00.000+01:00","price":0.3817,"onOff":true,"saving":null},{"start":"2023-11-21T15:00:00.000+01:00","price":0.384,"onOff":true,"saving":null},{"start":"2023-11-21T16:00:00.000+01:00","price":0.3883,"onOff":true,"saving":null},{"start":"2023-11-21T17:00:00.000+01:00","price":0.3919,"onOff":true,"saving":null},{"start":"2023-11-21T18:00:00.000+01:00","price":0.3861,"onOff":true,"saving":null},{"start":"2023-11-21T19:00:00.000+01:00","price":0.3745,"onOff":true,"saving":null},{"start":"2023-11-21T20:00:00.000+01:00","price":0.3655,"onOff":true,"saving":null},{"start":"2023-11-21T21:00:00.000+01:00","price":0.3486,"onOff":true,"saving":null},{"start":"2023-11-21T22:00:00.000+01:00","price":0.349,"onOff":true,"saving":null},{"start":"2023-11-21T23:00:00.000+01:00","price":0.3337,"onOff":true,"saving":null},{"start":"2023-11-22T00:00:00.000+01:00","price":0.3337,"onOff":true,"saving":null},{"start":"2023-11-22T01:00:00.000+01:00","price":0.3301,"onOff":true,"saving":null},{"start":"2023-11-22T02:00:00.000+01:00","price":0.3301,"onOff":true,"saving":null},{"start":"2023-11-22T03:00:00.000+01:00","price":0.3265,"onOff":true,"saving":null},{"start":"2023-11-22T04:00:00.000+01:00","price":0.3271,"onOff":true,"saving":null},{"start":"2023-11-22T05:00:00.000+01:00","price":0.3299,"onOff":true,"saving":null},{"start":"2023-11-22T06:00:00.000+01:00","price":0.36,"onOff":true,"saving":null},{"start":"2023-11-22T07:00:00.000+01:00","price":0.3845,"onOff":true,"saving":null},{"start":"2023-11-22T08:00:00.000+01:00","price":0.3975,"onOff":true,"saving":null},{"start":"2023-11-22T09:00:00.000+01:00","price":0.3733,"onOff":true,"saving":null},{"start":"2023-11-22T10:00:00.000+01:00","price":0.3539,"onOff":true,"saving":null},{"start":"2023-11-22T11:00:00.000+01:00","price":0.3404,"onOff":true,"saving":null},{"start":"2023-11-22T12:00:00.000+01:00","price":0.3309,"onOff":true,"saving":null},{"start":"2023-11-22T13:00:00.000+01:00","price":0.3389,"onOff":true,"saving":null},{"start":"2023-11-22T14:00:00.000+01:00","price":0.3551,"onOff":true,"saving":null},{"start":"2023-11-22T15:00:00.000+01:00","price":0.3596,"onOff":true,"saving":null},{"start":"2023-11-22T16:00:00.000+01:00","price":0.3682,"onOff":true,"saving":null},{"start":"2023-11-22T17:00:00.000+01:00","price":0.3752,"onOff":true,"saving":null},{"start":"2023-11-22T18:00:00.000+01:00","price":0.3716,"onOff":true,"saving":null},{"start":"2023-11-22T19:00:00.000+01:00","price":0.3584,"onOff":true,"saving":null},{"start":"2023-11-22T20:00:00.000+01:00","price":0.3425,"onOff":true,"saving":null},{"start":"2023-11-22T21:00:00.000+01:00","price":0.3237,"onOff":true,"saving":null},{"start":"2023-11-22T22:00:00.000+01:00","price":0.3244,"onOff":true,"saving":null},{"start":"2023-11-22T23:00:00.000+01:00","price":0.306,"onOff":true,"saving":null}],"source":"Tibber","config":{"contextStorage":"memory","maxHoursToSaveInSequence":"24","minHoursOnAfterMaxSequenceSaved":"1","minSaving":0.1,"outputIfNoSchedule":false,"outputValueForOn":true,"outputValueForOff":false,"outputValueForOntype":"bool","outputValueForOfftype":"bool","override":"auto","sendCurrentValueWhenRescheduling":true,"hasChanged":false},"time":"2023-11-21T17:30:44.569+00:00","version":"4.1.5","strategyNodeId":"2d0e344c7bedd813","current":true}

Lowest Price
{"schedule":[{"time":"2023-11-21T00:00:00.000+01:00","value":false,"countHours":2},{"time":"2023-11-21T02:00:00.000+01:00","value":true,"countHours":3},{"time":"2023-11-21T05:00:00.000+01:00","value":false,"countHours":43}],"hours":[{"start":"2023-11-21T00:00:00.000+01:00","price":0.3393,"onOff":false,"saving":null},{"start":"2023-11-21T01:00:00.000+01:00","price":0.3339,"onOff":false,"saving":null},{"start":"2023-11-21T02:00:00.000+01:00","price":0.3314,"onOff":true,"saving":null},{"start":"2023-11-21T03:00:00.000+01:00","price":0.3255,"onOff":true,"saving":null},{"start":"2023-11-21T04:00:00.000+01:00","price":0.3313,"onOff":true,"saving":null},{"start":"2023-11-21T05:00:00.000+01:00","price":0.3374,"onOff":false,"saving":null},{"start":"2023-11-21T06:00:00.000+01:00","price":0.36,"onOff":false,"saving":null},{"start":"2023-11-21T07:00:00.000+01:00","price":0.379,"onOff":false,"saving":null},{"start":"2023-11-21T08:00:00.000+01:00","price":0.3867,"onOff":false,"saving":null},{"start":"2023-11-21T09:00:00.000+01:00","price":0.3803,"onOff":false,"saving":null},{"start":"2023-11-21T10:00:00.000+01:00","price":0.3777,"onOff":false,"saving":null},{"start":"2023-11-21T11:00:00.000+01:00","price":0.3776,"onOff":false,"saving":null},{"start":"2023-11-21T12:00:00.000+01:00","price":0.3834,"onOff":false,"saving":null},{"start":"2023-11-21T13:00:00.000+01:00","price":0.3834,"onOff":false,"saving":null},{"start":"2023-11-21T14:00:00.000+01:00","price":0.3817,"onOff":false,"saving":null},{"start":"2023-11-21T15:00:00.000+01:00","price":0.384,"onOff":false,"saving":null},{"start":"2023-11-21T16:00:00.000+01:00","price":0.3883,"onOff":false,"saving":null},{"start":"2023-11-21T17:00:00.000+01:00","price":0.3919,"onOff":false,"saving":null},{"start":"2023-11-21T18:00:00.000+01:00","price":0.3861,"onOff":false,"saving":null},{"start":"2023-11-21T19:00:00.000+01:00","price":0.3745,"onOff":false,"saving":null},{"start":"2023-11-21T20:00:00.000+01:00","price":0.3655,"onOff":false,"saving":null},{"start":"2023-11-21T21:00:00.000+01:00","price":0.3486,"onOff":false,"saving":null},{"start":"2023-11-21T22:00:00.000+01:00","price":0.349,"onOff":false,"saving":null},{"start":"2023-11-21T23:00:00.000+01:00","price":0.3337,"onOff":false,"saving":null},{"start":"2023-11-22T00:00:00.000+01:00","price":0.3337,"onOff":false,"saving":null},{"start":"2023-11-22T01:00:00.000+01:00","price":0.3301,"onOff":false,"saving":null},{"start":"2023-11-22T02:00:00.000+01:00","price":0.3301,"onOff":false,"saving":null},{"start":"2023-11-22T03:00:00.000+01:00","price":0.3265,"onOff":false,"saving":null},{"start":"2023-11-22T04:00:00.000+01:00","price":0.3271,"onOff":false,"saving":null},{"start":"2023-11-22T05:00:00.000+01:00","price":0.3299,"onOff":false,"saving":null},{"start":"2023-11-22T06:00:00.000+01:00","price":0.36,"onOff":false,"saving":null},{"start":"2023-11-22T07:00:00.000+01:00","price":0.3845,"onOff":false,"saving":null},{"start":"2023-11-22T08:00:00.000+01:00","price":0.3975,"onOff":false,"saving":null},{"start":"2023-11-22T09:00:00.000+01:00","price":0.3733,"onOff":false,"saving":null},{"start":"2023-11-22T10:00:00.000+01:00","price":0.3539,"onOff":false,"saving":null},{"start":"2023-11-22T11:00:00.000+01:00","price":0.3404,"onOff":false,"saving":null},{"start":"2023-11-22T12:00:00.000+01:00","price":0.3309,"onOff":false,"saving":null},{"start":"2023-11-22T13:00:00.000+01:00","price":0.3389,"onOff":false,"saving":null},{"start":"2023-11-22T14:00:00.000+01:00","price":0.3551,"onOff":false,"saving":null},{"start":"2023-11-22T15:00:00.000+01:00","price":0.3596,"onOff":false,"saving":null},{"start":"2023-11-22T16:00:00.000+01:00","price":0.3682,"onOff":false,"saving":null},{"start":"2023-11-22T17:00:00.000+01:00","price":0.3752,"onOff":false,"saving":null},{"start":"2023-11-22T18:00:00.000+01:00","price":0.3716,"onOff":false,"saving":null},{"start":"2023-11-22T19:00:00.000+01:00","price":0.3584,"onOff":false,"saving":null},{"start":"2023-11-22T20:00:00.000+01:00","price":0.3425,"onOff":false,"saving":null},{"start":"2023-11-22T21:00:00.000+01:00","price":0.3237,"onOff":false,"saving":null},{"start":"2023-11-22T22:00:00.000+01:00","price":0.3244,"onOff":false,"saving":null},{"start":"2023-11-22T23:00:00.000+01:00","price":0.306,"onOff":false,"saving":null}],"source":"Tibber","config":{"fromTime":"00","toTime":"00","hoursOn":3,"maxPrice":0.35,"doNotSplit":false,"sendCurrentValueWhenRescheduling":true,"outputIfNoSchedule":false,"outputOutsidePeriod":false,"outputValueForOn":true,"outputValueForOff":false,"outputValueForOntype":"bool","outputValueForOfftype":"bool","override":"auto","contextStorage":"memory","hasChanged":false},"time":"2023-11-21T17:30:44.605+00:00","version":"4.1.5","strategyNodeId":"5a64a1e693e074e0","current":false}

@ottopaulsen
Copy link
Owner

Looking at your Best Save config, you require a minimum saving of 0.1, but looking at the data, there is not that large variation in the price, so there is no way to save 0.1 per hour. That is why it is kept on all the time.

@ottopaulsen ottopaulsen added the answerred Assume this is done. Should be closed by issuer. label Nov 26, 2023
@Schakus
Copy link
Author

Schakus commented Nov 27, 2023

Ahh got it. Ok I want to load only if the price is low, of it's not low enough, it should output false.
I think that is not possible for the best save.

I tried to do that function with lowest price and merge it. If it is super cheap, it should stay on (e.g. less then 0.23). If it is cheaper then 0.25, true for 3 hours.
But the problem is if the 0.25 comes before it goes down to 0.23 (most of the time it goes down slowly), then the battery is already charged for the higher price.
That's why I thought best save looks for the best spot over the whole day, looks into the future and see if it goes even lower. Hope you understand.

With lowest price it is like an "if cheaper then xx then enable". What is good, but what if the price is going slowly down, then the battery is full before the cheapest price.

Maybe it inspires you or you have an idea to solve it :)

@ottopaulsen
Copy link
Owner

Best save is made for postponing the consumption, for example for the water heater.
Lowest price can be used to find the X cheapest hours in a period. You must know what period you want to consider, and how many hours you need. If you do, it will find the cheapest hours.

@Schakus
Copy link
Author

Schakus commented Nov 28, 2023

Ok I think I got it. thanks

But I can't switch if off if the price is too high? Or if the saving would be not high enough?

I only want to charge if the saving is above 15%, if there is no saving, it should be stayed off.

And from my point of view I can only have that when using lowest price, correct?
Would it be possible to use your AND feature to get what I need?

@Schakus
Copy link
Author

Schakus commented Nov 30, 2023

{"schedule":[{"time":"2023-11-29T00:00:00.000+01:00","value":false,"countHours":25}],"hours":[{"start":"2023-11-29T00:00:00.000+01:00","price":0.3342,"onOff":false,"saving":null},{"start":"2023-11-30T00:00:00.000+01:00","price":0.3417,"onOff":false,"saving":null},{"start":"2023-11-30T01:00:00.000+01:00","price":0.3414,"onOff":false,"saving":null},{"start":"2023-11-30T02:00:00.000+01:00","price":0.3387,"onOff":false,"saving":null},{"start":"2023-11-30T03:00:00.000+01:00","price":0.336,"onOff":false,"saving":null},{"start":"2023-11-30T04:00:00.000+01:00","price":0.338,"onOff":false,"saving":null},{"start":"2023-11-30T05:00:00.000+01:00","price":0.3435,"onOff":false,"saving":null},{"start":"2023-11-30T06:00:00.000+01:00","price":0.371,"onOff":false,"saving":null},{"start":"2023-11-30T07:00:00.000+01:00","price":0.4171,"onOff":false,"saving":null},{"start":"2023-11-30T08:00:00.000+01:00","price":0.478,"onOff":false,"saving":null},{"start":"2023-11-30T09:00:00.000+01:00","price":0.4992,"onOff":false,"saving":null},{"start":"2023-11-30T10:00:00.000+01:00","price":0.4818,"onOff":false,"saving":null},{"start":"2023-11-30T11:00:00.000+01:00","price":0.4828,"onOff":false,"saving":null},{"start":"2023-11-30T12:00:00.000+01:00","price":0.4493,"onOff":false,"saving":null},{"start":"2023-11-30T13:00:00.000+01:00","price":0.4429,"onOff":false,"saving":null},{"start":"2023-11-30T14:00:00.000+01:00","price":0.4491,"onOff":false,"saving":null},{"start":"2023-11-30T15:00:00.000+01:00","price":0.4491,"onOff":false,"saving":null},{"start":"2023-11-30T16:00:00.000+01:00","price":0.486,"onOff":false,"saving":null},{"start":"2023-11-30T17:00:00.000+01:00","price":0.5276,"onOff":false,"saving":null},{"start":"2023-11-30T18:00:00.000+01:00","price":0.5137,"onOff":false,"saving":null},{"start":"2023-11-30T19:00:00.000+01:00","price":0.4485,"onOff":false,"saving":null},{"start":"2023-11-30T20:00:00.000+01:00","price":0.4002,"onOff":false,"saving":null},{"start":"2023-11-30T21:00:00.000+01:00","price":0.375,"onOff":false,"saving":null},{"start":"2023-11-30T22:00:00.000+01:00","price":0.3654,"onOff":false,"saving":null},{"start":"2023-11-30T23:00:00.000+01:00","price":0.3524,"onOff":false,"saving":null}],"source":"Tibber","config":{"fromTime":"00","toTime":"00","hoursOn":3,"maxPrice":0.35,"doNotSplit":false,"sendCurrentValueWhenRescheduling":true,"outputIfNoSchedule":false,"outputOutsidePeriod":false,"outputValueForOn":true,"outputValueForOff":false,"outputValueForOntype":"bool","outputValueForOfftype":"bool","override":"auto","contextStorage":"memory","hasChanged":false},"time":"2023-11-30T02:00:58.553+00:00","version":"4.1.5","strategyNodeId":"5a64a1e693e074e0","current":false}

Lowest Price stopped working again, price was below 0,35€ but it was off, why?

@ottopaulsen
Copy link
Owner

There is something odd with your prices. There is one hour for the 29th, and then 24 hours for the 30th. I haven't seen that before. Ideally it should work for the 30th, but this may be the reason it does not.

@Schakus
Copy link
Author

Schakus commented Nov 30, 2023

I took the example from your blog, thats the output after inject + tibber query:
[{"currentSubscription":{"priceInfo":{"today":[{"total":0.3417,"startsAt":"2023-11-30T00:00:00.000+01:00"},{"total":0.3414,"startsAt":"2023-11-30T01:00:00.000+01:00"},{"total":0.3387,"startsAt":"2023-11-30T02:00:00.000+01:00"},{"total":0.336,"startsAt":"2023-11-30T03:00:00.000+01:00"},{"total":0.338,"startsAt":"2023-11-30T04:00:00.000+01:00"},{"total":0.3435,"startsAt":"2023-11-30T05:00:00.000+01:00"},{"total":0.371,"startsAt":"2023-11-30T06:00:00.000+01:00"},{"total":0.4171,"startsAt":"2023-11-30T07:00:00.000+01:00"},{"total":0.478,"startsAt":"2023-11-30T08:00:00.000+01:00"},{"total":0.4992,"startsAt":"2023-11-30T09:00:00.000+01:00"},{"total":0.4818,"startsAt":"2023-11-30T10:00:00.000+01:00"},{"total":0.4828,"startsAt":"2023-11-30T11:00:00.000+01:00"},{"total":0.4493,"startsAt":"2023-11-30T12:00:00.000+01:00"},{"total":0.4429,"startsAt":"2023-11-30T13:00:00.000+01:00"},{"total":0.4491,"startsAt":"2023-11-30T14:00:00.000+01:00"},{"total":0.4491,"startsAt":"2023-11-30T15:00:00.000+01:00"},{"total":0.486,"startsAt":"2023-11-30T16:00:00.000+01:00"},{"total":0.5276,"startsAt":"2023-11-30T17:00:00.000+01:00"},{"total":0.5137,"startsAt":"2023-11-30T18:00:00.000+01:00"},{"total":0.4485,"startsAt":"2023-11-30T19:00:00.000+01:00"},{"total":0.4002,"startsAt":"2023-11-30T20:00:00.000+01:00"},{"total":0.375,"startsAt":"2023-11-30T21:00:00.000+01:00"},{"total":0.3654,"startsAt":"2023-11-30T22:00:00.000+01:00"},{"total":0.3524,"startsAt":"2023-11-30T23:00:00.000+01:00"}],"tomorrow":[{"total":0.3443,"startsAt":"2023-12-01T00:00:00.000+01:00"},{"total":0.3392,"startsAt":"2023-12-01T01:00:00.000+01:00"},{"total":0.335,"startsAt":"2023-12-01T02:00:00.000+01:00"},{"total":0.3311,"startsAt":"2023-12-01T03:00:00.000+01:00"},{"total":0.3314,"startsAt":"2023-12-01T04:00:00.000+01:00"},{"total":0.3388,"startsAt":"2023-12-01T05:00:00.000+01:00"},{"total":0.3599,"startsAt":"2023-12-01T06:00:00.000+01:00"},{"total":0.398,"startsAt":"2023-12-01T07:00:00.000+01:00"},{"total":0.4591,"startsAt":"2023-12-01T08:00:00.000+01:00"},{"total":0.482,"startsAt":"2023-12-01T09:00:00.000+01:00"},{"total":0.4733,"startsAt":"2023-12-01T10:00:00.000+01:00"},{"total":0.4711,"startsAt":"2023-12-01T11:00:00.000+01:00"},{"total":0.4516,"startsAt":"2023-12-01T12:00:00.000+01:00"},{"total":0.4255,"startsAt":"2023-12-01T13:00:00.000+01:00"},{"total":0.4245,"startsAt":"2023-12-01T14:00:00.000+01:00"},{"total":0.4365,"startsAt":"2023-12-01T15:00:00.000+01:00"},{"total":0.4551,"startsAt":"2023-12-01T16:00:00.000+01:00"},{"total":0.4916,"startsAt":"2023-12-01T17:00:00.000+01:00"},{"total":0.454,"startsAt":"2023-12-01T18:00:00.000+01:00"},{"total":0.4176,"startsAt":"2023-12-01T19:00:00.000+01:00"},{"total":0.3865,"startsAt":"2023-12-01T20:00:00.000+01:00"},{"total":0.3659,"startsAt":"2023-12-01T21:00:00.000+01:00"},{"total":0.3579,"startsAt":"2023-12-01T22:00:00.000+01:00"},{"total":0.3457,"startsAt":"2023-12-01T23:00:00.000+01:00"}]}}}]

Is that correct?

@ottopaulsen
Copy link
Owner

This looks right. It does not correspond to the output above. If you suspect there is a bug, please post both the input and the output (output 3) to/from the Lowest Price node, taken at the same time. Then I can debug.

@Schakus
Copy link
Author

Schakus commented Nov 30, 2023

Output price receiver:
{"priceData":[{"value":0.3417,"start":"2023-11-30T00:00:00.000+01:00"},{"value":0.3414,"start":"2023-11-30T01:00:00.000+01:00"},{"value":0.3387,"start":"2023-11-30T02:00:00.000+01:00"},{"value":0.336,"start":"2023-11-30T03:00:00.000+01:00"},{"value":0.338,"start":"2023-11-30T04:00:00.000+01:00"},{"value":0.3435,"start":"2023-11-30T05:00:00.000+01:00"},{"value":0.371,"start":"2023-11-30T06:00:00.000+01:00"},{"value":0.4171,"start":"2023-11-30T07:00:00.000+01:00"},{"value":0.478,"start":"2023-11-30T08:00:00.000+01:00"},{"value":0.4992,"start":"2023-11-30T09:00:00.000+01:00"},{"value":0.4818,"start":"2023-11-30T10:00:00.000+01:00"},{"value":0.4828,"start":"2023-11-30T11:00:00.000+01:00"},{"value":0.4493,"start":"2023-11-30T12:00:00.000+01:00"},{"value":0.4429,"start":"2023-11-30T13:00:00.000+01:00"},{"value":0.4491,"start":"2023-11-30T14:00:00.000+01:00"},{"value":0.4491,"start":"2023-11-30T15:00:00.000+01:00"},{"value":0.486,"start":"2023-11-30T16:00:00.000+01:00"},{"value":0.5276,"start":"2023-11-30T17:00:00.000+01:00"},{"value":0.5137,"start":"2023-11-30T18:00:00.000+01:00"},{"value":0.4485,"start":"2023-11-30T19:00:00.000+01:00"},{"value":0.4002,"start":"2023-11-30T20:00:00.000+01:00"},{"value":0.375,"start":"2023-11-30T21:00:00.000+01:00"},{"value":0.3654,"start":"2023-11-30T22:00:00.000+01:00"},{"value":0.3524,"start":"2023-11-30T23:00:00.000+01:00"},{"value":0.3443,"start":"2023-12-01T00:00:00.000+01:00"},{"value":0.3392,"start":"2023-12-01T01:00:00.000+01:00"},{"value":0.335,"start":"2023-12-01T02:00:00.000+01:00"},{"value":0.3311,"start":"2023-12-01T03:00:00.000+01:00"},{"value":0.3314,"start":"2023-12-01T04:00:00.000+01:00"},{"value":0.3388,"start":"2023-12-01T05:00:00.000+01:00"},{"value":0.3599,"start":"2023-12-01T06:00:00.000+01:00"},{"value":0.398,"start":"2023-12-01T07:00:00.000+01:00"},{"value":0.4591,"start":"2023-12-01T08:00:00.000+01:00"},{"value":0.482,"start":"2023-12-01T09:00:00.000+01:00"},{"value":0.4733,"start":"2023-12-01T10:00:00.000+01:00"},{"value":0.4711,"start":"2023-12-01T11:00:00.000+01:00"},{"value":0.4516,"start":"2023-12-01T12:00:00.000+01:00"},{"value":0.4255,"start":"2023-12-01T13:00:00.000+01:00"},{"value":0.4245,"start":"2023-12-01T14:00:00.000+01:00"},{"value":0.4365,"start":"2023-12-01T15:00:00.000+01:00"},{"value":0.4551,"start":"2023-12-01T16:00:00.000+01:00"},{"value":0.4916,"start":"2023-12-01T17:00:00.000+01:00"},{"value":0.454,"start":"2023-12-01T18:00:00.000+01:00"},{"value":0.4176,"start":"2023-12-01T19:00:00.000+01:00"},{"value":0.3865,"start":"2023-12-01T20:00:00.000+01:00"},{"value":0.3659,"start":"2023-12-01T21:00:00.000+01:00"},{"value":0.3579,"start":"2023-12-01T22:00:00.000+01:00"},{"value":0.3457,"start":"2023-12-01T23:00:00.000+01:00"}],"source":"Tibber"}

Output Lowest Price:
{"schedule":[{"time":"2023-11-30T00:00:00.000+01:00","value":false,"countHours":2},{"time":"2023-11-30T02:00:00.000+01:00","value":true,"countHours":3},{"time":"2023-11-30T05:00:00.000+01:00","value":false,"countHours":43}],"hours":[{"start":"2023-11-30T00:00:00.000+01:00","price":0.3417,"onOff":false,"saving":null},{"start":"2023-11-30T01:00:00.000+01:00","price":0.3414,"onOff":false,"saving":null},{"start":"2023-11-30T02:00:00.000+01:00","price":0.3387,"onOff":true,"saving":null},{"start":"2023-11-30T03:00:00.000+01:00","price":0.336,"onOff":true,"saving":null},{"start":"2023-11-30T04:00:00.000+01:00","price":0.338,"onOff":true,"saving":null},{"start":"2023-11-30T05:00:00.000+01:00","price":0.3435,"onOff":false,"saving":null},{"start":"2023-11-30T06:00:00.000+01:00","price":0.371,"onOff":false,"saving":null},{"start":"2023-11-30T07:00:00.000+01:00","price":0.4171,"onOff":false,"saving":null},{"start":"2023-11-30T08:00:00.000+01:00","price":0.478,"onOff":false,"saving":null},{"start":"2023-11-30T09:00:00.000+01:00","price":0.4992,"onOff":false,"saving":null},{"start":"2023-11-30T10:00:00.000+01:00","price":0.4818,"onOff":false,"saving":null},{"start":"2023-11-30T11:00:00.000+01:00","price":0.4828,"onOff":false,"saving":null},{"start":"2023-11-30T12:00:00.000+01:00","price":0.4493,"onOff":false,"saving":null},{"start":"2023-11-30T13:00:00.000+01:00","price":0.4429,"onOff":false,"saving":null},{"start":"2023-11-30T14:00:00.000+01:00","price":0.4491,"onOff":false,"saving":null},{"start":"2023-11-30T15:00:00.000+01:00","price":0.4491,"onOff":false,"saving":null},{"start":"2023-11-30T16:00:00.000+01:00","price":0.486,"onOff":false,"saving":null},{"start":"2023-11-30T17:00:00.000+01:00","price":0.5276,"onOff":false,"saving":null},{"start":"2023-11-30T18:00:00.000+01:00","price":0.5137,"onOff":false,"saving":null},{"start":"2023-11-30T19:00:00.000+01:00","price":0.4485,"onOff":false,"saving":null},{"start":"2023-11-30T20:00:00.000+01:00","price":0.4002,"onOff":false,"saving":null},{"start":"2023-11-30T21:00:00.000+01:00","price":0.375,"onOff":false,"saving":null},{"start":"2023-11-30T22:00:00.000+01:00","price":0.3654,"onOff":false,"saving":null},{"start":"2023-11-30T23:00:00.000+01:00","price":0.3524,"onOff":false,"saving":null},{"start":"2023-12-01T00:00:00.000+01:00","price":0.3443,"onOff":false,"saving":null},{"start":"2023-12-01T01:00:00.000+01:00","price":0.3392,"onOff":false,"saving":null},{"start":"2023-12-01T02:00:00.000+01:00","price":0.335,"onOff":false,"saving":null},{"start":"2023-12-01T03:00:00.000+01:00","price":0.3311,"onOff":false,"saving":null},{"start":"2023-12-01T04:00:00.000+01:00","price":0.3314,"onOff":false,"saving":null},{"start":"2023-12-01T05:00:00.000+01:00","price":0.3388,"onOff":false,"saving":null},{"start":"2023-12-01T06:00:00.000+01:00","price":0.3599,"onOff":false,"saving":null},{"start":"2023-12-01T07:00:00.000+01:00","price":0.398,"onOff":false,"saving":null},{"start":"2023-12-01T08:00:00.000+01:00","price":0.4591,"onOff":false,"saving":null},{"start":"2023-12-01T09:00:00.000+01:00","price":0.482,"onOff":false,"saving":null},{"start":"2023-12-01T10:00:00.000+01:00","price":0.4733,"onOff":false,"saving":null},{"start":"2023-12-01T11:00:00.000+01:00","price":0.4711,"onOff":false,"saving":null},{"start":"2023-12-01T12:00:00.000+01:00","price":0.4516,"onOff":false,"saving":null},{"start":"2023-12-01T13:00:00.000+01:00","price":0.4255,"onOff":false,"saving":null},{"start":"2023-12-01T14:00:00.000+01:00","price":0.4245,"onOff":false,"saving":null},{"start":"2023-12-01T15:00:00.000+01:00","price":0.4365,"onOff":false,"saving":null},{"start":"2023-12-01T16:00:00.000+01:00","price":0.4551,"onOff":false,"saving":null},{"start":"2023-12-01T17:00:00.000+01:00","price":0.4916,"onOff":false,"saving":null},{"start":"2023-12-01T18:00:00.000+01:00","price":0.454,"onOff":false,"saving":null},{"start":"2023-12-01T19:00:00.000+01:00","price":0.4176,"onOff":false,"saving":null},{"start":"2023-12-01T20:00:00.000+01:00","price":0.3865,"onOff":false,"saving":null},{"start":"2023-12-01T21:00:00.000+01:00","price":0.3659,"onOff":false,"saving":null},{"start":"2023-12-01T22:00:00.000+01:00","price":0.3579,"onOff":false,"saving":null},{"start":"2023-12-01T23:00:00.000+01:00","price":0.3457,"onOff":false,"saving":null}],"source":"Tibber","config":{"fromTime":"00","toTime":"00","hoursOn":3,"maxPrice":0.35,"doNotSplit":false,"sendCurrentValueWhenRescheduling":true,"outputIfNoSchedule":false,"outputOutsidePeriod":false,"outputValueForOn":true,"outputValueForOff":false,"outputValueForOntype":"bool","outputValueForOfftype":"bool","override":"auto","contextStorage":"memory","hasChanged":false},"time":"2023-11-30T17:29:23.336+00:00","version":"4.1.5","strategyNodeId":"5a64a1e693e074e0","current":false}

@ottopaulsen
Copy link
Owner

This is a strange one. When I am running a test with your input and your config, I am getting a different result. Your problem is that you are not getting any hours on the second day. When I run the test, it is turning on the 3 cheapest hours as expected.
So I am not able to reproduce your situation, and have no idea how to solve it.
Does this give you any ideas?

@Schakus
Copy link
Author

Schakus commented Dec 1, 2023

I'm using nodered v3.1.0, which version are you using?
I'm sendung you my flow, maybe you see something... Could you try this please?

[ { "id": "edded91d27eede05", "type": "tab", "label": "Flow 4", "disabled": true, "info": "", "env": [] }, { "id": "04dc4638a608b090", "type": "ps-receive-price", "z": "edded91d27eede05", "name": "Price Receiver", "x": 780, "y": 140, "wires": [ [ "d52b6a7d92f1daed", "21c9033c4a155577", "a90283ec61427979", "d757a13b5b25b093" ] ] }, { "id": "9815c94e42041dbf", "type": "tibber-query", "z": "edded91d27eede05", "name": "", "active": true, "apiEndpointRef": "5ad234970908fd19", "x": 330, "y": 140, "wires": [ [ "e5f3db63a600a81a", "2f368f159948d8ce" ] ] }, { "id": "41f60e35ce19a930", "type": "inject", "z": "edded91d27eede05", "name": "", "props": [ { "p": "payload" } ], "repeat": "3600", "crontab": "", "once": true, "onceDelay": "1", "topic": "", "payload": "{ viewer { homes { currentSubscription{ priceInfo{ current{ total energy tax startsAt } today { total energy tax startsAt } tomorrow { total energy tax startsAt } } } } }}", "payloadType": "str", "x": 170, "y": 140, "wires": [ [] ] }, { "id": "d52b6a7d92f1daed", "type": "ps-strategy-best-save", "z": "edded91d27eede05", "name": "Best Save", "maxHoursToSaveInSequence": "3", "minHoursOnAfterMaxSequenceSaved": "18", "minSaving": "0.08", "sendCurrentValueWhenRescheduling": true, "outputValueForOn": "true", "outputValueForOff": "false", "outputValueForOntype": "bool", "outputValueForOfftype": "bool", "outputIfNoSchedule": "false", "contextStorage": "memory", "x": 1030, "y": 140, "wires": [ [ "639391b466ef5fdb", "987ab5b89f4b8b69" ], [ "639391b466ef5fdb", "987ab5b89f4b8b69" ], [ "8adbc0121ec2b2ef" ] ] }, { "id": "8adbc0121ec2b2ef", "type": "debug", "z": "edded91d27eede05", "name": "debug 15", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1240, "y": 220, "wires": [] }, { "id": "639391b466ef5fdb", "type": "debug", "z": "edded91d27eede05", "name": "debug 16", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1240, "y": 180, "wires": [] }, { "id": "21c9033c4a155577", "type": "ps-strategy-lowest-price", "z": "edded91d27eede05", "name": "Lowest Price", "fromTime": "00", "toTime": "00", "hoursOn": "3", "maxPrice": "0.35", "doNotSplit": false, "sendCurrentValueWhenRescheduling": true, "outputValueForOn": "true", "outputValueForOff": "false", "outputValueForOntype": "bool", "outputValueForOfftype": "bool", "outputIfNoSchedule": "false", "outputOutsidePeriod": "false", "contextStorage": "memory", "x": 1030, "y": 360, "wires": [ [ "8735912516298cd3", "4d7ac35e5fe26e8f" ], [ "8735912516298cd3", "4d7ac35e5fe26e8f" ], [ "bcbb06b1281290e2", "0023c9d4c7fd0bfb" ] ] }, { "id": "8735912516298cd3", "type": "debug", "z": "edded91d27eede05", "name": "debug 17", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1240, "y": 340, "wires": [] }, { "id": "bcbb06b1281290e2", "type": "debug", "z": "edded91d27eede05", "name": "debug 18", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1240, "y": 380, "wires": [] }, { "id": "e5f3db63a600a81a", "type": "trigger", "z": "edded91d27eede05", "name": "", "op1": "", "op2": "0", "op1type": "pay", "op2type": "str", "duration": "-1", "extend": false, "overrideDelay": false, "units": "min", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 550, "y": 140, "wires": [ [ "04dc4638a608b090" ] ] }, { "id": "2f368f159948d8ce", "type": "debug", "z": "edded91d27eede05", "name": "debug 19", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 440, "y": 220, "wires": [] }, { "id": "bef64f5a8847dc84", "type": "ui_chart", "z": "edded91d27eede05", "name": "", "group": "9b52e7d0e84e2e55", "order": 1, "width": 0, "height": 0, "label": "lowest Price", "chartType": "line", "legend": "false", "xformat": "HH:mm", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "1", "removeOlder": "2", "removeOlderPoints": "", "removeOlderUnit": "86400", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1870, "y": 280, "wires": [ [] ] }, { "id": "909b9add89c38845", "type": "trigger", "z": "edded91d27eede05", "name": "", "op1": "", "op2": "0", "op1type": "pay", "op2type": "str", "duration": "-1", "extend": false, "overrideDelay": false, "units": "min", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 1650, "y": 280, "wires": [ [ "bef64f5a8847dc84" ] ] }, { "id": "987ab5b89f4b8b69", "type": "switch", "z": "edded91d27eede05", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1230, "y": 100, "wires": [ [ "8a89cb84f35062c5" ], [ "fe36a8590db7516a" ] ] }, { "id": "8a89cb84f35062c5", "type": "change", "z": "edded91d27eede05", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1410, "y": 80, "wires": [ [ "1ad417813899a5f2" ] ] }, { "id": "fe36a8590db7516a", "type": "change", "z": "edded91d27eede05", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1410, "y": 120, "wires": [ [ "1ad417813899a5f2" ] ] }, { "id": "4d7ac35e5fe26e8f", "type": "switch", "z": "edded91d27eede05", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1230, "y": 280, "wires": [ [ "2e3720ef232ae19a" ], [ "cba87a4e713c8ae1" ] ] }, { "id": "2e3720ef232ae19a", "type": "change", "z": "edded91d27eede05", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1410, "y": 260, "wires": [ [ "909b9add89c38845" ] ] }, { "id": "cba87a4e713c8ae1", "type": "change", "z": "edded91d27eede05", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1410, "y": 300, "wires": [ [ "909b9add89c38845" ] ] }, { "id": "1ad417813899a5f2", "type": "trigger", "z": "edded91d27eede05", "name": "", "op1": "", "op2": "0", "op1type": "pay", "op2type": "str", "duration": "-1", "extend": false, "overrideDelay": false, "units": "min", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 1650, "y": 100, "wires": [ [ "5da395848b518071" ] ] }, { "id": "5da395848b518071", "type": "ui_chart", "z": "edded91d27eede05", "name": "", "group": "9b52e7d0e84e2e55", "order": 1, "width": 0, "height": 0, "label": "Best save", "chartType": "line", "legend": "false", "xformat": "HH:mm", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "1", "removeOlder": "2", "removeOlderPoints": "", "removeOlderUnit": "86400", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1860, "y": 100, "wires": [ [] ] }, { "id": "27fd8fa1a8a95b72", "type": "inject", "z": "edded91d27eede05", "name": "Refresh", "props": [ { "p": "payload" } ], "repeat": "3600", "crontab": "", "once": true, "onceDelay": "1", "topic": "", "payload": "{ viewer { homes { currentSubscription{ priceInfo{ today { total startsAt } tomorrow { total startsAt } } } } } }", "payloadType": "str", "x": 180, "y": 80, "wires": [ [ "9815c94e42041dbf" ] ] }, { "id": "a90283ec61427979", "type": "debug", "z": "edded91d27eede05", "name": "debug 20", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 800, "y": 220, "wires": [] }, { "id": "d757a13b5b25b093", "type": "ps-strategy-lowest-price", "z": "edded91d27eede05", "name": "Lowest Price <25", "fromTime": "00", "toTime": "00", "hoursOn": "24", "maxPrice": "0.25", "doNotSplit": false, "sendCurrentValueWhenRescheduling": true, "outputValueForOn": "true", "outputValueForOff": "false", "outputValueForOntype": "bool", "outputValueForOfftype": "bool", "outputIfNoSchedule": "false", "outputOutsidePeriod": "false", "contextStorage": "memory", "x": 1050, "y": 480, "wires": [ [ "f5f02bb6c229b6e1" ], [ "f5f02bb6c229b6e1" ], [ "0023c9d4c7fd0bfb", "d418cdcd5eaa1319" ] ] }, { "id": "0023c9d4c7fd0bfb", "type": "ps-schedule-merger", "z": "edded91d27eede05", "name": "Schedule Merger", "outputIfNoSchedule": "false", "logicFunction": "OR", "schedulingDelay": 2000, "sendCurrentValueWhenRescheduling": true, "outputValueForOn": "true", "outputValueForOff": "false", "outputValueForOntype": "bool", "outputValueForOfftype": "bool", "x": 1290, "y": 480, "wires": [ [ "494e82731284992d" ], [ "494e82731284992d" ], [] ] }, { "id": "8e98cbc7698f151a", "type": "ui_chart", "z": "edded91d27eede05", "name": "", "group": "9b52e7d0e84e2e55", "order": 1, "width": 0, "height": 0, "label": "lowest Price merged", "chartType": "line", "legend": "false", "xformat": "HH:mm", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "1", "removeOlder": "2", "removeOlderPoints": "", "removeOlderUnit": "86400", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1940, "y": 600, "wires": [ [] ] }, { "id": "fcad8a29d95d7a12", "type": "trigger", "z": "edded91d27eede05", "name": "", "op1": "", "op2": "0", "op1type": "pay", "op2type": "str", "duration": "-1", "extend": false, "overrideDelay": false, "units": "min", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 1690, "y": 600, "wires": [ [ "8e98cbc7698f151a" ] ] }, { "id": "494e82731284992d", "type": "switch", "z": "edded91d27eede05", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1270, "y": 600, "wires": [ [ "218e2e234f59be32" ], [ "22f7edd1321faebf" ] ] }, { "id": "218e2e234f59be32", "type": "change", "z": "edded91d27eede05", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1450, "y": 580, "wires": [ [ "fcad8a29d95d7a12" ] ] }, { "id": "22f7edd1321faebf", "type": "change", "z": "edded91d27eede05", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1450, "y": 620, "wires": [ [ "fcad8a29d95d7a12" ] ] }, { "id": "1e7c581afcc369e8", "type": "ui_chart", "z": "edded91d27eede05", "name": "", "group": "9b52e7d0e84e2e55", "order": 1, "width": 0, "height": 0, "label": "lowest Price <0.25", "chartType": "line", "legend": "false", "xformat": "HH:mm", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "1", "removeOlder": "2", "removeOlderPoints": "", "removeOlderUnit": "86400", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1930, "y": 720, "wires": [ [] ] }, { "id": "f88c73b65bc0a253", "type": "trigger", "z": "edded91d27eede05", "name": "", "op1": "", "op2": "0", "op1type": "pay", "op2type": "str", "duration": "-1", "extend": false, "overrideDelay": false, "units": "min", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 1690, "y": 720, "wires": [ [ "1e7c581afcc369e8" ] ] }, { "id": "f5f02bb6c229b6e1", "type": "switch", "z": "edded91d27eede05", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1270, "y": 720, "wires": [ [ "9c2b775e0f3e637b" ], [ "ba908ea2bc3152a6" ] ] }, { "id": "9c2b775e0f3e637b", "type": "change", "z": "edded91d27eede05", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1450, "y": 700, "wires": [ [ "f88c73b65bc0a253" ] ] }, { "id": "ba908ea2bc3152a6", "type": "change", "z": "edded91d27eede05", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1450, "y": 740, "wires": [ [ "f88c73b65bc0a253" ] ] }, { "id": "d418cdcd5eaa1319", "type": "debug", "z": "edded91d27eede05", "name": "debug 21", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1080, "y": 580, "wires": [] }, { "id": "5ad234970908fd19", "type": "tibber-api-endpoint", "queryUrl": "https://api.tibber.com/v1-beta/gql", "feedConnectionTimeout": "30", "feedTimeout": "60", "queryRequestTimeout": "30", "name": "Waldhaus" }, { "id": "9b52e7d0e84e2e55", "type": "ui_group", "name": "WR-Control", "tab": "1c1b401640ce40e1", "order": 1, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "1c1b401640ce40e1", "type": "ui_tab", "name": "Home", "icon": "dashboard", "disabled": false, "hidden": false } ]

@Schakus
Copy link
Author

Schakus commented Dec 5, 2023

This is a strange one. When I am running a test with your input and your config, I am getting a different result. Your problem is that you are not getting any hours on the second day. When I run the test, it is turning on the 3 cheapest hours as expected. So I am not able to reproduce your situation, and have no idea how to solve it. Does this give you any ideas?

where do you see that I'm not getting any data on the second day?

@ottopaulsen
Copy link
Owner

I guess that was poorly phrased. You are getting data for the second date, but all hours are off . No hours are turned on. That is strange.

@ottopaulsen
Copy link
Owner

Have you checked for any error messages from Node-RED? I guess you should see them in the debug window.

@Schakus
Copy link
Author

Schakus commented Dec 5, 2023

Only "No schedule"

@Schakus
Copy link
Author

Schakus commented Dec 5, 2023

Ok clear, yes thats my problem.

Which nodered version do you have?

Are you able to reproduce with my node?

@ottopaulsen
Copy link
Owner

I am not able to try your flow, but I can see you have a resend every 1 min node between the Tibber query and the Price Receiver. That does look like a very bad idea. Best Save, Lowest Price and Schedule Merger are all saving the data and creating their own schedule, sending the necessary on/off messages when that is necessary. If you resend the input every minute, you will probably disturb a lot. I suggest you remove it.

@Schakus
Copy link
Author

Schakus commented Dec 6, 2023

Ok thanks, I will try it

@Schakus
Copy link
Author

Schakus commented Dec 10, 2023

Hey, still not working:
image
the image shows the first block (below 35 cents).

and second block output was:
image

price was very low at 3 am, 2nd block wasn't working at all, I have no idea why

here the output:
{"schedule":[{"time":"2023-12-08T00:00:00.000+01:00","value":false,"countHours":49}],"hours":[{"start":"2023-12-08T00:00:00.000+01:00","price":0.3207,"onOff":false,"saving":null},{"start":"2023-12-09T00:00:00.000+01:00","price":0.3301,"onOff":false,"saving":null},{"start":"2023-12-09T01:00:00.000+01:00","price":0.3183,"onOff":false,"saving":null},{"start":"2023-12-09T02:00:00.000+01:00","price":0.3116,"onOff":false,"saving":null},{"start":"2023-12-09T03:00:00.000+01:00","price":0.304,"onOff":false,"saving":null},{"start":"2023-12-09T04:00:00.000+01:00","price":0.301,"onOff":false,"saving":null},{"start":"2023-12-09T05:00:00.000+01:00","price":0.3039,"onOff":false,"saving":null},{"start":"2023-12-09T06:00:00.000+01:00","price":0.3075,"onOff":false,"saving":null},{"start":"2023-12-09T07:00:00.000+01:00","price":0.3151,"onOff":false,"saving":null},{"start":"2023-12-09T08:00:00.000+01:00","price":0.3181,"onOff":false,"saving":null},{"start":"2023-12-09T09:00:00.000+01:00","price":0.3259,"onOff":false,"saving":null},{"start":"2023-12-09T10:00:00.000+01:00","price":0.3253,"onOff":false,"saving":null},{"start":"2023-12-09T11:00:00.000+01:00","price":0.3264,"onOff":false,"saving":null},{"start":"2023-12-09T12:00:00.000+01:00","price":0.3291,"onOff":false,"saving":null},{"start":"2023-12-09T13:00:00.000+01:00","price":0.3249,"onOff":false,"saving":null},{"start":"2023-12-09T14:00:00.000+01:00","price":0.3189,"onOff":false,"saving":null},{"start":"2023-12-09T15:00:00.000+01:00","price":0.3164,"onOff":false,"saving":null},{"start":"2023-12-09T16:00:00.000+01:00","price":0.3123,"onOff":false,"saving":null},{"start":"2023-12-09T17:00:00.000+01:00","price":0.3111,"onOff":false,"saving":null},{"start":"2023-12-09T18:00:00.000+01:00","price":0.3092,"onOff":false,"saving":null},{"start":"2023-12-09T19:00:00.000+01:00","price":0.2997,"onOff":false,"saving":null},{"start":"2023-12-09T20:00:00.000+01:00","price":0.2937,"onOff":false,"saving":null},{"start":"2023-12-09T21:00:00.000+01:00","price":0.2889,"onOff":false,"saving":null},{"start":"2023-12-09T22:00:00.000+01:00","price":0.2847,"onOff":false,"saving":null},{"start":"2023-12-09T23:00:00.000+01:00","price":0.272,"onOff":false,"saving":null},{"start":"2023-12-10T00:00:00.000+01:00","price":0.2571,"onOff":false,"saving":null},{"start":"2023-12-10T01:00:00.000+01:00","price":0.2426,"onOff":false,"saving":null},{"start":"2023-12-10T02:00:00.000+01:00","price":0.2328,"onOff":false,"saving":null},{"start":"2023-12-10T03:00:00.000+01:00","price":0.2242,"onOff":false,"saving":null},{"start":"2023-12-10T04:00:00.000+01:00","price":0.2289,"onOff":false,"saving":null},{"start":"2023-12-10T05:00:00.000+01:00","price":0.2386,"onOff":false,"saving":null},{"start":"2023-12-10T06:00:00.000+01:00","price":0.2456,"onOff":false,"saving":null},{"start":"2023-12-10T07:00:00.000+01:00","price":0.2668,"onOff":false,"saving":null},{"start":"2023-12-10T08:00:00.000+01:00","price":0.2895,"onOff":false,"saving":null},{"start":"2023-12-10T09:00:00.000+01:00","price":0.2953,"onOff":false,"saving":null},{"start":"2023-12-10T10:00:00.000+01:00","price":0.2972,"onOff":false,"saving":null},{"start":"2023-12-10T11:00:00.000+01:00","price":0.3,"onOff":false,"saving":null},{"start":"2023-12-10T12:00:00.000+01:00","price":0.297,"onOff":false,"saving":null},{"start":"2023-12-10T13:00:00.000+01:00","price":0.2969,"onOff":false,"saving":null},{"start":"2023-12-10T14:00:00.000+01:00","price":0.2999,"onOff":false,"saving":null},{"start":"2023-12-10T15:00:00.000+01:00","price":0.3073,"onOff":false,"saving":null},{"start":"2023-12-10T16:00:00.000+01:00","price":0.3126,"onOff":false,"saving":null},{"start":"2023-12-10T17:00:00.000+01:00","price":0.3126,"onOff":false,"saving":null},{"start":"2023-12-10T18:00:00.000+01:00","price":0.3187,"onOff":false,"saving":null},{"start":"2023-12-10T19:00:00.000+01:00","price":0.3131,"onOff":false,"saving":null},{"start":"2023-12-10T20:00:00.000+01:00","price":0.3099,"onOff":false,"saving":null},{"start":"2023-12-10T21:00:00.000+01:00","price":0.3088,"onOff":false,"saving":null},{"start":"2023-12-10T22:00:00.000+01:00","price":0.3099,"onOff":false,"saving":null},{"start":"2023-12-10T23:00:00.000+01:00","price":0.2993,"onOff":false,"saving":null}],"source":"Tibber","config":{"fromTime":"00","toTime":"00","hoursOn":24,"maxPrice":0.25,"doNotSplit":false,"sendCurrentValueWhenRescheduling":true,"outputIfNoSchedule":false,"outputOutsidePeriod":false,"outputValueForOn":true,"outputValueForOff":false,"outputValueForOntype":"bool","outputValueForOfftype":"bool","override":"auto","contextStorage":"memory","hasChanged":false},"time":"2023-12-09T20:42:39.599+00:00","version":"4.1.5","strategyNodeId":"80123b883e171945","current":false}

{"schedule":[{"time":"2023-12-08T00:00:00.000+01:00","value":false,"countHours":23},{"time":"2023-12-09T22:00:00.000+01:00","value":true,"countHours":3},{"time":"2023-12-10T01:00:00.000+01:00","value":false,"countHours":23}],"hours":[{"start":"2023-12-08T00:00:00.000+01:00","price":0.3207,"onOff":false,"saving":null},{"start":"2023-12-09T00:00:00.000+01:00","price":0.3301,"onOff":false,"saving":null},{"start":"2023-12-09T01:00:00.000+01:00","price":0.3183,"onOff":false,"saving":null},{"start":"2023-12-09T02:00:00.000+01:00","price":0.3116,"onOff":false,"saving":null},{"start":"2023-12-09T03:00:00.000+01:00","price":0.304,"onOff":false,"saving":null},{"start":"2023-12-09T04:00:00.000+01:00","price":0.301,"onOff":false,"saving":null},{"start":"2023-12-09T05:00:00.000+01:00","price":0.3039,"onOff":false,"saving":null},{"start":"2023-12-09T06:00:00.000+01:00","price":0.3075,"onOff":false,"saving":null},{"start":"2023-12-09T07:00:00.000+01:00","price":0.3151,"onOff":false,"saving":null},{"start":"2023-12-09T08:00:00.000+01:00","price":0.3181,"onOff":false,"saving":null},{"start":"2023-12-09T09:00:00.000+01:00","price":0.3259,"onOff":false,"saving":null},{"start":"2023-12-09T10:00:00.000+01:00","price":0.3253,"onOff":false,"saving":null},{"start":"2023-12-09T11:00:00.000+01:00","price":0.3264,"onOff":false,"saving":null},{"start":"2023-12-09T12:00:00.000+01:00","price":0.3291,"onOff":false,"saving":null},{"start":"2023-12-09T13:00:00.000+01:00","price":0.3249,"onOff":false,"saving":null},{"start":"2023-12-09T14:00:00.000+01:00","price":0.3189,"onOff":false,"saving":null},{"start":"2023-12-09T15:00:00.000+01:00","price":0.3164,"onOff":false,"saving":null},{"start":"2023-12-09T16:00:00.000+01:00","price":0.3123,"onOff":false,"saving":null},{"start":"2023-12-09T17:00:00.000+01:00","price":0.3111,"onOff":false,"saving":null},{"start":"2023-12-09T18:00:00.000+01:00","price":0.3092,"onOff":false,"saving":null},{"start":"2023-12-09T19:00:00.000+01:00","price":0.2997,"onOff":false,"saving":null},{"start":"2023-12-09T20:00:00.000+01:00","price":0.2937,"onOff":false,"saving":null},{"start":"2023-12-09T21:00:00.000+01:00","price":0.2889,"onOff":false,"saving":null},{"start":"2023-12-09T22:00:00.000+01:00","price":0.2847,"onOff":true,"saving":null},{"start":"2023-12-09T23:00:00.000+01:00","price":0.272,"onOff":true,"saving":null},{"start":"2023-12-10T00:00:00.000+01:00","price":0.2571,"onOff":true,"saving":null},{"start":"2023-12-10T01:00:00.000+01:00","price":0.2426,"onOff":false,"saving":null},{"start":"2023-12-10T02:00:00.000+01:00","price":0.2328,"onOff":false,"saving":null},{"start":"2023-12-10T03:00:00.000+01:00","price":0.2242,"onOff":false,"saving":null},{"start":"2023-12-10T04:00:00.000+01:00","price":0.2289,"onOff":false,"saving":null},{"start":"2023-12-10T05:00:00.000+01:00","price":0.2386,"onOff":false,"saving":null},{"start":"2023-12-10T06:00:00.000+01:00","price":0.2456,"onOff":false,"saving":null},{"start":"2023-12-10T07:00:00.000+01:00","price":0.2668,"onOff":false,"saving":null},{"start":"2023-12-10T08:00:00.000+01:00","price":0.2895,"onOff":false,"saving":null},{"start":"2023-12-10T09:00:00.000+01:00","price":0.2953,"onOff":false,"saving":null},{"start":"2023-12-10T10:00:00.000+01:00","price":0.2972,"onOff":false,"saving":null},{"start":"2023-12-10T11:00:00.000+01:00","price":0.3,"onOff":false,"saving":null},{"start":"2023-12-10T12:00:00.000+01:00","price":0.297,"onOff":false,"saving":null},{"start":"2023-12-10T13:00:00.000+01:00","price":0.2969,"onOff":false,"saving":null},{"start":"2023-12-10T14:00:00.000+01:00","price":0.2999,"onOff":false,"saving":null},{"start":"2023-12-10T15:00:00.000+01:00","price":0.3073,"onOff":false,"saving":null},{"start":"2023-12-10T16:00:00.000+01:00","price":0.3126,"onOff":false,"saving":null},{"start":"2023-12-10T17:00:00.000+01:00","price":0.3126,"onOff":false,"saving":null},{"start":"2023-12-10T18:00:00.000+01:00","price":0.3187,"onOff":false,"saving":null},{"start":"2023-12-10T19:00:00.000+01:00","price":0.3131,"onOff":false,"saving":null},{"start":"2023-12-10T20:00:00.000+01:00","price":0.3099,"onOff":false,"saving":null},{"start":"2023-12-10T21:00:00.000+01:00","price":0.3088,"onOff":false,"saving":null},{"start":"2023-12-10T22:00:00.000+01:00","price":0.3099,"onOff":false,"saving":null},{"start":"2023-12-10T23:00:00.000+01:00","price":0.2993,"onOff":false,"saving":null}],"source":"Tibber","config":{"fromTime":"00","toTime":"00","hoursOn":3,"maxPrice":0.35,"doNotSplit":false,"sendCurrentValueWhenRescheduling":true,"outputIfNoSchedule":false,"outputOutsidePeriod":false,"outputValueForOn":true,"outputValueForOff":false,"outputValueForOntype":"bool","outputValueForOfftype":"bool","override":"auto","contextStorage":"memory","hasChanged":false},"time":"2023-12-09T20:42:39.553+00:00","version":"4.1.5","strategyNodeId":"5a64a1e693e074e0","current":false}

@ottopaulsen
Copy link
Owner

ottopaulsen commented Dec 10, 2023

Any idea why you are getting one hour of price data for the day before?

@Schakus
Copy link
Author

Schakus commented Dec 10, 2023

No, I have send you the whole flow. With tibber query, do you see an error in the query?

@ottopaulsen
Copy link
Owner

ottopaulsen commented Dec 10, 2023

The Tibber query is fine.
Can you try to select the Lowest Price node, then delete all the context data for that node, and try to receive price data again? I am wondering if there is any saved data disturbing the scheduling.

If that does not help, Send both input and output for one failing example.

Context data looks like this:
image
Just delete all of them for that node.

@Schakus
Copy link
Author

Schakus commented Dec 10, 2023

Seems not working. On the lowest price blocks is written "overwrite undefined"

Input:
{"priceData":[{"value":0.2571,"start":"2023-12-10T00:00:00.000+01:00"},{"value":0.2426,"start":"2023-12-10T01:00:00.000+01:00"},{"value":0.2328,"start":"2023-12-10T02:00:00.000+01:00"},{"value":0.2242,"start":"2023-12-10T03:00:00.000+01:00"},{"value":0.2289,"start":"2023-12-10T04:00:00.000+01:00"},{"value":0.2386,"start":"2023-12-10T05:00:00.000+01:00"},{"value":0.2456,"start":"2023-12-10T06:00:00.000+01:00"},{"value":0.2668,"start":"2023-12-10T07:00:00.000+01:00"},{"value":0.2895,"start":"2023-12-10T08:00:00.000+01:00"},{"value":0.2953,"start":"2023-12-10T09:00:00.000+01:00"},{"value":0.2972,"start":"2023-12-10T10:00:00.000+01:00"},{"value":0.3,"start":"2023-12-10T11:00:00.000+01:00"},{"value":0.297,"start":"2023-12-10T12:00:00.000+01:00"},{"value":0.2969,"start":"2023-12-10T13:00:00.000+01:00"},{"value":0.2999,"start":"2023-12-10T14:00:00.000+01:00"},{"value":0.3073,"start":"2023-12-10T15:00:00.000+01:00"},{"value":0.3126,"start":"2023-12-10T16:00:00.000+01:00"},{"value":0.3126,"start":"2023-12-10T17:00:00.000+01:00"},{"value":0.3187,"start":"2023-12-10T18:00:00.000+01:00"},{"value":0.3131,"start":"2023-12-10T19:00:00.000+01:00"},{"value":0.3099,"start":"2023-12-10T20:00:00.000+01:00"},{"value":0.3088,"start":"2023-12-10T21:00:00.000+01:00"},{"value":0.3099,"start":"2023-12-10T22:00:00.000+01:00"},{"value":0.2993,"start":"2023-12-10T23:00:00.000+01:00"},{"value":0.258,"start":"2023-12-11T00:00:00.000+01:00"},{"value":0.2355,"start":"2023-12-11T01:00:00.000+01:00"},{"value":0.2322,"start":"2023-12-11T02:00:00.000+01:00"},{"value":0.2273,"start":"2023-12-11T03:00:00.000+01:00"},{"value":0.2311,"start":"2023-12-11T04:00:00.000+01:00"},{"value":0.2623,"start":"2023-12-11T05:00:00.000+01:00"},{"value":0.3058,"start":"2023-12-11T06:00:00.000+01:00"},{"value":0.3258,"start":"2023-12-11T07:00:00.000+01:00"},{"value":0.3336,"start":"2023-12-11T08:00:00.000+01:00"},{"value":0.334,"start":"2023-12-11T09:00:00.000+01:00"},{"value":0.3281,"start":"2023-12-11T10:00:00.000+01:00"},{"value":0.3249,"start":"2023-12-11T11:00:00.000+01:00"},{"value":0.3233,"start":"2023-12-11T12:00:00.000+01:00"},{"value":0.3218,"start":"2023-12-11T13:00:00.000+01:00"},{"value":0.3271,"start":"2023-12-11T14:00:00.000+01:00"},{"value":0.3312,"start":"2023-12-11T15:00:00.000+01:00"},{"value":0.3426,"start":"2023-12-11T16:00:00.000+01:00"},{"value":0.3574,"start":"2023-12-11T17:00:00.000+01:00"},{"value":0.363,"start":"2023-12-11T18:00:00.000+01:00"},{"value":0.3614,"start":"2023-12-11T19:00:00.000+01:00"},{"value":0.3527,"start":"2023-12-11T20:00:00.000+01:00"},{"value":0.3351,"start":"2023-12-11T21:00:00.000+01:00"},{"value":0.3318,"start":"2023-12-11T22:00:00.000+01:00"},{"value":0.3203,"start":"2023-12-11T23:00:00.000+01:00"}],"source":"Tibber"}

Output:
{"schedule":[{"time":"2023-12-10T00:00:00.000+01:00","value":false,"countHours":2},{"time":"2023-12-10T02:00:00.000+01:00","value":true,"countHours":3},{"time":"2023-12-10T05:00:00.000+01:00","value":false,"countHours":43},{"time":"2023-12-11T23:00:00.000+00:00","countHours":null}],"hours":[{"start":"2023-12-10T00:00:00.000+01:00","price":0.2571,"onOff":false,"saving":null},{"start":"2023-12-10T01:00:00.000+01:00","price":0.2426,"onOff":false,"saving":null},{"start":"2023-12-10T02:00:00.000+01:00","price":0.2328,"onOff":true,"saving":null},{"start":"2023-12-10T03:00:00.000+01:00","price":0.2242,"onOff":true,"saving":null},{"start":"2023-12-10T04:00:00.000+01:00","price":0.2289,"onOff":true,"saving":null},{"start":"2023-12-10T05:00:00.000+01:00","price":0.2386,"onOff":false,"saving":null},{"start":"2023-12-10T06:00:00.000+01:00","price":0.2456,"onOff":false,"saving":null},{"start":"2023-12-10T07:00:00.000+01:00","price":0.2668,"onOff":false,"saving":null},{"start":"2023-12-10T08:00:00.000+01:00","price":0.2895,"onOff":false,"saving":null},{"start":"2023-12-10T09:00:00.000+01:00","price":0.2953,"onOff":false,"saving":null},{"start":"2023-12-10T10:00:00.000+01:00","price":0.2972,"onOff":false,"saving":null},{"start":"2023-12-10T11:00:00.000+01:00","price":0.3,"onOff":false,"saving":null},{"start":"2023-12-10T12:00:00.000+01:00","price":0.297,"onOff":false,"saving":null},{"start":"2023-12-10T13:00:00.000+01:00","price":0.2969,"onOff":false,"saving":null},{"start":"2023-12-10T14:00:00.000+01:00","price":0.2999,"onOff":false,"saving":null},{"start":"2023-12-10T15:00:00.000+01:00","price":0.3073,"onOff":false,"saving":null},{"start":"2023-12-10T16:00:00.000+01:00","price":0.3126,"onOff":false,"saving":null},{"start":"2023-12-10T17:00:00.000+01:00","price":0.3126,"onOff":false,"saving":null},{"start":"2023-12-10T18:00:00.000+01:00","price":0.3187,"onOff":false,"saving":null},{"start":"2023-12-10T19:00:00.000+01:00","price":0.3131,"onOff":false,"saving":null},{"start":"2023-12-10T20:00:00.000+01:00","price":0.3099,"onOff":false,"saving":null},{"start":"2023-12-10T21:00:00.000+01:00","price":0.3088,"onOff":false,"saving":null},{"start":"2023-12-10T22:00:00.000+01:00","price":0.3099,"onOff":false,"saving":null},{"start":"2023-12-10T23:00:00.000+01:00","price":0.2993,"onOff":false,"saving":null},{"start":"2023-12-11T00:00:00.000+01:00","price":0.258,"onOff":false,"saving":null},{"start":"2023-12-11T01:00:00.000+01:00","price":0.2355,"onOff":false,"saving":null},{"start":"2023-12-11T02:00:00.000+01:00","price":0.2322,"onOff":false,"saving":null},{"start":"2023-12-11T03:00:00.000+01:00","price":0.2273,"onOff":false,"saving":null},{"start":"2023-12-11T04:00:00.000+01:00","price":0.2311,"onOff":false,"saving":null},{"start":"2023-12-11T05:00:00.000+01:00","price":0.2623,"onOff":false,"saving":null},{"start":"2023-12-11T06:00:00.000+01:00","price":0.3058,"onOff":false,"saving":null},{"start":"2023-12-11T07:00:00.000+01:00","price":0.3258,"onOff":false,"saving":null},{"start":"2023-12-11T08:00:00.000+01:00","price":0.3336,"onOff":false,"saving":null},{"start":"2023-12-11T09:00:00.000+01:00","price":0.334,"onOff":false,"saving":null},{"start":"2023-12-11T10:00:00.000+01:00","price":0.3281,"onOff":false,"saving":null},{"start":"2023-12-11T11:00:00.000+01:00","price":0.3249,"onOff":false,"saving":null},{"start":"2023-12-11T12:00:00.000+01:00","price":0.3233,"onOff":false,"saving":null},{"start":"2023-12-11T13:00:00.000+01:00","price":0.3218,"onOff":false,"saving":null},{"start":"2023-12-11T14:00:00.000+01:00","price":0.3271,"onOff":false,"saving":null},{"start":"2023-12-11T15:00:00.000+01:00","price":0.3312,"onOff":false,"saving":null},{"start":"2023-12-11T16:00:00.000+01:00","price":0.3426,"onOff":false,"saving":null},{"start":"2023-12-11T17:00:00.000+01:00","price":0.3574,"onOff":false,"saving":null},{"start":"2023-12-11T18:00:00.000+01:00","price":0.363,"onOff":false,"saving":null},{"start":"2023-12-11T19:00:00.000+01:00","price":0.3614,"onOff":false,"saving":null},{"start":"2023-12-11T20:00:00.000+01:00","price":0.3527,"onOff":false,"saving":null},{"start":"2023-12-11T21:00:00.000+01:00","price":0.3351,"onOff":false,"saving":null},{"start":"2023-12-11T22:00:00.000+01:00","price":0.3318,"onOff":false,"saving":null},{"start":"2023-12-11T23:00:00.000+01:00","price":0.3203,"onOff":false,"saving":null}],"source":"Tibber","config":{},"time":"2023-12-10T18:24:45.128+00:00","version":"4.1.5","strategyNodeId":"5a64a1e693e074e0","current":false}

@ottopaulsen
Copy link
Owner

How come the config is empty in the output? That should not be possible.

@Schakus
Copy link
Author

Schakus commented Dec 11, 2023

I don't know.

Thats the output from this morning, seems better. But in the early hours its off, but it should be on. I don't understand why. It seems like a bug.
{"schedule":[{"time":"2023-12-10T00:00:00.000+01:00","value":false,"countHours":25}],"hours":[{"start":"2023-12-10T00:00:00.000+01:00","price":0.2571,"onOff":false,"saving":null},{"start":"2023-12-11T00:00:00.000+01:00","price":0.258,"onOff":false,"saving":null},{"start":"2023-12-11T01:00:00.000+01:00","price":0.2355,"onOff":false,"saving":null},{"start":"2023-12-11T02:00:00.000+01:00","price":0.2322,"onOff":false,"saving":null},{"start":"2023-12-11T03:00:00.000+01:00","price":0.2273,"onOff":false,"saving":null},{"start":"2023-12-11T04:00:00.000+01:00","price":0.2311,"onOff":false,"saving":null},{"start":"2023-12-11T05:00:00.000+01:00","price":0.2623,"onOff":false,"saving":null},{"start":"2023-12-11T06:00:00.000+01:00","price":0.3058,"onOff":false,"saving":null},{"start":"2023-12-11T07:00:00.000+01:00","price":0.3258,"onOff":false,"saving":null},{"start":"2023-12-11T08:00:00.000+01:00","price":0.3336,"onOff":false,"saving":null},{"start":"2023-12-11T09:00:00.000+01:00","price":0.334,"onOff":false,"saving":null},{"start":"2023-12-11T10:00:00.000+01:00","price":0.3281,"onOff":false,"saving":null},{"start":"2023-12-11T11:00:00.000+01:00","price":0.3249,"onOff":false,"saving":null},{"start":"2023-12-11T12:00:00.000+01:00","price":0.3233,"onOff":false,"saving":null},{"start":"2023-12-11T13:00:00.000+01:00","price":0.3218,"onOff":false,"saving":null},{"start":"2023-12-11T14:00:00.000+01:00","price":0.3271,"onOff":false,"saving":null},{"start":"2023-12-11T15:00:00.000+01:00","price":0.3312,"onOff":false,"saving":null},{"start":"2023-12-11T16:00:00.000+01:00","price":0.3426,"onOff":false,"saving":null},{"start":"2023-12-11T17:00:00.000+01:00","price":0.3574,"onOff":false,"saving":null},{"start":"2023-12-11T18:00:00.000+01:00","price":0.363,"onOff":false,"saving":null},{"start":"2023-12-11T19:00:00.000+01:00","price":0.3614,"onOff":false,"saving":null},{"start":"2023-12-11T20:00:00.000+01:00","price":0.3527,"onOff":false,"saving":null},{"start":"2023-12-11T21:00:00.000+01:00","price":0.3351,"onOff":false,"saving":null},{"start":"2023-12-11T22:00:00.000+01:00","price":0.3318,"onOff":false,"saving":null},{"start":"2023-12-11T23:00:00.000+01:00","price":0.3203,"onOff":false,"saving":null}],"source":"Tibber","config":{"fromTime":"00","toTime":"00","hoursOn":3,"maxPrice":0.35,"doNotSplit":false,"sendCurrentValueWhenRescheduling":true,"outputIfNoSchedule":false,"outputOutsidePeriod":false,"outputValueForOn":true,"outputValueForOff":false,"outputValueForOntype":"bool","outputValueForOfftype":"bool","override":"auto","contextStorage":"memory","hasChanged":false},"time":"2023-12-11T08:33:53.031+00:00","version":"4.1.5","strategyNodeId":"5a64a1e693e074e0","current":false}

@Schakus
Copy link
Author

Schakus commented Dec 21, 2023

Still facing that issues and no idea why. Your block is a Blackbox for me. Seems that the input is correct like you proofed already but output is wrong.

@ottopaulsen
Copy link
Owner

Sorry about that. Unfortunately I don't have any clues on how to figure this out, and I don't have much time to spend on it either.

@Schakus
Copy link
Author

Schakus commented Dec 21, 2023

Understand, could you share your working node red version and flow please? Then I can check it for the last time

@ottopaulsen
Copy link
Owner

My Node-RED is v 3.1.0.
Here is my flow (the relevant part of it):

[
  {
    "id": "4f11b5ae.4cc22c",
    "type": "inject",
    "z": "d938c47f.3398f8",
    "name": "Refresh",
    "props": [
      {
        "p": "payload"
      }
    ],
    "repeat": "3600",
    "crontab": "",
    "once": true,
    "onceDelay": "10",
    "topic": "",
    "payload": "{   viewer {     homes {       currentSubscription{         priceInfo{           today {             total             startsAt           }           tomorrow {             total             startsAt           }         }       }     }   } }",
    "payloadType": "str",
    "x": 120,
    "y": 40,
    "wires": [
      [
        "ab2d599a.077738"
      ]
    ]
  },
  {
    "id": "ab2d599a.077738",
    "type": "tibber-query",
    "z": "d938c47f.3398f8",
    "name": "Get Tibber prices",
    "active": true,
    "apiEndpointRef": "b70ec5d0.6f8f08",
    "x": 310,
    "y": 40,
    "wires": [
      [
        "0ef929fde193cf4d"
      ]
    ]
  },
  {
    "id": "0ef929fde193cf4d",
    "type": "ps-receive-price",
    "z": "d938c47f.3398f8",
    "name": "Price Receiver",
    "x": 140,
    "y": 100,
    "wires": [
      [
        "7a8286278475d629"
      ]
    ]
  },
  {
    "id": "7a8286278475d629",
    "type": "function",
    "z": "d938c47f.3398f8",
    "name": "Strømstøtte",
    "func": "const LIMIT = 0.875\nconst OVER_LIMIT_SHARE = 0.1\n\nmsg.payload.priceData.forEach((hour) => {\n    if (hour.value > LIMIT) {\n        hour.value = LIMIT + (hour.value - LIMIT) * OVER_LIMIT_SHARE\n    }\n})\nreturn msg;",
    "outputs": 1,
    "timeout": 0,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 180,
    "y": 150,
    "wires": [
      [
        "a7e63e039014fbbc",
        "10eac359fe07b577"
      ]
    ]
  },
  {
    "id": "a7e63e039014fbbc",
    "type": "ps-general-add-tariff",
    "z": "d938c47f.3398f8",
    "name": "Add Energiledd",
    "periods": [
      {
        "start": "22",
        "value": "0.307"
      },
      {
        "start": "06",
        "value": "0.403"
      }
    ],
    "validFrom": "",
    "validTo": "",
    "days": {
      "Mon": true,
      "Tue": true,
      "Wed": true,
      "Thu": true,
      "Fri": true,
      "Sat": true,
      "Sun": true
    },
    "x": 160,
    "y": 210,
    "wires": [
      [
        "5b6be1568744c6cf",
        "f0790db5b0314654"
      ]
    ]
  },
  {
    "id": "f0790db5b0314654",
    "type": "ps-strategy-lowest-price",
    "z": "d938c47f.3398f8",
    "name": "Lowest Price",
    "fromTime": "00",
    "toTime": "00",
    "hoursOn": "12",
    "maxPrice": "",
    "doNotSplit": false,
    "sendCurrentValueWhenRescheduling": true,
    "outputValueForOn": "true",
    "outputValueForOff": "false",
    "outputValueForOntype": "bool",
    "outputValueForOfftype": "bool",
    "outputIfNoSchedule": "true",
    "outputOutsidePeriod": "true",
    "contextStorage": "file",
    "x": 340,
    "y": 640,
    "wires": [
      [
        "b4724811e9a9fe6a",
        "d5c33d9a5b73a3a5",
        "a1da1282f31d20f0"
      ],
      [
        "4139ef4f3db2f754",
        "a8211f5b2e9c69d2",
        "67e3f4101c27a2b5"
      ],
      [
        "ed7202ff.b5725",
        "cad33a63f66ef72e"
      ]
    ]
  },
  {
    "id": "ed7202ff.b5725",
    "type": "debug",
    "z": "d938c47f.3398f8",
    "name": "Lowest Price Schedule",
    "active": false,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 600,
    "y": 670,
    "wires": []
  },
  {
    "id": "b70ec5d0.6f8f08",
    "type": "tibber-api-endpoint",
    "queryUrl": "https://api.tibber.com/v1-beta/gql",
    "name": "Tibber API"
  }
]

@Schakus
Copy link
Author

Schakus commented Dec 22, 2023

I changed the settings in the low price block and removed your function, output seems different, for today it makes sense to me. Let's see if it works also tomorrow (there is no schedule for tomorrow)

{"schedule":[{"time":"2023-12-22T00:00:00.000+01:00","value":false,"countHours":1},{"time":"2023-12-22T01:00:00.000+01:00","value":true,"countHours":6},{"time":"2023-12-22T07:00:00.000+01:00","value":false,"countHours":4},{"time":"2023-12-22T11:00:00.000+01:00","value":true,"countHours":1},{"time":"2023-12-22T12:00:00.000+01:00","value":false,"countHours":1},{"time":"2023-12-22T13:00:00.000+01:00","value":true,"countHours":1},{"time":"2023-12-22T14:00:00.000+01:00","value":false,"countHours":6},{"time":"2023-12-22T20:00:00.000+01:00","value":true,"countHours":2},{"time":"2023-12-22T22:00:00.000+01:00","value":false,"countHours":1},{"time":"2023-12-22T23:00:00.000+01:00","value":true,"countHours":2},{"time":"2023-12-23T01:00:00.000+01:00","value":false,"countHours":23}],"hours":[{"start":"2023-12-22T00:00:00.000+01:00","price":0.217,"onOff":false,"saving":null},{"start":"2023-12-22T01:00:00.000+01:00","price":0.2169,"onOff":true,"saving":null},{"start":"2023-12-22T02:00:00.000+01:00","price":0.2169,"onOff":true,"saving":null},{"start":"2023-12-22T03:00:00.000+01:00","price":0.2168,"onOff":true,"saving":null},{"start":"2023-12-22T04:00:00.000+01:00","price":0.2167,"onOff":true,"saving":null},{"start":"2023-12-22T05:00:00.000+01:00","price":0.2169,"onOff":true,"saving":null},{"start":"2023-12-22T06:00:00.000+01:00","price":0.218,"onOff":true,"saving":null},{"start":"2023-12-22T07:00:00.000+01:00","price":0.2547,"onOff":false,"saving":null},{"start":"2023-12-22T08:00:00.000+01:00","price":0.2643,"onOff":false,"saving":null},{"start":"2023-12-22T09:00:00.000+01:00","price":0.2594,"onOff":false,"saving":null},{"start":"2023-12-22T10:00:00.000+01:00","price":0.2485,"onOff":false,"saving":null},{"start":"2023-12-22T11:00:00.000+01:00","price":0.2482,"onOff":true,"saving":null},{"start":"2023-12-22T12:00:00.000+01:00","price":0.2488,"onOff":false,"saving":null},{"start":"2023-12-22T13:00:00.000+01:00","price":0.2471,"onOff":true,"saving":null},{"start":"2023-12-22T14:00:00.000+01:00","price":0.2514,"onOff":false,"saving":null},{"start":"2023-12-22T15:00:00.000+01:00","price":0.2577,"onOff":false,"saving":null},{"start":"2023-12-22T16:00:00.000+01:00","price":0.2675,"onOff":false,"saving":null},{"start":"2023-12-22T17:00:00.000+01:00","price":0.2681,"onOff":false,"saving":null},{"start":"2023-12-22T18:00:00.000+01:00","price":0.277,"onOff":false,"saving":null},{"start":"2023-12-22T19:00:00.000+01:00","price":0.2652,"onOff":false,"saving":null},{"start":"2023-12-22T20:00:00.000+01:00","price":0.2464,"onOff":true,"saving":null},{"start":"2023-12-22T21:00:00.000+01:00","price":0.2474,"onOff":true,"saving":null},{"start":"2023-12-22T22:00:00.000+01:00","price":0.2532,"onOff":false,"saving":null},{"start":"2023-12-22T23:00:00.000+01:00","price":0.2313,"onOff":true,"saving":null},{"start":"2023-12-23T00:00:00.000+01:00","price":0.2171,"onOff":true,"saving":null},{"start":"2023-12-23T01:00:00.000+01:00","price":0.217,"onOff":false,"saving":null},{"start":"2023-12-23T02:00:00.000+01:00","price":0.217,"onOff":false,"saving":null},{"start":"2023-12-23T03:00:00.000+01:00","price":0.217,"onOff":false,"saving":null},{"start":"2023-12-23T04:00:00.000+01:00","price":0.217,"onOff":false,"saving":null},{"start":"2023-12-23T05:00:00.000+01:00","price":0.217,"onOff":false,"saving":null},{"start":"2023-12-23T06:00:00.000+01:00","price":0.2172,"onOff":false,"saving":null},{"start":"2023-12-23T07:00:00.000+01:00","price":0.2259,"onOff":false,"saving":null},{"start":"2023-12-23T08:00:00.000+01:00","price":0.2408,"onOff":false,"saving":null},{"start":"2023-12-23T09:00:00.000+01:00","price":0.2671,"onOff":false,"saving":null},{"start":"2023-12-23T10:00:00.000+01:00","price":0.2666,"onOff":false,"saving":null},{"start":"2023-12-23T11:00:00.000+01:00","price":0.2717,"onOff":false,"saving":null},{"start":"2023-12-23T12:00:00.000+01:00","price":0.2734,"onOff":false,"saving":null},{"start":"2023-12-23T13:00:00.000+01:00","price":0.2763,"onOff":false,"saving":null},{"start":"2023-12-23T14:00:00.000+01:00","price":0.2793,"onOff":false,"saving":null},{"start":"2023-12-23T15:00:00.000+01:00","price":0.281,"onOff":false,"saving":null},{"start":"2023-12-23T16:00:00.000+01:00","price":0.2861,"onOff":false,"saving":null},{"start":"2023-12-23T17:00:00.000+01:00","price":0.2981,"onOff":false,"saving":null},{"start":"2023-12-23T18:00:00.000+01:00","price":0.2961,"onOff":false,"saving":null},{"start":"2023-12-23T19:00:00.000+01:00","price":0.2903,"onOff":false,"saving":null},{"start":"2023-12-23T20:00:00.000+01:00","price":0.2809,"onOff":false,"saving":null},{"start":"2023-12-23T21:00:00.000+01:00","price":0.2665,"onOff":false,"saving":null},{"start":"2023-12-23T22:00:00.000+01:00","price":0.2412,"onOff":false,"saving":null},{"start":"2023-12-23T23:00:00.000+01:00","price":0.2262,"onOff":false,"saving":null}],"source":"Tibber","config":{"fromTime":"00","toTime":"00","hoursOn":12,"maxPrice":0.25,"doNotSplit":false,"sendCurrentValueWhenRescheduling":true,"outputIfNoSchedule":false,"outputOutsidePeriod":false,"outputValueForOn":true,"outputValueForOff":false,"outputValueForOntype":"bool","outputValueForOfftype":"bool","override":"auto","contextStorage":"memory","hasChanged":false},"time":"2023-12-22T14:39:40.556+00:00","version":"4.1.5","strategyNodeId":"fedabe3a5f89815f","current":false}

@Schakus
Copy link
Author

Schakus commented Dec 23, 2023

Ok I thing I have something. Yesterday when I deployed the code, for yesterday it worked, but there was no schedule for tomorrow (what is today now).
And for today it stopped working, do you have an idea?:

{"schedule":[{"time":"2023-12-22T00:00:00.000+01:00","value":false,"countHours":25}],"hours":[{"start":"2023-12-22T00:00:00.000+01:00","price":0.217,"onOff":false,"saving":null},{"start":"2023-12-23T00:00:00.000+01:00","price":0.2171,"onOff":false,"saving":null},{"start":"2023-12-23T01:00:00.000+01:00","price":0.217,"onOff":false,"saving":null},{"start":"2023-12-23T02:00:00.000+01:00","price":0.217,"onOff":false,"saving":null},{"start":"2023-12-23T03:00:00.000+01:00","price":0.217,"onOff":false,"saving":null},{"start":"2023-12-23T04:00:00.000+01:00","price":0.217,"onOff":false,"saving":null},{"start":"2023-12-23T05:00:00.000+01:00","price":0.217,"onOff":false,"saving":null},{"start":"2023-12-23T06:00:00.000+01:00","price":0.2172,"onOff":false,"saving":null},{"start":"2023-12-23T07:00:00.000+01:00","price":0.2259,"onOff":false,"saving":null},{"start":"2023-12-23T08:00:00.000+01:00","price":0.2408,"onOff":false,"saving":null},{"start":"2023-12-23T09:00:00.000+01:00","price":0.2671,"onOff":false,"saving":null},{"start":"2023-12-23T10:00:00.000+01:00","price":0.2666,"onOff":false,"saving":null},{"start":"2023-12-23T11:00:00.000+01:00","price":0.2717,"onOff":false,"saving":null},{"start":"2023-12-23T12:00:00.000+01:00","price":0.2734,"onOff":false,"saving":null},{"start":"2023-12-23T13:00:00.000+01:00","price":0.2763,"onOff":false,"saving":null},{"start":"2023-12-23T14:00:00.000+01:00","price":0.2793,"onOff":false,"saving":null},{"start":"2023-12-23T15:00:00.000+01:00","price":0.281,"onOff":false,"saving":null},{"start":"2023-12-23T16:00:00.000+01:00","price":0.2861,"onOff":false,"saving":null},{"start":"2023-12-23T17:00:00.000+01:00","price":0.2981,"onOff":false,"saving":null},{"start":"2023-12-23T18:00:00.000+01:00","price":0.2961,"onOff":false,"saving":null},{"start":"2023-12-23T19:00:00.000+01:00","price":0.2903,"onOff":false,"saving":null},{"start":"2023-12-23T20:00:00.000+01:00","price":0.2809,"onOff":false,"saving":null},{"start":"2023-12-23T21:00:00.000+01:00","price":0.2665,"onOff":false,"saving":null},{"start":"2023-12-23T22:00:00.000+01:00","price":0.2412,"onOff":false,"saving":null},{"start":"2023-12-23T23:00:00.000+01:00","price":0.2262,"onOff":false,"saving":null}],"source":"Tibber","config":{"fromTime":"00","toTime":"00","hoursOn":12,"maxPrice":0.25,"doNotSplit":false,"sendCurrentValueWhenRescheduling":true,"outputIfNoSchedule":false,"outputOutsidePeriod":false,"outputValueForOn":true,"outputValueForOff":false,"outputValueForOntype":"bool","outputValueForOfftype":"bool","override":"auto","contextStorage":"memory","hasChanged":false},"time":"2023-12-23T10:07:43.417+00:00","version":"4.1.5","strategyNodeId":"fedabe3a5f89815f","current":false}

@ottopaulsen
Copy link
Owner

Sorry, no :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answerred Assume this is done. Should be closed by issuer. help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants