Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peak shaving: Update after set_peak_shaving #40

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions custom_components/senec/service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
""" Services for SENEC Device"""

from datetime import datetime
from homeassistant.util import slugify
from homeassistant.config_entries import ConfigEntry


class SenecService():
Expand All @@ -26,11 +28,8 @@ async def set_peakshaving(self, call):
new_peak_shaving = {"mode": mode, "capacity": capacity, "end_time": end_time}
await self._coordinator.senec.set_peak_shaving(new_peak_shaving)

# Force update
# registry = entity_registry.async_get(self._hass)
# peakshaving_mode_key = f"sensor.{slugify(ConfigEntry.title)}_peakshaving_mode".lower()
# entity = registry.async_get(peakshaving_mode_key)
# entity.async_schedule_update_ha_state(force_refresh=True)
# Force update of data
await self._coordinator.async_refresh()

return True
except ValueError:
Expand Down
Loading