Energy panel time offset

Does anyone have any idea how I can offset the days by 12 hours in the energy panel?

So I want “May 12th” data to run from noon 12th to noon 13th?

This is for checkout-checkin reasons on a small campground. So far we had flat rate for everyone, but with modern RV’s it is getting ridiculous. Some come with a small “hippie VW van” and barely use any power, and others come in with oversized luxury RV’s (dig up the turf while manoeuvring) and they draw the max of 10Amps continuously from the very moment they plug in to the moment they depart. It would be unfair to up the flat rate for the tent and hippie-van users.

Anyway, back to the point: Energy from noon to noon.
I can sort of get this myself using custom stat graphs, but those do not do the long term storage like the Energy panel does. And I like use of the Energy panel anyway.

One solution I can think off is to set the system to Australia time. But that is a bit clunky for the other duties the home assistant has. (timed lights and switches)

It is of course not part of the current solution, but if I were to hack some of the internal sources, where should I start?

(PS: hippie-van for communicating purpose, not meant derogatory. We kinda like the cute couples trying to enjoy life on minimal resources. We like the friendly family sized RV campers too. But they are just not the same category energy wise).

1 Like

Have you considered setting up utility meters for each spot. See here:

This way you have a virtual meter for each camping spot and you can set an offset.

utility_meter:
  daily_energy:
    source: "sensor.total_kwh_spot_consumed"
    name: "Daily kWh Usage"
    cycle: daily
    offset: '12:00'

You could then set up an automation that would notify you of all the values at 11:59:00 for your records.

Thanks yes, I did try those out. It’s what I meant with “I can sort of get this myself using custom stat graphs” see example below.
However, it has some challenges:

  • I cannot browse back in time, nor look at finite periods in the past
    (even if I reconfigure the graph, it is always up to the present day)

  • For the displayed period, it shows not per day, but increasing values.
    (which would be perfect, if I could select arbitrary day ranges)

If I could somehow get a graph output on my utility that would let me view arbitrary periods in history, this would be perfect, but this is not possible.

Your suggestion to automate notifications with daily totals is valid, but then I’d need a system to store those, and yet again view or accumulate them.

Addendum: I guess it would be nice if for example the stat graph would at least position itself on the dates of the date picked, if one is on the same dashboard.

But alas, that too would be an enhancement request.

You are very hung up on graphs.

I take it check out time is midday, so you want to charge the user from midday yesterday until midday today.

If you have an ever increasing energy meter then all you need to do is subtract yesterday’s midday figure from today’s midday figure. You can get yesterday’s figure from your database. If you want to keep figures for longer periods, keep your database for longer.

EDIT: long term stats will keep hourly data forever unless you delete the database, and in a commercial context you will be keeping backups.

I am hooked into graphs yes.

A few reasons for that:

  • Actually, this year we are not planning to charge anything. Just collect data to see how severe the problem is. And maybe notice the occasional EV-car being charged (which they are asked not to do, but even that will likely be polite verbal reminder rather then a confrontational bill)

  • I say we a few time, but while I am the techie & nerdie brother-in-law, the actual owners are non-technical. They just want to be able to browse the system, and seen the data in handy chunks. Most likely they will only properly start browsing this autumn, when day-to-day hecktic stress of actual visitors is past.

  • This also means, while an option for me, doing lots of SQL and Excell this autumn is not desirable, because it would be me doing queries rather them them building insight.

PS: you would not mind voting for this enhancement would you: Link Date Picker and Stat Graph

If you use the daily with offset you can get daily energy usage. I use mine for solar monitoring.

You can see the daily resets at midnight but could be noon with the offset.

Here is what the is contained in the sensor:

@AllHailJ
Hmm, seems interesting, but I may need a little more help here.
I know where the set_state window is in the developer tool, but what is happening in the above screen.

Are you creating a new template entity “Daily Solar kWh Produced”, by simply setting a state for a previously unknown entity? And setting its cron pattern so it will be updated repeatedly from the source.

Or did you previously definit this in the yaml files?

Is the status “collecting” and “last_reset” something I need to assign, or will they autogenerate?

Thanks

Edit, OK, I figured it out, created yet another utility meter using cron instead of cycle and offset. But to be fair, I feel it keeps being the same. These items keep not being usable like the Energy panel is:

  • No ability to view arbitrair time periods in the past. (always up to now)
  • And if you display the device as extra device to monitor, it actually recalculates the delta’s, thus ignoring the offset, and shows normal 24 hour day value

Am really busy for the next day or so but will get back to you with all the details.

Sorry for the delay in answering but my HA Machine Died in memory and I had alot of corruption to deal with. I want to clarify things so we are at least at a common understanding of misunderstanding of what you wish to accomplish.

  1. You have an RV park and you monitor each of the electrical supply outlets with some device.
  2. The devices gives you Power Draw in W/kW
  3. Each device is discrete and only used for that space.
  4. You are using home assistant to obtain billing for that space and documentation is required.

Tools needed

Integration to compute power to energy
Utility meters that gives daily, monthly and yearly totals that reset at the end of the period on per space basis.

Does this meet the requirements

So on a per space basis you will need:

A sensor the performs the Riemann sum

sensor:
  - platform: integration
    source: sensor.power_to_space_n
    name: Energy to Space n
    round: 3
    unit_time: h

Then you will need 3 utility meters for each space

utility_meter:
  daily_energy_space_n:
    source: "sensor.energy_to_space_n"
    name: "Daily kWh Space N"
    cycle: daily
    offset: '12:00'

  monthly_energy_space_n:
    source: "sensor.energy_to_space_n"
    name: "Monthly kWh Space N"
    cycle: monthly
    offset: '12:00'

  yearly_energy_space_n:
    source: "sensor.energy_to_space_n"
    name: "Yearly kWh Space N"
    cycle: yearly
    offset: '12:00'

This all would go into your configuration.yaml. I would recommend that you use the include feature to keep control of the size as I imagine there isn’t just one or two spaces. the sensors will be the name: part of the utility meter and will be all lower case with _ for spaces.

I use the hacs Plotly Graph card for display of the data as an xy plot.

You can then write automation to inform you of the usage. If you have alot of spaces you will need a different database than sqlite.

No need to apologise for any delay. I am not really in a rush, and even if I were, well, that would be my problem, not yours. And thanks for your responses.

I will look at the Plotly Graph, that might be interesting. For the rest, some remarks:

  • We are not looking to bill or invoice, but to build insight. How big is the problem of current fixed fee, how unfair between big and small RV’s.

  • No Rieman integration! On long teleperiod you have a really bad precision, and on short teleperiod the precision is still not perfect, but you get a huge database. More importantly, it is not needed, because Tasmota already has nice kWh figures, which are chip derived so are not bothered by any teleperiod.

  • Utility meters are indeed what I have, but their readout is the problem. Hence this request, which is about the readout, not about how to collect the data. Native Energy panels ignore the 12 hour offset (or rather, I suspect they recalculate the “proper” day value), And Stat-panels do show the 12h offset, cannot go back in time.

But as stated, the data is there, in the utility meter, just need so visualize. So I will look at Ploty Graph.
But back to the original request: “if I were to hack some of the internal sources, where should I start?”

Also, anyone mind voting for this enhancement: Link Date Picker and Stat Graph - #2 by cybermaus

Can this be outside the system? You could do sql to retrieve the data from the database and use gnuplot or excel to analyze.

If you want to hack around then go to github and clone the project and modify as you see fit.

Also once the data from utility meters gets recorded it is maintained in the same format until the sensor is deleted. If you want different offset data you have to start over. That is my understanding from the forum.