-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/11-20
- Loading branch information
Showing
12 changed files
with
342 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 0 additions & 123 deletions
123
custom_components/peaqnext/service/nordpool/nordpool.py
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
custom_components/peaqnext/service/nordpool/nordpool_dto.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
NORDPOOL = "nordpool" | ||
ENERGIDATASERVICE = "energidataservice" | ||
ENERGIDATASERVICE_SENSOR = "sensor.energi_data_service" |
40 changes: 40 additions & 0 deletions
40
custom_components/peaqnext/service/spotprice/energidataservice.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from custom_components.peaqnext.service.spotprice.ispotprice import ISpotPrice | ||
from custom_components.peaqnext.service.spotprice.spotprice_dto import EnergiDataServiceDTO | ||
from custom_components.peaqnext.service.spotprice.const import ENERGIDATASERVICE, ENERGIDATASERVICE_SENSOR | ||
import asyncio | ||
import logging | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class EnergiDataServiceUpdater(ISpotPrice): | ||
def __init__(self, hub, test:bool = False): | ||
super().__init__(hub=hub, source=ENERGIDATASERVICE, test=test) | ||
|
||
async def async_set_dto(self, ret) -> None: | ||
_result = EnergiDataServiceDTO() | ||
await _result.set_model(ret) | ||
if await self.async_update_set_prices(_result): | ||
await self.hub.async_update_prices( | ||
(self.prices, self.prices_tomorrow) | ||
) | ||
self._is_initialized = True | ||
|
||
def setup(self): | ||
try: | ||
sensor = self.state_machine.states.get(ENERGIDATASERVICE_SENSOR) | ||
if not sensor.state: | ||
raise Exception("no entities found for Spotprice.") | ||
else: | ||
self._entity = ENERGIDATASERVICE_SENSOR | ||
_LOGGER.debug( | ||
f"EnergiDataService has been set up and is ready to be used with {self.entity}" | ||
) | ||
asyncio.run_coroutine_threadsafe( | ||
self.async_update_spotprice(), | ||
self.state_machine.loop, | ||
) | ||
except Exception as e: | ||
_LOGGER.error( | ||
f"I was unable to get a Spotprice-entity. Cannot continue.: {e}" | ||
) |
Oops, something went wrong.