hif2k1 / battery_sim

Home assistant home battery simulator - allows you to model how much energy you would save with a home battery
106 stars 13 forks source link

Energy tariff sensor #19

Closed mistaoh closed 2 years ago

mistaoh commented 2 years ago

Hi, first of all, great work. This is really useful for me to check potential savings with batteries.

The component seems to work great on it's own but I cant get it to work with my price sensor and I don't understand the error.

I live in Sweden and I have so called spot price and the price is provided by another really good component. https://github.com/custom-components/nordpool

But when I try to add the energy_tariff like this:

battery_sim:
  energy_tariff: sensor.nordpool_kwh_se3_sek_3_095_025
  tesla_powerwall:
    name: Tesla Powerwall
...

I get the following error when I try to validate the config: Invalid config for [battery_sim]: expected a dictionary for dictionary value @ data['battery_sim']['energy_tariff']. Got 'sensor.nordpool_kwh_se3_sek_3_095_025'. (See /config/configuration.yaml, line 125).

Is it some compatibility issue or am I just doing it wrong?

purcell-lab commented 2 years ago

I have the tarrif working with my local energy provider, which is great as the pricing changes every 30 minutes.

# https://github.com/hif2k1/battery_sim
battery_sim:
  tesla_powerwall:
    name: Tesla Powerwall
    import_sensor: sensor.import_today_kwh
    export_sensor: sensor.export_today_kwh
    size_kwh: 13.5
    max_discharge_rate_kw: 5.0
    max_charge_rate_kw: 3.68
    efficiency: 0.9
    energy_tariff: sensor.amber_general_price

What state does your norpool sensor report?
Can you copy from developer tools?

JohanEikelenboom commented 2 years ago

Looks like you have it in the wrong place. It should be within the battery section, not within the Battery Sim section (move it to blow the tesla_powerwall: line and give 2 extra spaces in front of it.

battery_sim:
  tesla_powerwall:
    name: Tesla Powerwall
    energy_tariff: sensor.nordpool_kwh_se3_sek_3_095_025
...
mistaoh commented 2 years ago

Thanks, it works when I moved it to the tesla power wall section.