dentra / esphome-components

ESPHome components
MIT License
145 stars 21 forks source link

Energy Tariffs Component #59

Open Roving-Ronin opened 1 month ago

Roving-Ronin commented 1 month ago

Hi @dentra,

Thanks for these components, using the Energy Statistic component with my Athom v2 and v3 plugs and it works quite well. When using webserver version = 3, with its ability to allow defining the sort order of sensors, it comes out as:

image

Just having a play and looking to see if the Energy Tariffs component would be useful, but trying to work out if it can support the tariff plans we have in Australia. Leaving out the new 'Peak Demand' tariffs being introduced to the market, we have the following 'Time of Use' TOU plans that are typically:

Monday - Friday: Peak - 7am to 9am Shoulder - 9am to 5pm Peak - 5pm to 8pm Shoulder - 8pm to 10pm Off Peak - 10pm to 7am

Saturday and Sundays: Off Peak - All Day/Night (i.e. from 10pm Friday to 7am Monday)

Is your Tariff component able to support these tariffs, or does the component currently only support defining the time but not allow specifying the day also ?

Many Thanks !

Roving-Ronin commented 1 month ago

Ooops... I should have checked closed issues first. Just noticed this old issue: https://github.com/dentra/esphome-components/issues/39

      - name: "P1"
        time: "06:00-14:00"
        days_of_week: &workdays MON-FRI
        exclude: &holidays [25.12, 26.12, 27.12]
      - name: "P2"
        time: "14:00-22:00"
        days_of_week: *workdays
        exclude: *holidays
      - name: "P3"

Is there a version of the component that has the days_of_week functionality added to it that I can test? Looking at the C+ code I can't find any reference to this in the 'Master' branch version.

Thanks.

dentra commented 1 month ago

39 it is not implemented, but only proposed. If it fits, then I'll try to implement it.

Roving-Ronin commented 1 month ago

Happy to test it, if you implement it ! ;-) BTW where are the 'workdays' / 'holidays' / 'weekends' defined, or is that pulled from HomeAssistant and the WorkDay integration?

PS. Is there any chance of getting 'Energy - Year' added to the Energy Statistic component ?

dentra commented 3 weeks ago

Is just setting unit_of_measurenent doesn't work?

Roving-Ronin commented 2 weeks ago

Update: Managed to get this working for water (L) and gas (m3), will have to see if I can get it working for gas (mj) in future, Not as simple as converting gas from cubic meters to MJ involves calculation of the variables 'Pressure Factor' and 'Heating Value' that are dependent upon the gas provider and change regularly (quarterly for my provider).

Formula: (Gas Consumed m3 x Pressure Factor x Heating Value) = MJ consumed

These are in: https://github.com/Roving-Ronin/myHomeAssistant/tree/main/components/ if you want to add into your repo.

BTW any luck looking at adding the days of week to Tariffs ( https://github.com/dentra/esphome-components/issues/39 ) ? Thanks !