mampfes / ha_epex_spot_sensor

Provides helper sensors for EPEX Spot integration.
MIT License
47 stars 4 forks source link

Feature Request: Support for two different tariffs (Feed-in tariff and purchase tariff) #8

Open ar-ml opened 5 months ago

ar-ml commented 5 months ago

Hi, so far your sensor add-on really works great!

Feature request: I think many people that use your integration will have a pv panel installation. For example I have a different feed-in tariff and purchase tariff and created two helpers for it:

(both in ct/kWh)

Now I tried to solve that with a helper that combines both tariffs, that changes if I currently have PV surplus electricity: sensor.my_gross_combined_price = {% if states('sensor.mySmartmeter_total_power_togrid') | float > 5 %} {{ states('sensor.my_gross_feed_in_tariff') }} {% else %} {{ states('sensor.my_gross_purchase_tariff') }} {% endif %}

So the value of the sensor.my_gross_combined_price helper switches from sensor.my_gross_purchase_tariff to sensor.my_gross_feed_in_tarif if I am currently feeding in more than 5 Watts into the grid.

This basically works but unfortunately I can not use my sensor.my_gross_combined_price as a Price Input Sensor for your ha_epex_spot_sensor. The reason is, I guess, that my combined price sensor only contains data about the present and no attributes for the future.

So I guess we need a different approach here. My proposal would be, that you add the following fields to the configuration of your EPEX Spot Binary Sensor:

grafik

Could you implement this? Or is there a more elegant way to achieve my goal? thank you very much!

mampfes commented 5 months ago

Interesting request. Let me check. But I think it is not that easy because you need to know upfront when to switch to the feed-in tariff. Could you share a link or description of the feed-in tariff from your energy supplier?

ar-ml commented 5 months ago

My gross Feed in Tarif is just EPEX Spot AT 1.2 (20 % VAT). My gross Purchase Tarif is (EPEX Spot AT + absolute surcharge of 1.2 ct /kWh) 1.2 (20% VAT).

You are right, it would be necessary to "predict" when to switch between tariffs. The underlying logic is simple: Whenever my PV installations produces more energy than I consume in my house, the feed in tariff is used. Whenever I consume more than I produce, the Purchase tarif is used. Of course an exact prediction is impossible, because you never know in advance what I will consume or produce. But I think it does not have to be very precise, a rough estimation would be enough. The goal is, to find the cheapest hours when to load my warm water boiler and start my washing machine...

For the prediction how much energy I will produce in a certain hour in the future, we could probably just use the following sensors provided by Forecast Solar : sensor.power_production_next_24hours (in Watt). or maybe better: sensor.energy_production_today (in kWh) and sensor.energy_production_tomorrow (in kWh)

For the prediction how much energy I will consume I would just simply add a field where the user can enter a value. For example I know that the base load of my house is about 150W (=0,15kWh each hour). I might just enter that value (or a bit more) and I think the results might be accurate enough.

What do you think, is this doable?

mampfes commented 4 months ago

A solution that includes solar forecast and (if available) SOC of a battery is on my wishlist. But this is a major enhancement and will take time.

ar-ml commented 4 months ago

@mampfes Thx for your reply! I just sent you a little donation via paypal to express my appreciation for your work. Please let me know once this feature is implemented. Also let me know if I can do something to speed up the process and help you. ;-) Cheers!