Finne døgnets tre laveste pristimer

Jeg prøver å få til en flow som finner de tre timene i døgnet med lavest pris s.a. jeg kan sette varmtvannsverederen til å være påskrudd disse timene. Fra før har jeg en noe “brutish” måte å finne de to timene om natta med lavest gjennomsnitt, og har den på da, men i våre dager er plutselig prisen lav midt på dagen i helgene og på helligdager, så vil heller se på døgnet som helhet (naturligvis justere for noe lavere nettleie på natta).

Er det noen som har et eksempel å dele? Jeg klarer å lagre prisene fra Tibber i et array of floats, men skjønner ikke hvordan jeg kan lage en for-løkke som går gjennom og registrerer de x laveste timene.

5 Likes

@espen Er det mulig å hente ut prisene hver time det kommende døgnet fra den prisdataen vi bruker på huben for å lage energi flows?
Tenker da typisk via transform noden som brukes for å hente pris og averege pris?

Jeg har nå laget en helt idiotisk, 15000 kodelinjer lang, flow som faktisk får dette til, selv om den bruker over 3 sekunder på å kjøre. Men jeg vil mye heller ha en smidig løsning som tar det via en golang-kode-node - men skjønner ikke hvordan variablene brukes der, og er heller ikke bevandret i golang. So any input much appreciated.

(Hvis noen er interessert i den idiotiske koden, er det bare å si fra)

3 Likes

Så den klarer å hente ut hver time fra futurehome sin pris sak?
I så fall er jeg interessert :smiley:

Hei
Nei, jeg henter prisene fra Tibber-APIet, men det blir vel kanskje det samme, selv om det fordrer at du er Tibber-kunde…

AAh skjønner. Ja da hjelper det lite, da jeg ikke er tibber kunde :slight_smile:

Hei,

prøver akkurat det samme. Har klart å hente neste dagens strømpriser fra Tibber, og legge dem i en global float array. Nå gjenstår det et lite program som involverer litt sortering og tilgang til globale variabler fra et script. Dette blir nok en Golang node. Men er det noen som har et eksempel for en Golang node i en Thingsplex flow som faktisk fungerer, om som bruker globale array variabler?

2 Likes

Hi!

If i should set up a similar thing i think i would set it up to send the mqtt message to nodeRED to process it there, and then send it back to thingsplex (since im not familiar with golang myself :stuck_out_tongue: )
Are you guys familiar with nodeRED and have it running on a separate host?

Or maybe @Rafal could provide a example when he’s back from vacation?

1 Like

This is way over my competence level wrt. programming, but I just feel like expressing my need for a solution like this. And it should not be limited to Tibber clients only, Futurehome apparently has the data available. The simple spot price automations are also quite useless, as long as intraday price variations vary from ±7% to ±60% (last three weeks). It is just as useful/less as setting a fixed timer on the water heater. Not what I paid for.

1 Like

definitely. What happens if you set the WH to warm the water when price is 20 pst. below average, and the price don’t go below 10 pst. one day? Cold water?

Made some progress on this issue. Got a GO script code running outside the Futurehome hub that ranks the hours of the day by power price. The ranking is supposed to be stored in a global array variable in Futurehome, updated once per day. This would enable automations of the type “switch boiler on the 2 cheapest hours of the day”, “boost heat pump the 3rd and 4th cheapest hours of the day” etc.

The problem is that the GO script node of Futurehome Thingsplex doesn’t even run the example code that pops up in a new script node by default. This is probably due to a missing environment variable in the hub system. I opened a separate issue on this:
https://forum.futurehome.io/t/faulty-import-statements-in-golang/3347/2fu

2 Likes

Just received a reply by @futurehome that GO scripts might not be supported at all on the hub. That would be a serious show stopper for any advanced automations! :frowning:

Hei, er interessert i å se den “idiotiske” koden din :smile:

Hver ettermidddag blir FH hub’en oppdatert med spotpris for totalt 48 timer.
24 timer for inneværende døgn og de 24 timene i neste døgn. totalt 48 verdier.

Jeg per i dag dessverre ikke kunskap om å hente ut og filtrere disse verdiene.

Her er et eksempel på hva som sendes ut via MQTT:

