Tariff not applying correctly

I have some issue that started all of a sudden where my day/night tariff is not being applied correctly, it incorrectly logs some kwh used as peak during offpeak time. Offpeak is 2-5am rest is peak.

This is what I have:

- id: '1702743963216'
  alias: Energy - Switch tariff
  description: Change to peak at 5am and change to offpeak at 2am
  trigger:
  - platform: time
    at: 04:59:00
    variables:
      tariff: peak
  - platform: time
    at: 02:01:00
    variables:
      tariff: offpeak
  condition: []
  action:
  - service: select.select_option
    target:
      entity_id:
      - select.daily_energy
      - select.monthly_energy
      - select.yearly_energy
    data:
      option: '{{ tariff }}'
  mode: single

And then it logs about 1kwh at the incorrect time (between 2-5am)


I tried changing it to 2:01-4:59 but it still did not affect the number, the state should be 0 basically, it grabbed the 0.9kwh incorrectly during offpeak time.

Any ideas?

Can you show the history of the energy sensor you are feeding to the utility meters for the same time period please?

Is it only the daily sensor that has this issue?

Or are the monthly and yearly sensors jumping by the same amount as well?

Yes looks like them too:



and they are updating via the automation the same:

Sorry forgot to attach it:

daily_energy:
  source: sensor.shellyem_5e26f6_channel_1_energy
  cycle: daily
  tariffs:
    - peak
    - offpeak




I think I have found the culprit, not any of the sensors, they are actually showing legit numbers.
The solar inverter is set to charge 2-5am however its clock is about 4 minutes out so it runs over the schedule by 4 mins (and is set to auto update already)
I reduced it to 4:55 and will see if it resolves, can probably delete this thread.

1 Like

It would be better to set the clock correctly in the inverter so that you get accurate energy readings between the actual times of your tariffs.

Does the inverter support NTP?

It may just need an NTP server defined correctly.

Just has time sync enable/disable and is already enabled, can’t find a way to set NTP

What make and model inverter?

16K-SG01LP1-EU deye
And setting it to stop at 4:55 fixed the day rate draw

Only until the clock drifts some more.

EDIT: a bit of searching reveals this is a common problem for Deye inverters, unfortunately without a solution.

You need to write to your distributor and get them to pressure the manufacturer to release a firmware update that exposes the NTP settings.

Yeah seems like it, but I think it has been a stable 4 minutes off since last year, I only “broke” it after I changed the schedule from 4:55 to 5:00 in the first place, guess I forgot why I set it to that in the first place :joy:

Why don’t you set the time correctly?

Or does it always jump back to being 4 minutes off?

Some searches I found said that the sync option had to be disabled or their time would incorrectly jump forward an hour. Like it had incorrect daylight savings dates programmed in.

I suppose I just didn’t trust it changing with DST when set manually, which is soon too

Yeah it won’t. You’d have to do it manually. Mind you I wouldn’t trust it do do it correctly with it enabled from what I’ve been reading :slight_smile: Good luck!