Git Product home page Git Product logo

ontario_energy_board's Introduction

Ontario Energy Board integration

hacs_badge Tests hacs validation hassfest validation OEB Coverage

This Home Assistant component installs a sensor with the current energy rate and active peak for Ontario, Canada based energy companies (Electricity and Natural Gas), using the Ontario Energy Board's official open data inventory. Find out more at https://www.oeb.ca/open-data

Electricity

Electricity Sensor Preview

Natural Gas

Natural Gas Sensor Preview

Installation

HACS

  1. Open integrations.
  2. Click "Explore + Download repositories"
  3. Search for "Ontario Energy Board" and install the found integration.

Manual

Clone or download the repo, and copy the "ontario_energy_board" folder in "custom_components" to the "custom_components" folder in home assistant.

Using the component

Once installed, use the UI to add the new component to your setup, or click on the button below:

AA

Attributes

The sensor will include extra attributes for most of the available data from your energy supplier, enabling you to replicate your hydro and or natural gas bill if needed. @Digital-Ark shared this great Google Sheets document containing the billing formula using the attributes extracted by this integration:

Attribute Sector OEB Key Unit Description
energy_company Electricity / Natural Gas Energy company name
energy_sector Electricity / Natural Gas Energy sector (electricity / natural_gas)
active_peak Electricity / Natural Gas Active Peak (No Peak - Natural Gas)
season Electricity / Natural Gas Current Season (winter or summer)
ulo_enabled Electricity ULO Rates status
ulo_overnight_rate Electricity CA$/kWh ULO Overnight Rate
ulo_off_peak_rate Electricity CA$/kWh ULO Weekend Off-peak Rate
ulo_mid_peak_rate Electricity CA$/kWh ULO Mid-peak Rate
ulo_on_peak_rate Electricity CA$/kWh ULO On-peak Rate
off_peak_rate Electricity CA$/kWh Off-peak Rate
mid_peak_rate Electricity CA$/kWh Mid-peak Rate
on_peak_rate Electricity CA$/kWh On-peak Rate
distributor_name Electricity Dist Distributor name
rate_class Electricity Class Rate class
rate_year Electricity YEAR Rate year
tier_threshold Electricity ET1 kWh Tier Threshold
lower_tier_price Electricity RPP1 CA$/kWh Tier lower price
higher_tier_price Electricity RPP2 CA$/kWh Tier higher price
monthly_fixed_charge Electricity SC CA$/kWh Service Charge (monthly fixed charge)
distribution_variable_charge Electricity DC CA$/kWh Distribution variable charge
global_adjustment_rate_rider Electricity GA_RR_NONRPP CA$/kWh Global adjustment rate rider
retail_transmission_network_rate Electricity Net CA$/kWh Retail transmission network rate
retail_transmission_connection_rate Electricity Conn CA$/kWh Retail transmission connection rate
wholesale_market_service_charge Electricity WMSR CA$/kWh Wholesale market service charge
rural_remote_rate_protection Electricity RRRp CA$/kWh Rural and Remote rate protection
standard_supply_service_charge Electricity SSS CA$ Standard supply service charge
loss_factor Electricity LF CA$/kWh Loss factor
harmonized_sales_tax Electricity / Natural Gas GST % Harmonized sales tax (HST)
time_of_use_off_peak_usage Electricity EOffP % Time-of-use off-peak usage (average across residential consumers)
time_of_use_mid_peak_usage Electricity EMidP % Time-of-use mid-peak usage (average across residential consumers)
time_of_use_on_peak_usage Electricity EOnP % Time-of-use on-peak usage (average across residential consumers)
time_of_use_off_peak_price Electricity RPPOffP CA$/kWh Time-of-use off-peak price
time_of_use_mid_peak_price Electricity RPPMidP CA$/kWh Time-of-use mid-peak price
time_of_use_on_peak_price Electricity RPPOnP CA$/kWh Time-of-use on-peak price
global_adjustment Electricity PBGA CA$/kWh Global adjustment
ontario_electricity_rebate Electricity Rebate % Ontario electricity rebate (% of subtotal)
other_fixed_charges Electricity OFC CA$/customer Other fixed charges
distribution_volumetric_charge Electricity VC CA$/kWh Distribution volumetric charge
other_volumetric_charge Electricity OC CA$/kWh Other volumetric charge
distribution_rate_protection Electricity DRP Boolean Distribution rate protection (0 - no / 1 - yes)
debt_retirement_charge Electricity DRC CA$/kWh Debt retirement charge
distribution_rate_protection_rate Electricity DRP_Rate CA$/customer Distribution rate protection rate
service_area Natural Gas SA Service area
rate_class Natural Gas RC Rate class
effective_date Natural Gas ED Effective Date
monthly_charge Natural Gas MC CA$/month Monthly charge
delivery_tier_1_start Natural Gas DT1Low Delivery tier 1 start
delivery_tier_1_end Natural Gas DT1High Delivery tier 1 end
delivery_tier_2_start Natural Gas DT2Low Delivery tier 2 start
delivery_tier_2_end Natural Gas DT2High Delivery tier 2 end
delivery_tier_3_start Natural Gas DT3Low Delivery tier 3 start
delivery_tier_3_end Natural Gas DT3High Delivery tier 3 end
delivery_tier_4_start Natural Gas DT4Low Delivery tier 4 start
delivery_tier_4_end Natural Gas DT4High Delivery tier 4 end
delivery_tier_5_start Natural Gas DT5Low Delivery tier 5 start
delivery_tier_5_end Natural Gas DT5High Delivery tier 5 end
delivery_charge_tier_1 Natural Gas DCT1 CA$/m³ Delivery charge tier 1
delivery_charge_tier_2 Natural Gas DCT2 CA$/m³ Delivery charge tier 2
delivery_charge_tier_3 Natural Gas DCT3 CA$/m³ Delivery charge tier 3
delivery_charge_tier_4 Natural Gas DCT4 CA$/m³ Delivery charge tier 4
delivery_charge_tier_5 Natural Gas DCT5 CA$/m³ Delivery charge tier 5
delivery_charge_price_adjustment Natural Gas DCPA CA$/m³ Delivery charge price adjustment
storage_charge Natural Gas SC CA$/m³ Storage charge
storage_charge_price_adjustment Natural Gas SCPA CA$/m³ Storage charge price adjustment
gas_supply_charge Natural Gas CM CA$/m³ Gas supply charge
gas_supply_charge_price_adjustment Natural Gas CMPA CA$/m³ Gas supply charge price adjustment
transportation_charge Natural Gas TC CA$/m³ Transportation charge
transportation_charge_price_adjustment Natural Gas TCPA CA$/m³ Transportation charge price sdjustment
federal_carbon_charge Natural Gas FedCC CA$/m³ Federal carbon charge
facility_carbon_charge Natural Gas FacCC CA$/m³ Facility carbon charge
january Natural Gas Jan ~ m³ January (average monthly usage)
february Natural Gas Feb ~ m³ February (average monthly usage)
march Natural Gas Mar ~ m³ March (average monthly usage)
april Natural Gas Apr ~ m³ April (average monthly usage)
may Natural Gas May ~ m³ May (average monthly usage)
june Natural Gas Jun ~ m³ June (average monthly usage)
july Natural Gas Jul ~ m³ July (average monthly usage)
august Natural Gas Aug ~ m³ August (average monthly usage)
september Natural Gas Sep ~ m³ September (average monthly usage)
october Natural Gas Oct ~ m³ October (average monthly usage)
november Natural Gas Nov ~ m³ November (average monthly usage)
december Natural Gas Dec ~ m³ December (average monthly usage)

