jrfernandes / ontario_energy_board

Home Assistant component that installs a sensor with the current energy rate for Ontario energy companies
MIT License
44 stars 11 forks source link

Add support for ULO rates #34

Closed axyjo closed 10 months ago

axyjo commented 1 year ago

I don't think I see these in OEB's XML, but it'd be good to get a way to add ULO rates to Home Assistant.

eprochasson commented 12 months ago

Heya,

I wanted to give it a shot, but it looks like the Ontario Energy Board does not provide those rate in that XML document that is used to populate the values (or I failed to find them). The document is here: https://www.oeb.ca/open-data/current-electricity-rates-residential-rate-class

I contacted the OEB about this, let's see what happens,

eprochasson commented 12 months ago

Meanwhile, I made a quick template that seems to do the trick.

template:
  - sensor:
      - name: "Electricity Rate"
        unique_id: local_electricity_rate
        state: >
          {% if 7 < now().hour < 23 and is_state('binary_sensor.workday_sensor', 'off') %}0.074
          {% elif now().hour > 23 or now().hour < 7 %}0.024
          {% elif 7 < now().hour < 16 or 21 < now().hour < 23 %}0.102
          {% else %}0.24{% endif %}
        device_class: energy
        unit_of_measurement: 'CAD/kWh'
brilthor commented 11 months ago

@eprochasson thanks for posting that stopgap, it does look like you're missing a couple <= and >=, this is what I modified it to:

      {% if 7 <= now().hour < 23 and is_state('binary_sensor.workday_sensor', 'off') %}off_peak
      {% elif now().hour >= 23 or now().hour < 7 %}ulo
      {% elif 7 <= now().hour < 16 or 21 <= now().hour < 23 %}mid_peak
      {% else %}on_peak{% endif %}
eprochasson commented 11 months ago

Thanks!

By the way, the OEB responded that the rates will be made available on the open data files on November 1st.

axyjo commented 10 months ago

Unfortunately it still looks like OEB hasn't updated its open data files :(

eprochasson commented 10 months ago

I asked the OEB again, they said they updated it this morning, and it is indeed in the XML document now. They updated the data dictionary as well. They updated the rates, too. It's more expensive now :(

DiabuFR commented 10 months ago

Thanks @jrfernandes for merging #39 :)

jrfernandes commented 10 months ago

Thank you for your contribution! Closing this issue.

eprochasson commented 10 months ago

Working fine for me. Thanks a ton!

wBrhy2 commented 10 months ago

Sorry to revive this, but I didn't think it was different enough to open a new thread. How do I enable the use of the ULO rates in the addon? I have selected the R1 entity for my region which is fine, but when I use it in the energy dashboard it only uses the old rates.

DiabuFR commented 10 months ago

@wBrhy2 If you have the updated version (v0.3.6), you will see a new checkbox to enable ULO rates

Screenshot from 2023-11-17 21-32-46

wBrhy2 commented 10 months ago

[image: image.png]

On Fri, Nov 17, 2023 at 9:35 PM Diabu @.***> wrote:

If you have the updated version (v0.3.6), you will see a new checkbox to enable ULO rates

[image: Screenshot from 2023-11-17 21-32-46] https://user-images.githubusercontent.com/1985864/283967747-03cbff30-a8bd-43ce-bb27-dbfbb1a8a8a1.png

— Reply to this email directly, view it on GitHub https://github.com/jrfernandes/ontario_energy_board/issues/34#issuecomment-1817334824, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADDOZZESTMP6C7HNB4MOPLTYFANFTAVCNFSM6AAAAAA32MXDTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXGMZTIOBSGQ . You are receiving this because you commented.Message ID: @.***>

wBrhy2 commented 10 months ago

Where can I see the version? I'll try removing and reinstalling

On Fri, Nov 17, 2023 at 10:05 PM Julien Lemay @.***> wrote:

[image: image.png]

On Fri, Nov 17, 2023 at 9:35 PM Diabu @.***> wrote:

If you have the updated version (v0.3.6), you will see a new checkbox to enable ULO rates

[image: Screenshot from 2023-11-17 21-32-46] https://user-images.githubusercontent.com/1985864/283967747-03cbff30-a8bd-43ce-bb27-dbfbb1a8a8a1.png

— Reply to this email directly, view it on GitHub https://github.com/jrfernandes/ontario_energy_board/issues/34#issuecomment-1817334824, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADDOZZESTMP6C7HNB4MOPLTYFANFTAVCNFSM6AAAAAA32MXDTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXGMZTIOBSGQ . You are receiving this because you commented.Message ID: @.***>

wBrhy2 commented 10 months ago

ahhhhhhhhhhhhh I had forgotten this was in HACS so I wasn't getting my updates done.... There you go. I knew it had to be something I was overlooking. Thanks!

On Fri, Nov 17, 2023 at 10:07 PM Julien Lemay @.***> wrote:

Where can I see the version? I'll try removing and reinstalling

On Fri, Nov 17, 2023 at 10:05 PM Julien Lemay @.***> wrote:

[image: image.png]

On Fri, Nov 17, 2023 at 9:35 PM Diabu @.***> wrote:

If you have the updated version (v0.3.6), you will see a new checkbox to enable ULO rates

[image: Screenshot from 2023-11-17 21-32-46] https://user-images.githubusercontent.com/1985864/283967747-03cbff30-a8bd-43ce-bb27-dbfbb1a8a8a1.png

— Reply to this email directly, view it on GitHub https://github.com/jrfernandes/ontario_energy_board/issues/34#issuecomment-1817334824, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADDOZZESTMP6C7HNB4MOPLTYFANFTAVCNFSM6AAAAAA32MXDTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXGMZTIOBSGQ . You are receiving this because you commented.Message ID: @.***>