Skip to content

Commit

Permalink
Limit check_tarif for when energy meters automation is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
valleedelisle committed Dec 23, 2021
1 parent 2df44c0 commit b6fd3fe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion custom_components/hilo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@

from .config_flow import STEP_OPTION_SCHEMA
from .const import (
CONF_GENERATE_ENERGY_METERS,
CONF_HIGH_PERIODS,
CONF_HQ_PLAN_NAME,
CONF_TARIFF,
DEFAULT_GENERATE_ENERGY_METERS,
DEFAULT_HQ_PLAN_NAME,
DEFAULT_SCAN_INTERVAL,
DOMAIN,
Expand Down Expand Up @@ -190,6 +192,9 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry, api: API) -> None:
1: self.subscribe_to_attributes,
}
self.hq_plan_name = entry.options.get(CONF_HQ_PLAN_NAME, DEFAULT_HQ_PLAN_NAME)
self.generate_energy_meters = entry.options.get(
CONF_GENERATE_ENERGY_METERS, DEFAULT_GENERATE_ENERGY_METERS
)

# This will get filled in by async_init:
self.coordinator: DataUpdateCoordinator | None = None
Expand Down Expand Up @@ -336,7 +341,8 @@ async def cancel_websocket_loop(self) -> None:
async def async_update(self) -> None:
"""Get updated data from SimpliSafe."""
await self.devices.update()
self.check_tarif()
if self.generate_energy_meters:
self.check_tarif()

def set_state(self, entity, state, new_attrs={}, keep_state=False, force=False):
params = f"entity={entity}, state={state}, new_attrs={new_attrs}, keep_state={keep_state}"
Expand Down

0 comments on commit b6fd3fe

Please sign in to comment.