ontario_energy_board's People

Contributors

diabufr avatar jrfernandes avatar knbedgm avatar maxistviews avatar n3rdp1um23 avatar rtorchia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ontario_energy_board's Issues

Invalid currency code : CA$/kWh

Sensor is reporting incorrect currency code as per Home Assistant.

RangeError: Invalid currency code : CA$/kWh

Code should be CAD/kWh

Thank you.

How do I add this to dashboard?

Sorry for incredible noob question, but I can't seem to find the entity for this once I've installed via HACS?

My assumption is that an entity is created when I install, but I'm not seeing anything related to Ontario energy when I scroll through my entities.

"Green Button"

OEB now has a programme called "Green Button" which lets customers or customer-authorized third-parties to "download" their usage data.

Data format is XML, and it appears to be almost real-time if using the "CMD method". Real-time would be awesome, but even historical data would be very useful to have and track in HA.

Has anyone looked at this? Would this be something that could be included in the OEB integration, or better made as it's own thing?

Some links:

https://www.oeb.ca/consumer-information-and-protection/green-button
https://www.greenbuttonalliance.org/
https://www.energyplus.ca/en/energy-conservation/green-button-data.aspx

Request: Hourly Ontario Energy Price

Hi, would it be possible to also be able to provide the Hourly Ontario Energy Price? I was thinking it would be interesting to see the difference in costs between that and what my distribution utility charges me.

