jrfernandes / ontario_energy_board

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

Could not find active peak #2

Closed drooff closed 2 years ago

drooff commented 2 years ago

I just installed this integration and it isn't able to retrieve the current peak information, suggesting maybe the webpage layout has changed. My utility was listed properly during the setup of the integration, but the sensor value is never populated.

Error log:

This error originated from a custom integration.

Logger: custom_components.ontario_energy_board.api
Source: custom_components/ontario_energy_board/api.py:101
Integration: Ontario Energy Board (documentation, issues)
First occurred: 12:41:50 PM (10 occurrences)
Last logged: 1:27:22 PM

Could not find active peak. Perhaps the webpage layout has changed

Thanks for building this, if it works it saves me a lot of time and effort doing it the hard way with utility meter and tariff components!

kwkid commented 2 years ago

droff: Your comment regarding the utility meter caught my eye. Based on my experience with this component it simply reports on the $ kWh rate charged during the appropriate timed tiers…the utility meter still plays a role and perhaps the integration component in calculating the daily and monthly $ consumption values. I guess you can have an automation trigger on the state of this component..if you capture the old and new values you can calculate your consumption based on the kWh change over the period…perhaps I am missing something in how this component was intended to be used…can you share your insight on how you intend to use this…

jrfernandes commented 2 years ago

Unfortunately, it appears that that the OEB site no longer includes a page indicating the current peak. That didn't last long :/

The rates are still being pulled successfully, as it's part of their Open Data initiative. As for getting the current rate, we will need a new method to get that. I might take a shot at it during the weekend.

jrfernandes commented 2 years ago

droff: Your comment regarding the utility meter caught my eye. Based on my experience with this component it simply reports on the $ kWh rate charged during the appropriate timed tiers…the utility meter still plays a role and perhaps the integration component in calculating the daily and monthly $ consumption values. I guess you can have an automation trigger on the state of this component..if you capture the old and new values you can calculate your consumption based on the kWh change over the period…perhaps I am missing something in how this component was intended to be used…can you share your insight on how you intend to use this…

@kwkid - the way I'm using this component is with the Home Assistant's Energy monitoring functionality, where you can assign this sensor with any energy monitoring attribute you add there. It works great and no need for any automation or tariff settings madness as before.

drooff commented 2 years ago

As for getting the current rate, we will need a new method to get that.

Looks like Alectra posts the current peak and rate on their site: https://alectrautilities.com/time-use-pricing

jrfernandes commented 2 years ago

The problem with that is that they're updating the value of that element via JS on the client-side. The HTML will always have mid-peak hard-coded.

maxistviews commented 2 years ago

@jrfernandes Might be best to hard-code the peaks in ourselves at this rate and maybe scrape the holiday chart linked below to know when its 100% offpeak. Or hard code in those holidays as well? https://www.oeb.ca/consumer-information-and-protection/electricity-rates/time-use-holiday-schedule

jrfernandes commented 2 years ago

@maxistviews - I thought about hard-coding it, the problem is that the on-peak and mid-peak periods switch during winter time. I didn't research if it's always the same time of the year or not, but it will definitely make things tricky, especially when odd events happen, like when in 2020 Ontario applied a 24-hour fixed rate.

I do however have an idea on how to get the current peak leveraging the site of one of the hydro companies. We should have this working again this weekend.

maxistviews commented 2 years ago

Great to hear it! Definitely looking forward to it :)

I think as a safety measure fallback, I will hard code a sensor myself and then use it only if this integration fails again ;) The OEB website makes it pretty clear that summer and winter time periods have consistent peaks, so I'll use that for my sensor.

Id be surprised if we'd get the 24 hour period again as that was just to do with the lockdown measures. But holidays that fall on weekends would need to be something to add to a hard coded sensor.

jrfernandes commented 2 years ago

I remember reading that when holidays that fall on weekends the following Monday will be off-peak. Should be confirmed.

Though, I do like the idea of having a fallback in case integration can't reach the EOB or other website. I might include something for that as well.

jprasm commented 2 years ago

Hi, I'm not able to get any data for Toronto Hydro (residential). My sensor says "unavailable": sensor.toronto_hydro_electric_system_limited_residential_rate

jrfernandes commented 2 years ago

This issue should now be solved and the sensor is working once again.

@maxistviews - I took your advise and just added logic to figure out the current peak without scrapping the web.

kwkid commented 2 years ago

Life is good...Thx for resolving the issue. Much appreciated

maxistviews commented 2 years ago

That's fantastic, thank you! :)