Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
10 changes: 7 additions & 3 deletions custom_components/hilo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
from pyhilo.device import HiloDevice
from pyhilo.event import Event
from pyhilo.util import from_utc_timestamp
import ruyaml as yaml
from ruyaml.scanner import ScannerError
import yaml
from yaml.scanner import ScannerError

from . import Hilo
from .const import (
Expand Down Expand Up @@ -761,7 +761,11 @@ async def _load_history(self) -> list:
async def _save_history(self, history: list):
async with aiofiles.open(self._history_state_yaml, mode="w") as yaml_file:
LOG.debug("Saving history state to yaml file")
await yaml_file.write(yaml.dump(history, Dumper=yaml.RoundTripDumper))
# TODO: Use asyncio.get_running_loop() and run_in_executor to write
# to the file in a non blocking manner. Currently, the file writes
# are properly async but the yaml dump is done synchroniously on the
# main event loop
await yaml_file.write(yaml.dump(history))


class HiloChallengeSensor(HiloEntity, SensorEntity):
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ colorlog==6.9.0
homeassistant~=2025.3.4
pip>=21.3.1
ruff==0.11.3
pyyaml>=6.0.2