No longer working

This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/ontario_energy_board/init.py:21
Integration: Ontario Energy Board (documentation, issues)
First occurred: May 6, 2023 at 9:48:22 PM (2 occurrences)
Last logged: 9:09:09 PM

Error setting up entry Toronto Hydro-Electric System Limited (RESIDENTIAL) for ontario_energy_board
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/ontario_energy_board/init.py", line 21, in async_setup_entry
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'

Offer both ULO and TOU rates as separate entities?

In the interest of doing some long-term retrospective analysis of our power bill, would it be possible for the integration to offer, as two different entities, both the ULO and not-ULO rates simultaneously? Having to pick just one is kind of a bummer.

Thanks!

ULO - Hydro Ottawa Limited (RESIDENTIAL) [Electricity] Rate sensor (under Ontario Energy Board v0.4.0) is not working anymore

After today's OEB update, I proceeded to delete the old Integration entity, rebooted HA, added the new one, rebooted again:
After all the above steps now I get the following error message:
"This entity is no longer being provided by the ontario_energy_board integration. If the entity is no longer in use, delete it in settings."
Screen Shot 2024-04-19 at 5 14 04 PM

I enabled debug logging, here are a few lines:
KeyError: 'ulo_on_peak'
2024-04-19 17:36:51.898 DEBUG (MainThread) [custom_components.ontario_energy_board.coordinator] Finished fetching ontario_energy_board data in 0.000 seconds (success: True)
2024-04-19 17:36:51.905 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.hydro_ottawa_limited_residential_electricity_rate fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in async_update_ha_state
await self.async_device_update()

thank you,
EPA

Error after upgrade to 2023.5.1

I just updated to 2023.5.1 and I'm getting the error below.

This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/ontario_energy_board/__init__.py:21
Integration: Ontario Energy Board (documentation, issues)
First occurred: 2:40:48 PM (1 occurrences)
Last logged: 2:40:48 PM

Error setting up entry Alectra Utilities Corporation for ontario_energy_board
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/ontario_energy_board/__init__.py", line 21, in async_setup_entry
    hass.config_entries.async_setup_platforms(entry, PLATFORMS)
AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'

Cannot install on HA 2023.10.5

On installing, the following message appears:

Error
This integration does not support configuration via the UI. If you followed this link from the Home Assistant website, make sure you run the latest version of Home Assistant.

There doesn't appear to be any further info in the logs accessible from the UI.

Consider adding OEB Natural Gas prices

Love this - it made using the energy dashboard much for useful. OEB also publishes gas prices and it would be handy to have cost values for those as well.

Sensor potentially not updating

Hey, Im not sure what I could be doing wrong here, but the sensor does not seem to be updating:

image

In this image we should have already been on peak, but it hasnt changed. I have deleted and re-installed the component, that was the last change you see in the graph. Since then it hasnt updated.

