sonnen-tools / node-red

Node Red Flows for use with Sonnenbatterie
GNU General Public License v3.0
9 stars 1 forks source link

Cheapest Hours not working as expected in SEK currency #5

Closed markusjnagel closed 10 months ago

markusjnagel commented 10 months ago

Daniel reported:

Did the way charging hours are calulated change in the last version? I wanted to force it to charge but i still says. No hours even though i set it crazy high to 350 🙂

7 Jan 16:45:56 - [warn] [function:getCheapestHours] averagePrice: 1.4628500000000002
7 Jan 16:45:56 - [warn] [function:getCheapestHours] maxPrice (factored):0.7314250000000001
7 Jan 16:45:56 - [warn] [function:getCheapestHours] userMaxPrice set to 350
7 Jan 16:45:56 - [warn] [function:getCheapestHours] maxPrice set to 0.7314250000000001
7 Jan 16:45:56 - [info] [function:getCheapestHours] CheapHours found:
7 Jan 16:45:56 - [info] [function:getCheapestHours] []
7 Jan 16:46:05 - [info] [function:shouldIBeCharging?] NO CHEAP HOURS FOUND
7 Jan 16:46:05 - [warn] [function:shouldIBeCharging?] In a cheap hour? false
7 Jan 16:46:05 - [warn] [function:shouldIBeCharging?] not within a cheap Hour
7 Jan 16:46:05 - [info] [function:shouldIBeCharging?] RED - no - don't charge
7 Jan 16:46:05 - [info] [function:amICharging?] Target SoC: 90
7 Jan 16:46:05 - [info] [function:amICharging?] Current SoC: 25
7 Jan 16:46:05 - [info] [function:amICharging?] OperatingMode: 1
7 Jan 16:46:05 - [info] [function:amICharging?] Global: isBatteryCharging:undefined
7 Jan 16:46:05 - [info] [function:amICharging?] Battery isn't charging, discharge control is true
7 Jan 16:46:05 - [warn] [function:calculateDischargeCost] avg: NaN
7 Jan 16:46:05 - [info] [function:calculateDischargeCost] Calculated Battery Average Cost from the last 24hours is NaN
7 Jan 16:46:05 - [warn] [function:shouldIDischarge?] SoC 25
7 Jan 16:46:05 - [info] [function:shouldIDischarge?] Current Price is 1.4664
7 Jan 16:46:05 - [info] [function:shouldIDischarge?] Battery Price incl conversion loss is NaN
7 Jan 16:46:05 - [info] [function:shouldIDischarge?] Loss factor: 1.5
7 Jan 16:46:05 - [info] [function:shouldIDischarge?] RED - discharging not allowed, Tibber is currently cheaper than what's in the battery
7 Jan 16:46:05 - [info] [function:shouldIDischarge?] Blocking battery discharge (OperatingMode 1, manual/API)
markusjnagel commented 10 months ago

@dlindh - could you please go to the global flow context and copy the tibber_today and tibber_tomorrow fields for me in here, so I can play around with them? No need to expand that thingy, just click on the little "copy values" and then a) either paste them in a text editor and attach them to a message here, or b) just paste them here.

sigh sorry for the inconvenience... but that would allow me to play around with your values and see where it fails. Thanks!

markusjnagel commented 10 months ago

oh waiiiiiiiiiiit. Hah, found it. Your loss factor is set to 1.5 (50% loss). I think it should be something more like 1.15 (15% loss) or below for testing. This way, looks for hours where it would be cheaper to charge than the average, factoring in the conversion loss

Could you re-run (I mean, change and redeploy) to a factor of 1.15 or even 1.0 (no loss at all - just for testing). Oh, and, I released a new version (v0.0.2/v0.0.2-WIP) with an optional different calculation method (which tries to "cut off the most expensive hours". Please see the release notes how that works.

dlindh commented 10 months ago

Its working fine now, charging and discharing :)