ottopaulsen / node-red-contrib-power-saver

A Node-RED node to saver money by turning off when the power is most expensive
Other
71 stars 17 forks source link

Error: Invalid context key #107

Closed Csstenersen closed 1 year ago

Csstenersen commented 1 year ago

i'm trying to send input from node-red-nordpool-api to powersaver. seem like it works fine into "Price Receiver" but fails with Error: Invalid context key in Best Save node. Please se attached json.txt with data from price receiver to best save node json.txt

what is wrong with the context?

ottopaulsen commented 1 year ago

There is obviously something wrong with the format of the data in your json file. The "start" values are numbers, but shall be strings. See Strategy input format for the correct format. Is your json output from Price Receiver? If so, please show me the data sent in to the Price Receiver.

Csstenersen commented 1 year ago

The format was a Date.parse result after i have tried to mess around with different time formats. I hoped the node tried to make a Date object from that result.

I have now tried with date string with same result.

Yes the output is from priceReceiver.

Input now looks like this: in_to_priceReceiver.txt

Output from price receiver:from_price_receiver.txt

Maby it happens because the date string is missing the timezone offset?

Csstenersen commented 1 year ago

got it to work when using .toISOString() on my time format. this flow is now a success: image

choel83 commented 1 year ago

I'm having the same error "Invalid context key". I can't figure out what the cause is. Date is in iso format, value is a number. Attached the output of Price Receiver.

Best regards, Joel Output PriceReciever.txt

ottopaulsen commented 1 year ago

@choel83 You have a slightly different date format then what is specified. I am not 100% sure that is the reason, but it may be. See https://powersaver.no/nodes/strategy-input.html for an example of the correct format.

choel83 commented 1 year ago

Thanks, missed that small difference. Changing it did the trick.