Any ideas would be appreciated. Thanks for your hard work!

Ontario Energy Board Integration not loading in 2023.5.0b0

This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/ontario_energy_board/init.py:21
Integration: Ontario Energy Board (documentation, issues)
First occurred: April 26, 2023 at 9:48:25 PM (3 occurrences)
Last logged: 12:01:41 AM

Error setting up entry Hydro Ottawa Limited (RESIDENTIAL) for ontario_energy_board
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/ontario_energy_board/init.py", line 21, in async_setup_entry
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'

Other costs

Hi, I have recently figured out the Toronto Hydro billing formula to the dollar.

This currently scrapes:

<RRROffP>
<RRRMidP>
<RRROnP>

If we could also scrape:

<SC>
<LF>
<Net>
<Conn>
<WMSR>
<RRRP>
<SSS>
<GST>
<Rebate> 

I can write out or send you a spreadsheet that matches against your hydro bill to the dollar every month.

Time of Use / Tiered

Hello,

And thanks for that integration! Is there an easy way to switch between time of use rates and tiered rates? The data is there, but I haven't figured out how to do it.

Thanks

Gas Supplier Rates not showing under 0.4.0

Updated to version 0.4.0 and it's working fine with electricity provider sensor.enova_power_corp_waterloo_north_rate_zone_residential_electricity_rate under Home Assistant Core 2024.4.3.

I configured the integration to use Gas Provider Enbridge Gas (All) [NaturalGas] which it accepted successfully and created a sensor sensor.enbridge_gas_all_natural_gas_rate for it... upon restarting and rebooting HA...when you go into Developer Tools -> States and look for sensor.enbridge_gas_all_natural_gas_rate i see under State unavailable and no attributes while the sensor.enova_power_corp_waterloo_north_rate_zone_residential_electricity_rate show current rate and attribute.... perhaps i'm missing something...

Screenshot Enbridge

async_setup_platforms depreciated in HA 2023.3

Noted a warning in my HA logs regarding depreciation of async_setup_platforms failing in HA release 2023.3 onward. Thought it should be brought to attention in case it hasn't been noted yet.

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77
First occurred: 2:37:09 PM (1 occurrences)
Last logged: 2:37:09 PM

Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for ontario_energy_board using this method at custom_components/ontario_energy_board/__init__.py, line 21: hass.config_entries.async_setup_platforms(entry, PLATFORMS)

"Error setting up entry..." after latest update.

During the latest setup OEB failed to load or reconfigure itself.

Any ideas on how to fix this? I was going to remove it then re-install but it looks like it's going to clobber my setup.

These were the only error messages:

2023-05-09 08:23:50.860 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration ontario_energy_board which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-05-09 08:24:04.011 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry GrandBridge Energy Inc.-Energy+ Rate Zone (RESIDENTIAL) for ontario_energy_board
File "/config/custom_components/ontario_energy_board/__init__.py", line 21, in async_setup_entry

Not surviving HASS restart.

  • Install, works great, right prices etc.
  • Restart results in error below
  • Sensor never does connect again.
  • Delete and reinstall, works great again.
2022-02-06 12:45:23 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry ENWIN Utilities Ltd. (RESIDENTIAL) for ontario_energy_board
Traceback (most recent call last):
  File "/config/custom_components/ontario_energy_board/api.py", line 67, in get_rates
    response = await self.websession.get(RATES_URL)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 535, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 542, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1154, in _create_direct_connection
    hosts = await asyncio.shield(host_resolved)
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 327, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/ontario_energy_board/__init__.py", line 31, in async_setup_entry
    await ontario_energy_board.get_rates()
  File "/config/custom_components/ontario_energy_board/api.py", line 67, in get_rates
    response = await self.websession.get(RATES_URL)
  File "/usr/local/lib/python3.9/site-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.9/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError

Failing with HA 2023.8

I use the HA container and I just updated from 2023.7 to 2023.8 and noticed that this integration is no longer working.

In 2023.8 I see that Python 3.10 has been removed; now HA uses Python 3.11

I see an error log No module named 'hijri_converter' and notice that this module has also been deprecated in favour of hijridate.

I'm not super familiar with python or I'd help out

Logger: homeassistant.setup
Source: deps/lib/python3.11/site-packages/holidays/utils.py:20
First occurred: 6:25:04 PM (1 occurrences)
Last logged: 6:25:04 PM

Setup failed for custom integration ontario_energy_board: Unable to import component: No module named 'hijri_converter'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 215, in _async_setup_component
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 813, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/ontario_energy_board/__init__.py", line 8, in <module>
    from .coordinator import OntarioEnergyBoardDataUpdateCoordinator
  File "/config/custom_components/ontario_energy_board/coordinator.py", line 8, in <module>
    import holidays
  File "/config/deps/lib/python3.11/site-packages/holidays/__init__.py", line 13, in <module>
    from holidays.countries import *
  File "/config/deps/lib/python3.11/site-packages/holidays/countries/__init__.py", line 18, in <module>
    from .azerbaijan import Azerbaijan, AZ, AZE
  File "/config/deps/lib/python3.11/site-packages/holidays/countries/azerbaijan.py", line 18, in <module>
    from holidays.utils import islamic_to_gre
  File "/config/deps/lib/python3.11/site-packages/holidays/utils.py", line 20, in <module>
    from hijri_converter import convert
ModuleNotFoundError: No module named 'hijri_converter'

Tiered Pricing

Would it be possible to add tiered pricing to this integration? In Winter months, the first 1000KWh are billed at 8.7cents/KWh and the rest at 10.3 cents/KWh. In summer the first 600KWh are billed at the lower rate. Hopefully other users could benefit from this. Cheers

Errors after upgrading to HASS 2024.4.4

Getting the error below for Alectra Utilities Corporation-PowerStream Rate Zone (RESIDENTIAL)

Traceback (most recent call last):
   File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
     self.data = await self._async_update_data()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/ha/.homeassistant/custom_components/ontario_energy_board/coordinator.py", line 57, in _async_update_data
     company_energy_sector_search.group(1).lower().replace(" ", "_")
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 AttributeError: 'NoneType' object has no attribute 'group'

Error adding this integration

I'm running the following:

  • Home Assistant 2023.8.2
  • Supervisor 2023.08.1
  • Operating System 10.4

The integration was working through HACs until today I noticed it failed to load. I tried removing the integration and re-add it and it keeps giving me an error "Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble".