Topic : pt:j1/mt:cmd/rt:cloud/rn:energy_guard/ad:energy_price
Service : energy_price
Interface : cmd.energy_price.get_schedule_report
Message :

{
  "serv": "energy_price",
  "type": "cmd.energy_price.get_schedule_report",
  "val_t": "object",
  "val": {
    "delivery_area": "NO5"
  },
  "props": null,
  "tags": null,
  "src": "energy_guard",
  "ver": "1",
  "uid": "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
  "topic": "pt:j1/mt:cmd/rt:cloud/rn:energy_guard/ad:energy_price"
}
1 Like

Her er et eksempel på hvordan svaret på foregående kommando/forspørsel ser ut:

Value er spotprisen for angitt time.

{
  "serv": "energy_price",
  "type": "evt.energy_price.schedule_report",
  "val_t": "object",
  "val": {
    "prices": [
      {
        "from": "2022-10-12T00:00:00+02:00",
        "to": "2022-10-12T01:00:00+02:00",
        "value": 155
      },
      {
        "from": "2022-10-12T01:00:00+02:00",
        "to": "2022-10-12T02:00:00+02:00",
        "value": 152
      },
      {
        "from": "2022-10-12T02:00:00+02:00",
        "to": "2022-10-12T03:00:00+02:00",
        "value": 152
      },
      {
        "from": "2022-10-12T03:00:00+02:00",
        "to": "2022-10-12T04:00:00+02:00",
        "value": 153
      },
      {
        "from": "2022-10-12T04:00:00+02:00",
        "to": "2022-10-12T05:00:00+02:00",
        "value": 154
      },
      {
        "from": "2022-10-12T05:00:00+02:00",
        "to": "2022-10-12T06:00:00+02:00",
        "value": 167
      },
      {
        "from": "2022-10-12T06:00:00+02:00",
        "to": "2022-10-12T07:00:00+02:00",
        "value": 188
      },
      {
        "from": "2022-10-12T07:00:00+02:00",
        "to": "2022-10-12T08:00:00+02:00",
        "value": 209
      },
      {
        "from": "2022-10-12T08:00:00+02:00",
        "to": "2022-10-12T09:00:00+02:00",
        "value": 213
      },
      {
        "from": "2022-10-12T09:00:00+02:00",
        "to": "2022-10-12T10:00:00+02:00",
        "value": 218
      },
      {
        "from": "2022-10-12T10:00:00+02:00",
        "to": "2022-10-12T11:00:00+02:00",
        "value": 233
      },
      {
        "from": "2022-10-12T11:00:00+02:00",
        "to": "2022-10-12T12:00:00+02:00",
        "value": 211
      },
      {
        "from": "2022-10-12T12:00:00+02:00",
        "to": "2022-10-12T13:00:00+02:00",
        "value": 201
      },
      {
        "from": "2022-10-12T13:00:00+02:00",
        "to": "2022-10-12T14:00:00+02:00",
        "value": 195
      },
      {
        "from": "2022-10-12T14:00:00+02:00",
        "to": "2022-10-12T15:00:00+02:00",
        "value": 192
      },
      {
        "from": "2022-10-12T15:00:00+02:00",
        "to": "2022-10-12T16:00:00+02:00",
        "value": 194
      },
      {
        "from": "2022-10-12T16:00:00+02:00",
        "to": "2022-10-12T17:00:00+02:00",
        "value": 193
      },
      {
        "from": "2022-10-12T17:00:00+02:00",
        "to": "2022-10-12T18:00:00+02:00",
        "value": 212
      },
      {
        "from": "2022-10-12T18:00:00+02:00",
        "to": "2022-10-12T19:00:00+02:00",
        "value": 213
      },
      {
        "from": "2022-10-12T19:00:00+02:00",
        "to": "2022-10-12T20:00:00+02:00",
        "value": 210
      },
      {
        "from": "2022-10-12T20:00:00+02:00",
        "to": "2022-10-12T21:00:00+02:00",
        "value": 191
      },
      {
        "from": "2022-10-12T21:00:00+02:00",
        "to": "2022-10-12T22:00:00+02:00",
        "value": 183
      },
      {
        "from": "2022-10-12T22:00:00+02:00",
        "to": "2022-10-12T23:00:00+02:00",
        "value": 172
      },
      {
        "from": "2022-10-12T23:00:00+02:00",
        "to": "2022-10-13T00:00:00+02:00",
        "value": 159
      },
      {
        "from": "2022-10-13T00:00:00+02:00",
        "to": "2022-10-13T01:00:00+02:00",
        "value": 179
      },
      {
        "from": "2022-10-13T01:00:00+02:00",
        "to": "2022-10-13T02:00:00+02:00",
        "value": 168
      },
      {
        "from": "2022-10-13T02:00:00+02:00",
        "to": "2022-10-13T03:00:00+02:00",
        "value": 169
      },
      {
        "from": "2022-10-13T03:00:00+02:00",
        "to": "2022-10-13T04:00:00+02:00",
        "value": 176
      },
      {
        "from": "2022-10-13T04:00:00+02:00",
        "to": "2022-10-13T05:00:00+02:00",
        "value": 177
      },
      {
        "from": "2022-10-13T05:00:00+02:00",
        "to": "2022-10-13T06:00:00+02:00",
        "value": 187
      },
      {
        "from": "2022-10-13T06:00:00+02:00",
        "to": "2022-10-13T07:00:00+02:00",
        "value": 216
      },
      {
        "from": "2022-10-13T07:00:00+02:00",
        "to": "2022-10-13T08:00:00+02:00",
        "value": 251
      },
      {
        "from": "2022-10-13T08:00:00+02:00",
        "to": "2022-10-13T09:00:00+02:00",
        "value": 269
      },
      {
        "from": "2022-10-13T09:00:00+02:00",
        "to": "2022-10-13T10:00:00+02:00",
        "value": 268
      },
      {
        "from": "2022-10-13T10:00:00+02:00",
        "to": "2022-10-13T11:00:00+02:00",
        "value": 266
      },
      {
        "from": "2022-10-13T11:00:00+02:00",
        "to": "2022-10-13T12:00:00+02:00",
        "value": 264
      },
      {
        "from": "2022-10-13T12:00:00+02:00",
        "to": "2022-10-13T13:00:00+02:00",
        "value": 260
      },
      {
        "from": "2022-10-13T13:00:00+02:00",
        "to": "2022-10-13T14:00:00+02:00",
        "value": 257
      },
      {
        "from": "2022-10-13T14:00:00+02:00",
        "to": "2022-10-13T15:00:00+02:00",
        "value": 245
      },
      {
        "from": "2022-10-13T15:00:00+02:00",
        "to": "2022-10-13T16:00:00+02:00",
        "value": 236
      },
      {
        "from": "2022-10-13T16:00:00+02:00",
        "to": "2022-10-13T17:00:00+02:00",
        "value": 234
      },
      {
        "from": "2022-10-13T17:00:00+02:00",
        "to": "2022-10-13T18:00:00+02:00",
        "value": 261
      },
      {
        "from": "2022-10-13T18:00:00+02:00",
        "to": "2022-10-13T19:00:00+02:00",
        "value": 270
      },
      {
        "from": "2022-10-13T19:00:00+02:00",
        "to": "2022-10-13T20:00:00+02:00",
        "value": 268
      },
      {
        "from": "2022-10-13T20:00:00+02:00",
        "to": "2022-10-13T21:00:00+02:00",
        "value": 263
      },
      {
        "from": "2022-10-13T21:00:00+02:00",
        "to": "2022-10-13T22:00:00+02:00",
        "value": 246
      },
      {
        "from": "2022-10-13T22:00:00+02:00",
        "to": "2022-10-13T23:00:00+02:00",
        "value": 220
      },
      {
        "from": "2022-10-13T23:00:00+02:00",
        "to": "2022-10-14T00:00:00+02:00",
        "value": 200
      }
    ],
    "delivery_area": "NO5",
    "currency": "NOK",
    "scale": 100,
    "energy_unit": "kWh",
    "next_update": "2022-10-13T16:48:00+02:00"
  },
  "props": null,
  "tags": null,
  "src": "-",
  "ver": "1",
  "uid": "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
}

Hei. er det mulig å få denne koden? sliter med å skjønne bruk av arrays eller eventuell annen måte syntaxmessig å få data ut av futurehome sin evt.energy_price.schedule_report

1 Like

Send meg epostadresse, så skal du få

Sendte på melding

Hei kunne du sendt denne til meg også?:grin: