Energy meter - If-Else

Dear team,

I am using a KNX energy meter/counter, who sends the kWh every minute (increasing) to HomeAssistant.

Since we have differend prices for night and day, I need to take the actual value, match it with day and time and then create a counter for:

energy day
energy night

Since I am no developer, can you maybe help me how to create a template or helper to achieve this?

Thanks a lot and warm regards.
Sebastian

Is there anyone, who can help me with this? :frowning:

I have an energy sensor named sensor.strom_verbrauch_haus and want to create the following:

if day = Monday, Tuesday, Wednesday, Thursday & Friday and time is between 6:00 - 22:00 then add value to sensor.strom_verbrauch_strom_ht - else add value to sensor.strom_verbrauch_nt

if day = Saturday and time = 9:00 - 22:00 then add value to sensor.strom_verbrauch_strom_ht - else add value to sensor.strom_verbrauch_nt - else add value to sensor.strom_verbrauch_nt

if day = Sunday then add value to sensor.strom_verbrauch_nt

Time sensor => sensor.time
Weekday sensor => sensor.weekday

Thanks a lot :slight_smile: