Gå til innhold
  • Bli medlem
kjetilsn

Home Assistant og Tibber, regne ut faktisk kostnad og besparelse

Anbefalte innlegg

Hei,

 

Etter å ha fått inn data fra AMS måler til Home Assistant, blitt tibber kunde, og fått AMS måler over på time for time hos BKK, var det dags for å prøve å spare strøm ved å flytte laster til tider på døgnet der strømmen er billig. Ønsket en måte å måle hvor mye besparelse  er dag for dag og per måned. Har nå laget følgende automasjon og sensorer i Home Assistant som bruker ekstern MQQT for mellomlagring av verdier. Har tatt utgangspunkt i eksempler  for akkumulering, feks  denne og denne

Bruker "hovedtelleverket" til AMS måleren som oppdateres hver time, dette passer fint overens med tibber sensoren som også oppdateres hver time. tibber sensoren til Home assistant gir deg max, min, og "current" KWt pris, men ikke gjennomsnitt per dag, jukset dette til med å ta gjennomsnitt av maks og min verdi, vet at dette ikke bli helt eksakt, da en kan ha reelt gjennomsnitt som ligger nært max eller min. Har kun kjørt dette et døgn nå, så vær obs på at det kan være feil her, og det finnes nok smartere måter å gjør dette på. Tilbakemeldinger/forslag til forbedring mottas med takk:

 

## Edit##

Endret fra sensor til automasjon som kjører en gang i time for differansekostnad, da det ble feilutslag hver time som vanlig sensor:

Automation:

#### Record AMS count last hour to MQQT ####

  - alias: 'Record AMS value last hour'
    trigger:
      platform: time
      minutes: 55
      seconds: 00
    action:
      service: mqtt.publish
      data_template:
        topic: 'ha/total_ams_last_hour'
        retain: true
        payload: '{"day_1":"{{states.sensor.ams_count.state}}"}' ## AMS total telleverk

#### Actual energy cost per hour ####

  - alias: 'Record acutal energy cost'
    trigger:
      platform: time
      minutes: 02
      seconds: 00
    action:
      service: mqtt.publish
      data_template:
        topic: 'ha/actual_ergy_cost'
        retain: true
        payload: '{"day_1":"{{ (((states.sensor.ams_count.state | float) - (states.sensor.ams_total_last_hour.state | float)) * ((states.sensor.electricity_price_"your adress".state | float) + ('Nettleie'))) | round(2) + (states.sensor.actual_energy_cost.state | round (2)) }}"}'
        
#### "Average" energy cost ####

  - alias: 'Record acutal energy cost'
    trigger:
      platform: time
      minutes: 02
      seconds: 00
    action:
      service: mqtt.publish
      data_template:
        topic: 'ha/average_ergy_cost'
        retain: true
        payload: '{"day_1":"{{ (((states.sensor.ams_count.state | float) - (states.sensor.ams_total_last_hour.state | float)) * ((((states.sensor.electricity_price_"your_adress".attributes.max_price | float) + (states.sensor.electricity_price_"your_adress".attributes.min_price | float)) / 2) + ('Nettleie'))) | round(2) + (states.sensor.average_energy_cost.state | round (2)) }}"}'       
        
#### Record Actual cost at midnight ####

  - alias: 'Record acutal cost at midnight'
    trigger:
      platform: time
      at: '00:00:01'
    action:
      service: mqtt.publish
      data_template:
        topic: 'ha/total_actual_energy_cost_midnight'
        retain: true
        payload: '{"day_1":"{{states.sensor.actual_energy_cost.state}}"}'

#### Record Average cost at midnight ####

  - alias: 'Record average cost at midnight'
    trigger:
      platform: time
      at: '00:00:01'
    action:
      service: mqtt.publish
      data_template:
        topic: 'ha/total_average_energy_cost_midnight'
        retain: true
        payload: '{"day_1":"{{states.sensor.average_energy_cost.state}}"}'
        
#### "Strømmbesparelse i dag ####
  - alias: 'Record diff avg actual energy cost'
    trigger:
      platform: time
      minutes: 05
      seconds: 00
    action:
      service: mqtt.publish
      data_template:
        topic: 'ha/energy_cost_saving_today'
        retain: true
        payload: '{"day_1":"{{ ((states.sensor.average_energy_cost_today.state | float) - (states.sensor.actual_energy_cost_today.state | float )) | round(2) }}"}'
        