Log Details (ERROR)
This error originated from a custom integration.
Logger: aiohttp.server
Source: custom_components/ontario_energy_board/config_flow.py:16
Integration: Ontario Energy Board (documentation, issues)
First occurred: 3:49:02 PM (3 occurrences)
Last logged: 4:51:34 PM

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1112, in create_connection
transport, protocol = await self._create_connection_transport(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1145, in _create_connection_transport
await waiter
File "/usr/local/lib/python3.11/asyncio/sslproto.py", line 575, in _on_handshake_complete
raise handshake_exc
File "/usr/local/lib/python3.11/asyncio/sslproto.py", line 557, in _do_handshake
self._sslobj.do_handshake()
File "/usr/local/lib/python3.11/ssl.py", line 979, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 149, in post
return await super().post(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
result = await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post
result = await self._flow_mgr.async_init(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 847, in async_init
flow, result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 875, in _async_init
result = await self._async_handle_step(flow, flow.init_step, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 392, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/ontario_energy_board/config_flow.py", line 39, in async_step_user
companies_list = await get_energy_companies()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/ontario_energy_board/config_flow.py", line 16, in get_energy_companies
async with session.get(RATES_URL) as response:
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in aenter
self._resp = await self._coro
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request
conn = await self._connector.connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect
proto = await self._create_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 982, in _wrap_create_connection
raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host www.oeb.ca:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)')]

Peak rates missing last digit

Thank you for your work on this.
I noticed that the prices on the attributes are missing last digit. off peak should be "0.082", for instance.

image

Active Peak

Thanks for this plugin -- it's very much needed and appreciated!

It appears that the Active Peak is no longer working. I saw in a previous issue that this was mentioned also.

Is there some way to get this working again? It would be great to know which rate is currently active so that it could easily be used in automations or to trigger events.

Add a "Season" Attribute

OEB changes their rate based on the time of year, which I believe is already hard coded into this integration. I would find it useful if the season was surfaced in the attributes section for the sake of having one sensor for my automations. This is purely self-serving, but perhaps others would find this useful as an attribute.

image

Unable to import component: No module named 'hijri_converter'

Since 2023.8.0, I get this error upon startup of HA. The integration does not function.

OS: Linux
Installation type: Container using ghcr.io/home-assistant/home-assistant:stable image
HA version: 2023.8.2

Setup failed for custom integration ontario_energy_board: Unable to import component: No module named 'hijri_converter'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 215, in _async_setup_component
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 813, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/ontario_energy_board/__init__.py", line 8, in <module>
    from .coordinator import OntarioEnergyBoardDataUpdateCoordinator
  File "/config/custom_components/ontario_energy_board/coordinator.py", line 8, in <module>
    import holidays
  File "/config/deps/lib/python3.11/site-packages/holidays/__init__.py", line 13, in <module>
    from holidays.countries import *
  File "/config/deps/lib/python3.11/site-packages/holidays/countries/__init__.py", line 18, in <module>
    from .azerbaijan import Azerbaijan, AZ, AZE
  File "/config/deps/lib/python3.11/site-packages/holidays/countries/azerbaijan.py", line 18, in <module>
    from holidays.utils import islamic_to_gre
  File "/config/deps/lib/python3.11/site-packages/holidays/utils.py", line 20, in <module>
    from hijri_converter import convert
ModuleNotFoundError: No module named 'hijri_converter'

Add support for ULO rates

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.

Stopped working with errors...

Yo.

OEB integration stopped working yesterday. In the logs I see these errors:

Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for ontario_energy_board using this method at custom_components/ontario_energy_board/__init__.py, line 21: hass.config_entries.async_setup_platforms(entry, PLATFORMS)
9:05:32 AM – (WARNING) helpers/frame.py
Could not find energy rates for Energy Plus Inc. (RESIDENTIAL)
9:05:32 AM – (ERROR) Ontario Energy Board (custom integration)

Details:

This error originated from a custom integration.

Logger: custom_components.ontario_energy_board.coordinator
Source: custom_components/ontario_energy_board/coordinator.py:108
Integration: Ontario Energy Board (documentation, issues)
First occurred: 9:05:32 AM (1 occurrences)
Last logged: 9:05:32 AM

Could not find energy rates for Energy Plus Inc. (RESIDENTIAL)

Nothing was being done when it stopped working and I assumed it was just a connection error until I saw the second error about async. Might not be related though?

Rebooting, restarting, updating did nothing.

Could not find active peak

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!

Rates missing

I don't see Hydro One's Commercial rates? The TOU rates are the same, but delivery charges are different.
I think its called General Delivery, or close to it.
I am using The Hydro One R2 rate for now to see how it works, but the cost value is not a multiple of the current weekend price ( .074/kwh). Is it adding the other fees in the delivery charges as well ?
Update....I believe I am looking for "GENERAL SERVICE ENERGY BILLED" that is under the "General Service < 50 kW Rate Class".
Can I simply take my R2 rate class that I am using and edit the values, or will it just roll back the original values as a function of the inregration updating itself?

Ontario Energy Board was working fine yesterday....

Installed from HACS yesterday, added via the UI and configure with my local Electrical Distributor...Rates came in and things were looking promising...

Today no so good...The sensor's state for the electrical distributor shows unavailable whereas yesterday it was the $ rate and was working thru the on peak, mid peak and off peak tiers....

here's the error i am getting..

**** start *******
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 530, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 563, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 536, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 371, in state
value = self.native_value
File "/config/custom_components/ontario_energy_board/sensor.py", line 35, in native_value
return self.coordinator.ontario_energy_board.active_peak_rate
File "/config/custom_components/ontario_energy_board/api.py", line 113, in active_peak_rate
return getattr(self, f"{self.active_peak}_rate")
AttributeError: 'OntarioEnergyBoard' object has no attribute 'None_rate'
2022-02-08 12:51:18 ERROR (MainThread) [custom_components.ontario_energy_board.api] Could not find active peak. Perhaps the webpage layout has changed
2022-02-08 12:51:18 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
****** end *********

I tried uninstalling, rebooting and the re-installing rebooting to no avail...just installed

version: core-2022.2.3
installation_type: Home Assistant OS
host_os: Home Assistant OS 7.2
supervisor_version: supervisor-2022.01.1

Integrate with Energy / Utility Meter

I've been trying to integrate this with the Utility Meter and Energy functions in HA so that they can apply the proper TOU rate to objects that are being monitored for energy usage.

How can the rates from Ontario Energy Board be used as the TOU rates within HA so they can be used by Utility Meter and the Energy page?

I've gone through tonnes of posts about setting this up, but there's nothing specific for Ontario Energy Board and it's not working for me so there's something I'm not understanding or missing.

Has anyone set this up this way, and how did you do it?

Enbridge Gas Rate Selection Leads to update failure

Freshly created Enbridge pricing entry as the second entry to a Toronto Hydro entry generates the following error logs:

Listing pasted as image because HA doesn't allow copying of log seach page:
image

Details pasted here:

UPDATE FAILED LOG ENTRY
Logger: homeassistant.helpers.entity
Source: helpers/entity.py:951
First occurred: 25 April 2024 at 12:01:01 (2560 occurrences)
Last logged: 09:48:57

Update for sensor.enbridge_gas_all_natural_gas_rate fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 668, in state
numerical_value = float(value) # type:ignore[arg-type]
^^^^^^^^^^^^
ValueError: could not convert string to float: 'no_peak'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update
await self.async_update()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 532, in async_update
await self.coordinator.async_request_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in async_request_refresh
await self._debounced_refresh.async_call()
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in async_call
await task
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 291, in async_refresh
await self._async_refresh(log_failures=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 416, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 494, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 670, in state
raise ValueError(
ValueError: Sensor sensor.enbridge_gas_all_natural_gas_rate has device class 'monetary', state class 'None' unit 'CA ¢/m³' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'no_peak' (<class 'str'>)

ERROR UNLOADING ENTRY
Logger: homeassistant.config_entries
Source: config_entries.py:724
First occurred: 25 April 2024 at 20:43:38 (2 occurrences)
Last logged: 25 April 2024 at 20:44:04

Error unloading entry Enbridge Gas (All) [Natural Gas] for ontario_energy_board
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 724, in async_unload
result = await component.async_unload_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/ontario_energy_board/init.py", line 33, in async_unload_entry
unload_ok = await hass.config_entries.async_forward_entry_unload(entry, PLATFORMS)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1930, in async_forward_entry_unload
if domain not in self.hass.config.components:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: 'list'

ERROR ADDING LOG ENTRY
Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:580
integration: Sensor (documentation, issues)
First occurred: 25 April 2024 at 12:00:31 (2 occurrences)
Last logged: 25 April 2024 at 20:43:49

Error adding entity sensor.enbridge_gas_all_natural_gas_rate for domain sensor with platform ontario_energy_board
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 668, in state
numerical_value = float(value) # type:ignore[arg-type]
^^^^^^^^^^^^
ValueError: could not convert string to float: 'no_peak'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 580, in _async_add_entities
await coro
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 890, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1334, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 670, in state
raise ValueError(
ValueError: Sensor sensor.enbridge_gas_all_natural_gas_rate has device class 'monetary', state class 'None' unit 'CA ¢/m³' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'no_peak' (<class 'str'>)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.