Closed g71 closed 1 year ago
Yes, times are strange...
It seems like it's failing to work with negative prices...
Here's the Nordpool Object:
{"_msgid":"de421530e3375098","payload":"-0.047","topic":"sensor.nordpool_kwh","data":{"entity_id":"sensor.nordpool_kwh","state":"-0.047","attributes":{"current_price":-0.047,"average":0.215,"off_peak_1":-0.192,"off_peak_2":0.804,"peak":0.29,"min":-0.258,"max":1.178,"unit":"kWh","currency":"EUR","country":"Finland","region":"FI","low_price":true,"price_percent_to_average":-0.2186046511627907,"today":[-0.001,-0.129,-0.246,-0.254,-0.258,-0.258,-0.252,-0.138,-0.047,0,0.071,0.123,0.205,0.184,0.212,0.239,0.254,0.556,0.929,0.753,1.178,0.734,0.629,0.675],"tomorrow":[],"tomorrow_valid":false,"raw_today":[{"start":"2022-11-12T00:00:00+02:00","end":"2022-11-12T01:00:00+02:00","value":-0.001},{"start":"2022-11-12T01:00:00+02:00","end":"2022-11-12T02:00:00+02:00","value":-0.129},{"start":"2022-11-12T02:00:00+02:00","end":"2022-11-12T03:00:00+02:00","value":-0.246},{"start":"2022-11-12T03:00:00+02:00","end":"2022-11-12T04:00:00+02:00","value":-0.254},{"start":"2022-11-12T04:00:00+02:00","end":"2022-11-12T05:00:00+02:00","value":-0.258},{"start":"2022-11-12T05:00:00+02:00","end":"2022-11-12T06:00:00+02:00","value":-0.258},{"start":"2022-11-12T06:00:00+02:00","end":"2022-11-12T07:00:00+02:00","value":-0.252},{"start":"2022-11-12T07:00:00+02:00","end":"2022-11-12T08:00:00+02:00","value":-0.138},{"start":"2022-11-12T08:00:00+02:00","end":"2022-11-12T09:00:00+02:00","value":-0.047},{"start":"2022-11-12T09:00:00+02:00","end":"2022-11-12T10:00:00+02:00","value":0},{"start":"2022-11-12T10:00:00+02:00","end":"2022-11-12T11:00:00+02:00","value":0.071},{"start":"2022-11-12T11:00:00+02:00","end":"2022-11-12T12:00:00+02:00","value":0.123},{"start":"2022-11-12T12:00:00+02:00","end":"2022-11-12T13:00:00+02:00","value":0.205},{"start":"2022-11-12T13:00:00+02:00","end":"2022-11-12T14:00:00+02:00","value":0.184},{"start":"2022-11-12T14:00:00+02:00","end":"2022-11-12T15:00:00+02:00","value":0.212},{"start":"2022-11-12T15:00:00+02:00","end":"2022-11-12T16:00:00+02:00","value":0.239},{"start":"2022-11-12T16:00:00+02:00","end":"2022-11-12T17:00:00+02:00","value":0.254},{"start":"2022-11-12T17:00:00+02:00","end":"2022-11-12T18:00:00+02:00","value":0.556},{"start":"2022-11-12T18:00:00+02:00","end":"2022-11-12T19:00:00+02:00","value":0.929},{"start":"2022-11-12T19:00:00+02:00","end":"2022-11-12T20:00:00+02:00","value":0.753},{"start":"2022-11-12T20:00:00+02:00","end":"2022-11-12T21:00:00+02:00","value":1.178},{"start":"2022-11-12T21:00:00+02:00","end":"2022-11-12T22:00:00+02:00","value":0.734},{"start":"2022-11-12T22:00:00+02:00","end":"2022-11-12T23:00:00+02:00","value":0.629},{"start":"2022-11-12T23:00:00+02:00","end":"2022-11-13T00:00:00+02:00","value":0.675}],"raw_tomorrow":[],"unit_of_measurement":"c/kWh","icon":"mdi:flash","friendly_name":"Nordpool_kwh"},"last_changed":"2022-11-12T06:00:00.035Z","last_updated":"2022-11-12T06:00:00.035Z","context":{"id":"01GHN6RSS3CZCJQW95FASPAAWQ","parent_id":null,"user_id":null},"timeSinceChangedMs":2120951}}
Here's the output from "Add Grid Tariff"
{"payload":{"priceData":[{"value":2.879,"start":"2022-11-12T00:00:00+02:00"},{"value":2.751,"start":"2022-11-12T01:00:00+02:00"},{"value":2.634,"start":"2022-11-12T02:00:00+02:00"},{"value":2.626,"start":"2022-11-12T03:00:00+02:00"},{"value":2.622,"start":"2022-11-12T04:00:00+02:00"},{"value":2.622,"start":"2022-11-12T05:00:00+02:00"},{"value":2.628,"start":"2022-11-12T06:00:00+02:00"},{"value":1.402,"start":"2022-11-12T07:00:00+02:00"},{"value":1.493,"start":"2022-11-12T08:00:00+02:00"},{"value":1.611,"start":"2022-11-12T10:00:00+02:00"},{"value":1.663,"start":"2022-11-12T11:00:00+02:00"},{"value":1.745,"start":"2022-11-12T12:00:00+02:00"},{"value":1.724,"start":"2022-11-12T13:00:00+02:00"},{"value":1.752,"start":"2022-11-12T14:00:00+02:00"},{"value":1.779,"start":"2022-11-12T15:00:00+02:00"},{"value":1.794,"start":"2022-11-12T16:00:00+02:00"},{"value":2.096,"start":"2022-11-12T17:00:00+02:00"},{"value":2.469,"start":"2022-11-12T18:00:00+02:00"},{"value":2.293,"start":"2022-11-12T19:00:00+02:00"},{"value":2.718,"start":"2022-11-12T20:00:00+02:00"},{"value":2.274,"start":"2022-11-12T21:00:00+02:00"},{"value":3.509,"start":"2022-11-12T22:00:00+02:00"},{"value":3.555,"start":"2022-11-12T23:00:00+02:00"}],"source":"Nordpool"},"_msgid":"c6d9d95daae38f1e"}
This is my Node-red object on port 3 for "Lowest Price" with prices (and objects from above) for 12 November...
{"payload":{"schedule":[{"time":"2022-11-11T00:00:00+02:00","value":false,"countHours":6},{"time":"2022-11-11T07:00:00+02:00","value":true,"countHours":2},{"time":"2022-11-11T09:00:00+02:00","value":false,"countHours":5},{"time":"2022-11-11T14:00:00+02:00","value":true,"countHours":1},{"time":"2022-11-11T15:00:00+02:00","value":false,"countHours":6},{"time":"2022-11-11T21:00:00+02:00","value":true,"countHours":1},{"time":"2022-11-11T22:00:00+02:00","value":false,"countHours":9},{"time":"2022-11-12T07:00:00+02:00","value":true,"countHours":4},{"time":"2022-11-12T12:00:00+02:00","value":false,"countHours":12}],"hours":[{"price":15.677,"onOff":false,"start":"2022-11-11T00:00:00+02:00","saving":null},{"price":2.998,"onOff":false,"start":"2022-11-11T01:00:00+02:00","saving":null},{"price":2.916,"onOff":false,"start":"2022-11-11T02:00:00+02:00","saving":null},{"price":2.873,"onOff":false,"start":"2022-11-11T04:00:00+02:00","saving":null},{"price":2.871,"onOff":false,"start":"2022-11-11T05:00:00+02:00","saving":null},{"price":2.881,"onOff":false,"start":"2022-11-11T06:00:00+02:00","saving":null},{"price":1.643,"onOff":true,"start":"2022-11-11T07:00:00+02:00","saving":null},{"price":1.789,"onOff":true,"start":"2022-11-11T08:00:00+02:00","saving":null},{"price":1.918,"onOff":false,"start":"2022-11-11T09:00:00+02:00","saving":null},{"price":1.913,"onOff":false,"start":"2022-11-11T10:00:00+02:00","saving":null},{"price":1.916,"onOff":false,"start":"2022-11-11T11:00:00+02:00","saving":null},{"price":1.914,"onOff":false,"start":"2022-11-11T12:00:00+02:00","saving":null},{"price":1.85,"onOff":false,"start":"2022-11-11T13:00:00+02:00","saving":null},{"price":1.804,"onOff":true,"start":"2022-11-11T14:00:00+02:00","saving":null},{"price":1.862,"onOff":false,"start":"2022-11-11T15:00:00+02:00","saving":null},{"price":2.806,"onOff":false,"start":"2022-11-11T16:00:00+02:00","saving":null},{"price":2.82,"onOff":false,"start":"2022-11-11T17:00:00+02:00","saving":null},{"price":2.327,"onOff":false,"start":"2022-11-11T18:00:00+02:00","saving":null},{"price":2.124,"onOff":false,"start":"2022-11-11T19:00:00+02:00","saving":null},{"price":1.833,"onOff":false,"start":"2022-11-11T20:00:00+02:00","saving":null},{"price":1.666,"onOff":true,"start":"2022-11-11T21:00:00+02:00","saving":null},{"price":2.993,"onOff":false,"start":"2022-11-11T22:00:00+02:00","saving":null},{"price":2.927,"onOff":false,"start":"2022-11-11T23:00:00+02:00","saving":null},{"price":2.879,"onOff":false,"start":"2022-11-12T00:00:00+02:00","saving":null},{"price":2.751,"onOff":false,"start":"2022-11-12T01:00:00+02:00","saving":null},{"price":2.634,"onOff":false,"start":"2022-11-12T02:00:00+02:00","saving":null},{"price":2.626,"onOff":false,"start":"2022-11-12T03:00:00+02:00","saving":null},{"price":2.622,"onOff":false,"start":"2022-11-12T04:00:00+02:00","saving":null},{"price":2.622,"onOff":false,"start":"2022-11-12T05:00:00+02:00","saving":null},{"price":2.628,"onOff":false,"start":"2022-11-12T06:00:00+02:00","saving":null},{"price":1.402,"onOff":true,"start":"2022-11-12T07:00:00+02:00","saving":null},{"price":1.493,"onOff":true,"start":"2022-11-12T08:00:00+02:00","saving":null},{"price":1.611,"onOff":true,"start":"2022-11-12T10:00:00+02:00","saving":null},{"price":1.663,"onOff":true,"start":"2022-11-12T11:00:00+02:00","saving":null},{"price":1.745,"onOff":false,"start":"2022-11-12T12:00:00+02:00","saving":null},{"price":1.724,"onOff":false,"start":"2022-11-12T13:00:00+02:00","saving":null},{"price":1.752,"onOff":false,"start":"2022-11-12T14:00:00+02:00","saving":null},{"price":1.779,"onOff":false,"start":"2022-11-12T15:00:00+02:00","saving":null},{"price":1.794,"onOff":false,"start":"2022-11-12T16:00:00+02:00","saving":null},{"price":2.096,"onOff":false,"start":"2022-11-12T17:00:00+02:00","saving":null},{"price":2.469,"onOff":false,"start":"2022-11-12T18:00:00+02:00","saving":null},{"price":2.293,"onOff":false,"start":"2022-11-12T19:00:00+02:00","saving":null},{"price":2.718,"onOff":false,"start":"2022-11-12T20:00:00+02:00","saving":null},{"price":2.274,"onOff":false,"start":"2022-11-12T21:00:00+02:00","saving":null},{"price":3.509,"onOff":false,"start":"2022-11-12T22:00:00+02:00","saving":null},{"price":3.555,"onOff":false,"start":"2022-11-12T23:00:00+02:00","saving":null}],"source":"Nordpool","config":{"fromTime":"00","toTime":"23","hoursOn":4,"maxPrice":null,"doNotSplit":false,"sendCurrentValueWhenRescheduling":true,"outputIfNoSchedule":false,"outputOutsidePeriod":false,"contextStorage":"memory"},"sentOnCommand":false,"time":"2022-11-12T08:26:50.525+02:00","version":"3.6.2","current":true},"_msgid":"f6732f98368ae504"}
Thanks for the input, and for tracking down the bug. There is also a similar bug in the price receiver node, not letting 0 prices through. These will both be fixed in version 4.0.0, coming out in the near future.
For negative prices, though, I don't think I have found anything wrong. If you think there is wrong handling of negative prices, please point out in what node the handling is wrong, and supply config, input and output for that node.
For negative prices, though, I don't think I have found anything wrong.
Correct... yeah.. 🤦♂️ Wrongly configured grid-price node. So SBS* fault, my bad.
Thanks for awesome nodes!
*Shit Behind the Sticks
Please try version 4.0.0. I think some of these issues should be fixed.
If this is ok now, using version 4, please close this issue.
Works fine! Thanks!
Occasionally prices are 0 or negative. The below code incorrectly rejects 0-price data.
https://github.com/ottopaulsen/node-red-contrib-power-saver/blob/006a11ca7898fbf9ffbda80b0c85a5e3f82e6b18/src/handle-input.js#L192
Suggest to replace with:
if (!h.start || isNaN(h.value)) {