Sensors:

############# MQTT AMS Last Hour ######################

  - platform: mqtt
    state_topic: 'ha/total_ams_last_hour'
    name: 'AMS total last hour'
    unit_of_measurement: 'KWt'
    value_template: '{{ value_json.day_1 }}' 
    
############# MQTT Actual energy cost ######################

  - platform: mqtt
    state_topic: 'ha/average_ergy_cost'
    name: 'Average energy cost'
    unit_of_measurement: 'NOK'
    value_template: '{{ value_json.day_1 }}' 

############ MQTT Actual energy cost ######################

  - platform: mqtt
    state_topic: 'ha/actual_ergy_cost'
    name: 'Actual energy cost'
    unit_of_measurement: 'NOK'
    value_template: '{{ value_json.day_1 }}' 

############ MQTT Actual energy cost midnight ##############

  - platform: mqtt
    state_topic: 'ha/total_actual_energy_cost_midnight'
    name: 'Actual energy cost midnight'
    unit_of_measurement: 'NOK'
    value_template: '{{ value_json.day_1 }}' 

############ MQTT Average energy cost midnight ##############

  - platform: mqtt
    state_topic: 'ha/total_average_energy_cost_midnight'
    name: 'Average energy cost midnight'
    unit_of_measurement: 'NOK'
    value_template: '{{ value_json.day_1 }}' 
    
    
############ MQTT Cost saving today ##############

  - platform: mqtt
    state_topic: 'ha/energy_cost_saving_today'
    name: 'Strømmbesparelse i dag'
    unit_of_measurement: 'NOK'
    value_template: '{{ value_json.day_1 }}' 

 

Endret av kjetilsn
Ending i logikk
  • Like 1

Del dette innlegget


Lenke til innlegg
Del på andre sider

Liker det du har laget i HA. 

 

Er selv litt i FOU for tiden men har funnet en fantastisk pallette til Node Red som fikser daglig oppdatering av spottpriser fra Nordpool. Dette gir meg full oversikt over dagens priser og kan med litt automasjon oppdatere hva du betaler for energibruken time for time. I tillegg ved å bruke en Min / Max sensor kan du få eksakt snittpris for dagen. En god erstatting for Tibber å den er i tillegg gratis.

 

 

 

HA Nordpool.PNG

Node red.PNG

Node red 2.PNG

Endret av Hassi
  • Like 1

Del dette innlegget


Lenke til innlegg
Del på andre sider
På 4.3.2019 den 6.44, Hassi skrev:

 

Er selv litt i FOU for tiden men har funnet en fantastisk pallette til Node Red som fikser daglig oppdatering av spottpriser fra Nordpool. Dette gir meg full oversikt over dagens priser og kan med litt automasjon oppdatere hva du betaler for energibruken time for time. I tillegg ved å bruke en Min / Max sensor kan du få eksakt snittpris for dagen. En god erstatting for Tibber å den er i tillegg gratis.

 

Kunne du tenke deg å dele denne Node Red Sekvensen?

Del dette innlegget


Lenke til innlegg
Del på andre sider

