Hey all
I got this fairly simple flow that takes in an array of todays energi prices and returns the minimum and maximum value, this is all well and good but i need to know when the prices are high and low, can anyone help me get the index number out with the value ?
bonus question!
It doesn't help me a lot to wake up in the morning and see the the cheepest time to starte the washer was 3 hours ago, is there any way to compare the index number to the hour of the day and only look through index numbers equal to og higher ?
Thanks
ps. this is my first question here, if i f-ed up the format pls let me know.
[{"id":"6c44665eec3e570d","type":"api-current-state","z":"ec94b9448b1541aa","name":"Pris","server":"59eab6e.e46dc48","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.energi_data_service","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":310,"y":320,"wires":[["6d55f8d530d339fc","b5c298755ab028c0"]]},{"id":"239d9afbf19b5ccb","type":"debug","z":"ec94b9448b1541aa","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":600,"y":300,"wires":[]},{"id":"6d55f8d530d339fc","type":"function","z":"ec94b9448b1541aa","name":"Max","func":"{const array1 = msg.data.attributes.today\n\n msg.payload = (Math.round(Math.max(...array1)) / 100) + \" Kr/kWh\"\n\nreturn msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":300,"wires":[["239d9afbf19b5ccb"]]},{"id":"e79df40960824a3f","type":"debug","z":"ec94b9448b1541aa","name":"debug 11","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":610,"y":340,"wires":[]},{"id":"b5c298755ab028c0","type":"function","z":"ec94b9448b1541aa","name":"Min","func":"{const array1 = msg.data.attributes.today\n\nmsg.payload = (Math.round(Math.min(...array1))/100) + \" Kr/kWh\"\n\nreturn msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":340,"wires":[["e79df40960824a3f"]]},{"id":"2628bf3e25567747","type":"inject","z":"ec94b9448b1541aa","name":"","props":[{"p":"time","v":"15","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":320,"wires":[["6c44665eec3e570d"]]},{"id":"59eab6e.e46dc48","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]