[{"id":"e2e4fe1d.7c595","type":"tab","label":"Nordpool-data","disabled":false,"info":""},{"id":"aeee093.bf433f8","type":"nordpool","z":"e2e4fe1d.7c595","baseUrl":"http://www.nordpoolspot.com/api","area":"Bergen","currency":"NOK","page":"10","start":"P1D","duration":"PT1H","name":"Nordpool","x":120,"y":440,"wires":[["83998c36.5f1e"]]},{"id":"83998c36.5f1e","type":"function","z":"e2e4fe1d.7c595","name":"","func":"var msg24 = msg.payload.map(function (p) {\n    return {payload: p};\n});\nreturn msg24;","outputs":24,"noerr":0,"x":370,"y":440,"wires":[["725c4f1d.8fd22"],["94fda574.976d48"],["41d0ac4a.b03bc4"],["3a190524.5a2bda"],["15dd54db.94427b"],["2d36f6dd.805bca"],["5a13129c.9b921c"],["1672f088.3bfe7f"],["f8199855.d51778"],["ea5de329.d15cb"],["34434fb0.6f35b"],["4fb8e53b.51fb5c"],["dd1b0791.e89778"],["1bcfdddc.502802"],["136ee9ac.613226"],["b721cf7f.4adce"],["1740d567.08029b"],["1ce40579.edba9b"],["876cc91a.08ccd8"],["abe06a61.25f758"],["271c8a17.f96176"],["5284e3bd.9e068c"],["c3dee96c.c99548"],["458b73aa.5cd84c"]]},{"id":"725c4f1d.8fd22","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris1","qos":"","retain":"true","broker":"c50624a.016f3d8","x":790,"y":120,"wires":[]},{"id":"94fda574.976d48","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris2","qos":"","retain":"true","broker":"c50624a.016f3d8","x":990,"y":120,"wires":[]},{"id":"41d0ac4a.b03bc4","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris3","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1190,"y":120,"wires":[]},{"id":"3a190524.5a2bda","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris4","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1390,"y":120,"wires":[]},{"id":"15dd54db.94427b","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris5","qos":"","retain":"true","broker":"c50624a.016f3d8","x":810,"y":240,"wires":[]},{"id":"2d36f6dd.805bca","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris6","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1010,"y":240,"wires":[]},{"id":"5a13129c.9b921c","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris7","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1210,"y":240,"wires":[]},{"id":"1672f088.3bfe7f","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris8","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1410,"y":240,"wires":[]},{"id":"f8199855.d51778","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris9","qos":"","retain":"true","broker":"c50624a.016f3d8","x":790,"y":320,"wires":[]},{"id":"ea5de329.d15cb","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris10","qos":"","retain":"true","broker":"c50624a.016f3d8","x":990,"y":320,"wires":[]},{"id":"34434fb0.6f35b","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris11","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1190,"y":320,"wires":[]},{"id":"4fb8e53b.51fb5c","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris12","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1390,"y":320,"wires":[]},{"id":"dd1b0791.e89778","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris13","qos":"","retain":"true","broker":"c50624a.016f3d8","x":830,"y":440,"wires":[]},{"id":"1bcfdddc.502802","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris14","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1030,"y":440,"wires":[]},{"id":"136ee9ac.613226","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris15","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1230,"y":440,"wires":[]},{"id":"b721cf7f.4adce","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris16","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1430,"y":440,"wires":[]},{"id":"1740d567.08029b","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris17","qos":"","retain":"true","broker":"c50624a.016f3d8","x":790,"y":520,"wires":[]},{"id":"1ce40579.edba9b","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris18","qos":"","retain":"true","broker":"c50624a.016f3d8","x":990,"y":520,"wires":[]},{"id":"876cc91a.08ccd8","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris19","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1190,"y":520,"wires":[]},{"id":"abe06a61.25f758","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris20","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1390,"y":520,"wires":[]},{"id":"271c8a17.f96176","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris21","qos":"","retain":"true","broker":"c50624a.016f3d8","x":710,"y":740,"wires":[]},{"id":"5284e3bd.9e068c","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris22","qos":"","retain":"true","broker":"c50624a.016f3d8","x":910,"y":740,"wires":[]},{"id":"c3dee96c.c99548","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris23","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1110,"y":740,"wires":[]},{"id":"458b73aa.5cd84c","type":"mqtt out","z":"e2e4fe1d.7c595","name":"","topic":"nordpool/timepris24","qos":"","retain":"true","broker":"c50624a.016f3d8","x":1310,"y":740,"wires":[]},{"id":"f64d1e2f.118ec","type":"inject","z":"e2e4fe1d.7c595","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"59 23 * * *","once":false,"onceDelay":0.1,"x":110,"y":180,"wires":[["aeee093.bf433f8"]]},{"id":"60846d89.6a04b4","type":"inject","z":"e2e4fe1d.7c595","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"x":110,"y":220,"wires":[["aeee093.bf433f8"]]},{"id":"58a64689.d146f8","type":"inject","z":"e2e4fe1d.7c595","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"01 00 * * *","once":false,"onceDelay":0.1,"x":110,"y":260,"wires":[["aeee093.bf433f8"]]},{"id":"c50624a.016f3d8","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

  • Thanks 1

Del dette innlegget


Lenke til innlegg
Del på andre sider

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå

×