Skip to content

Commit

Permalink
update datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
kwang1012 committed May 17, 2024
1 parent 067d69a commit 4b463d8
Show file tree
Hide file tree
Showing 7 changed files with 294 additions and 43 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,5 @@ tmp_cache

# results
testrun*/
results/
results/
experiment_scripts/config-*
203 changes: 203 additions & 0 deletions homeassistant/components/rasc/datasets/arrival.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
0
0.1
0.009999999999999995
0.009999999999999995
0.010000000000000009
0.010000000000000009
0.009999999999999981
0.010000000000000009
0.010000000000000009
0.009999999999999981
0.010000000000000009
0.010000000000000009
1.3800000000000001
0.010000000000000009
0.4099999999999999
0.009999999999999787
0.010000000000000231
0.020000000000000018
0.009999999999999787
0.010000000000000231
0.009999999999999787
0.010000000000000231
0.2799999999999998
0.020000000000000018
0.010000000000000231
0.020000000000000018
0.009999999999999787
0.010000000000000231
0.009999999999999787
0.010000000000000231
0.5699999999999998
0.009999999999999787
0.010000000000000231
0.009999999999999787
0.010000000000000231
0.009999999999999787
0.010000000000000231
0.009999999999999787
0.010000000000000231
0.009999999999999787
0.010000000000000231
1.33
0.009999999999999787
0.009999999999999787
0.8700000000000001
0.009999999999999787
0.010000000000000675
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.010000000000000675
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.010000000000000675
1.0699999999999994
0.009999999999999787
0.010000000000000675
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.010000000000000675
0.009999999999999787
0.009999999999999787
0.41000000000000014
0.009999999999999787
0.1299999999999999
0.020000000000000462
0.08000000000000007
1.1799999999999997
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.010000000000001563
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.9700000000000006
0.009999999999999787
0.019999999999999574
0.05000000000000071
0.009999999999999787
0.009999999999999787
0.7200000000000006
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.010000000000001563
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.9100000000000001
1.0099999999999998
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.010000000000001563
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
1.120000000000001
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.4399999999999995
0.009999999999999787
0.010000000000001563
0.06999999999999851
0.010000000000001563
0.019999999999999574
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.030000000000001137
1.2299999999999986
0.010000000000001563
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.009999999999999787
0.010000000000001563
0.8999999999999986
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.7899999999999991
0.019999999999999574
0.010000000000001563
0.00999999999999801
0.019999999999999574
0.010000000000001563
0.010000000000001563
0.00999999999999801
0.879999999999999
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.00999999999999801
0.010000000000001563
1.1000000000000014
0.00999999999999801
0.010000000000001563
0.019999999999999574
0.00999999999999801
0.010000000000001563
0.019999999999999574
0.41000000000000014
0.48999999999999844
0.010000000000001563
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.00999999999999801
0.019999999999999574
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.5
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.010000000000001563
0.00999999999999801
0.010000000000001563
0.8099999999999987
0.019999999999999574
0.019999999999999574
0.019999999999999574
0.010000000000001563
0.030000000000001137
1.4399999999999977
0.03999999999999915
26 changes: 13 additions & 13 deletions homeassistant/components/rasc/datasets/arrival_afternoon.csv
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
3,1706641906108,Turn on Service
7,712ec364f7bd4290ad579e0bb5e3b52e,Switch lights on at sunset
7,8fc3a937a5804719a4200bb80c1ff620,FF Corridor Light Control
8,1715667183338,Whole House Fan Control
9,1715667183342,Let There Be Dark
10,1715667183344,Door Open State to Color Light
12,1715667183345,Enhanced Auto UnLock Door
12,1715667183346,Brighten Dark Places
13,1715667183353,Car Door Opened
14,1715721247625,Close and lock all door
15,8fc3a937a5804719a4200bb80c1ff621,CR Bed Light Control
15,a2eb5a03211e48b98c4f49f002b6833d,Whole House Fan
20,1715667183343,Let There Be Light
0,1706641906108,Turn on Service
0.1,712ec364f7bd4290ad579e0bb5e3b52e,Switch lights on at sunset
0.009999999999999995,8fc3a937a5804719a4200bb80c1ff620,FF Corridor Light Control
0.009999999999999995,1715667183338,Whole House Fan Control
0.010000000000000009,1715667183342,Let There Be Dark
0.010000000000000009,1715667183344,Door Open State to Color Light
0.009999999999999981,1715667183345,Enhanced Auto UnLock Door
0.010000000000000009,1715667183346,Brighten Dark Places
0.010000000000000009,1715667183353,Car Door Opened
0.009999999999999981,1715721247625,Close and lock all door
0.010000000000000009,8fc3a937a5804719a4200bb80c1ff621,CR Bed Light Control
0.010000000000000009,a2eb5a03211e48b98c4f49f002b6833d,Whole House Fan
1.3800000000000001,1715667183343,Let There Be Light
49 changes: 49 additions & 0 deletions homeassistant/components/rasc/datasets/arrival_all.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
0,653ae47ad5964ee2ad013d45168e4e6b,Switch lights off at sunrise
0.1,8fc3a937a5804719a4200bb80c1ff619,Switch on xmas tree
0.009999999999999995,bc1ac4bf0b54451882ca0b7033b7cfab,MorningAction
0.009999999999999995,1715677183344,Door Opening State to Color Light
0.010000000000000009,1715697183344,Door Closing State to Color Light
0.010000000000000009,1715667183349,Lock It When I Leave
0.009999999999999981,1715667183351,Car Departs
0.010000000000000009,1715687183344,Door Closed State to Color Light
0.010000000000000009,1715667183355,Lock it at a specific time
0.009999999999999981,1715797722148,Open garage door with S/C children
0.010000000000000009,8fc3a937a5804719a4200bb80c1ff621,CR Bed Light Control
0.010000000000000009,a2eb5a03211e48b98c4f49f002b6833d,Whole House Fan
1.3800000000000001,1715667183344,Door Open State to Color Light
0.010000000000000009,1715707183344,Door Jammed State to Color Light
0.4099999999999999,1706641906108,Turn on Service
0.009999999999999787,712ec364f7bd4290ad579e0bb5e3b52e,Switch lights on at sunset
0.010000000000000231,8fc3a937a5804719a4200bb80c1ff620,FF Corridor Light Control
0.020000000000000018,1715667183338,Whole House Fan Control
0.009999999999999787,1715667183342,Let There Be Dark
0.010000000000000231,1715667183344,Door Open State to Color Light
0.009999999999999787,1715667183345,Enhanced Auto UnLock Door
0.010000000000000231,1715667183346,Brighten Dark Places
0.2799999999999998,1715667183353,Car Door Opened
0.020000000000000018,1715721247625,Close and lock all door
0.010000000000000231,8fc3a937a5804719a4200bb80c1ff621,CR Bed Light Control
0.020000000000000018,a2eb5a03211e48b98c4f49f002b6833d,Whole House Fan
0.009999999999999787,1715667183343,Let There Be Light
0.010000000000000231,b438cb83bf414166bf478017f3095e9e,Switch off GF lights when to bed
0.009999999999999787,1715667183352,Garage Door Opened
0.010000000000000231,60b9cb7a9c4e4311a27cd23267a427d7,Switch off indoor lights when asleep
0.5699999999999998,daa3f20af9ba46d4a41581af68a4255d,Switch off GF lights when nobody home
0.009999999999999787,1715667183350,Car Arrives
0.010000000000000231,60fc38a590204b2da454ea90c7f8fc56,Switch off FF lights when nobody home
0.009999999999999787,67e1d02ebb094f1b8fbb8633f5364939,Switch off lights when nobody home after midnight
0.010000000000000231,8fc3a937a5804719a4200bb80c1ff624,Lights on at sunset
0.009999999999999787,a2eb5a03211e48b98c4f49f002b6833d,Whole House Fan
0.010000000000000231,8fc3a937a5804719a4200bb80c1ff622,Lights on at night
0.009999999999999787,8fc3a937a5804719a4200bb80c1ff623,Lights off at night
0.010000000000000231,1715667183354,Interior Door Closed
0.009999999999999787,712ec364f7bd4290ad579e0bb5e3b52e,Lights on at sunset
0.010000000000000231,8fc3a937a5804719a4200bb80c1ff625,Harmony off lights off
1.33,a2eb5a03211e48b98c4f49f002b6833b,SunsetAction
0.009999999999999787,1715667183344,Door Open State to Color Light
0.009999999999999787,a2eb5a03211e48b98c4f49f002b6833c,Good Night House
0.8700000000000001,1715667184345,Enhanced Auto Lock Door
0.009999999999999787,1715667183347,Garage Door Opener
0.010000000000000675,1715667183348,Let There Be Light!
0.009999999999999787,1715667183320,Unlock It When I Arrive
0.009999999999999787,8fc3a937a5804719a4200bb80c1ff621,CR Bed Light Control
42 changes: 21 additions & 21 deletions homeassistant/components/rasc/datasets/arrival_evening.csv
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
0,b438cb83bf414166bf478017f3095e9e,Switch off GF lights when to bed
1,1715667183352,Garage Door Opened
2,60b9cb7a9c4e4311a27cd23267a427d7,Switch off indoor lights when asleep
2,daa3f20af9ba46d4a41581af68a4255d,Switch off GF lights when nobody home
3,1715667183350,Car Arrives
5,60fc38a590204b2da454ea90c7f8fc56,Switch off FF lights when nobody home
5,67e1d02ebb094f1b8fbb8633f5364939,Switch off lights when nobody home after midnight
6,8fc3a937a5804719a4200bb80c1ff624,Lights on at sunset
7,a2eb5a03211e48b98c4f49f002b6833d,Whole House Fan
7,8fc3a937a5804719a4200bb80c1ff622,Lights on at night
8,8fc3a937a5804719a4200bb80c1ff623,Lights off at night
9,1715667183354,Interior Door Closed
10,712ec364f7bd4290ad579e0bb5e3b52e,Lights on at sunset
15,8fc3a937a5804719a4200bb80c1ff625,Harmony off lights off
15,a2eb5a03211e48b98c4f49f002b6833b,SunsetAction
16,1715667183344,Door Open State to Color Light
18,a2eb5a03211e48b98c4f49f002b6833c,Good Night House
20,1715667184345,Enhanced Auto Lock Door
22,1715667183347,Garage Door Opener
25,1715667183348,Let There Be Light!
25,1715667183320,Unlock It When I Arrive
30,8fc3a937a5804719a4200bb80c1ff621,CR Bed Light Control
0.1,1715667183352,Garage Door Opened
0.009999999999999995,60b9cb7a9c4e4311a27cd23267a427d7,Switch off indoor lights when asleep
0.009999999999999995,daa3f20af9ba46d4a41581af68a4255d,Switch off GF lights when nobody home
0.010000000000000009,1715667183350,Car Arrives
0.010000000000000009,60fc38a590204b2da454ea90c7f8fc56,Switch off FF lights when nobody home
0.009999999999999981,67e1d02ebb094f1b8fbb8633f5364939,Switch off lights when nobody home after midnight
0.010000000000000009,8fc3a937a5804719a4200bb80c1ff624,Lights on at sunset
0.010000000000000009,a2eb5a03211e48b98c4f49f002b6833d,Whole House Fan
0.009999999999999981,8fc3a937a5804719a4200bb80c1ff622,Lights on at night
0.0100000000000000098,8fc3a937a5804719a4200bb80c1ff623,Lights off at night
0.010000000000000009,1715667183354,Interior Door Closed
1.3800000000000001,712ec364f7bd4290ad579e0bb5e3b52e,Lights on at sunset
0.010000000000000009,8fc3a937a5804719a4200bb80c1ff625,Harmony off lights off
0.4099999999999999,a2eb5a03211e48b98c4f49f002b6833b,SunsetAction
0.009999999999999787,1715667183344,Door Open State to Color Light
0.010000000000000231,a2eb5a03211e48b98c4f49f002b6833c,Good Night House
0.020000000000000018,1715667184345,Enhanced Auto Lock Door
0.009999999999999787,1715667183347,Garage Door Opener
0.010000000000000231,1715667183348,Let There Be Light!
0.009999999999999787,1715667183320,Unlock It When I Arrive
0.010000000000000231,8fc3a937a5804719a4200bb80c1ff621,CR Bed Light Control
5 changes: 2 additions & 3 deletions homeassistant/components/rasc/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ def __init__(self, hass: HomeAssistant, config: dict[str, Any]) -> None:
self._hass.bus.async_listen("reschedule_event", self._handle_reschedule_event)

def _handle_reschedule_event(self, event: Event):
if "diff" in event.data:
self._reschedule_diffs.append(event.data["diff"])
return
start_time = event.data["from"] - self._start_time
end_time = event.data["to"] - self._start_time
diff = event.data["diff"]
self._reschedule_diffs.append(diff)
self._reschedule_intervals.append((start_time, end_time))

def start(self) -> None:
Expand Down
9 changes: 4 additions & 5 deletions homeassistant/components/rasc/rescheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import heapq
from itertools import product
import logging
import time
import time as t
from typing import Optional

from homeassistant.const import (
Expand Down Expand Up @@ -2388,7 +2388,7 @@ async def _reschedule(
self, entity_id: str, action_id: str, diff: timedelta
) -> None:
"""Reschedule the entities based on the rescheduling policy."""
start_time = time.time()
start_time = t.time()
# Save the old schedule
old_lt = self._scheduler.lineage_table.duplicate
old_so = self._scheduler.duplicate_serialization_order
Expand Down Expand Up @@ -2548,9 +2548,9 @@ async def _reschedule(
serialization_order=new_so,
)
self._apply_schedule(new_lt, new_so)
end_time = time.time()
end_time = t.time()
self._hass.bus.async_fire(
"reschedule_event", {"from": start_time, "to": end_time}
"reschedule_event", {"from": start_time, "to": end_time, "diff": diff}
)

def _apply_schedule(
Expand Down Expand Up @@ -2679,7 +2679,6 @@ def _action_length_diff(self, event: Event) -> timedelta:

async def _handle_undertime(self, event: Event) -> None:
diff = self._action_length_diff(event)
self._hass.bus.async_fire("reschedule_event", {"diff": diff.total_seconds()})
entity_id: Optional[str] = event.data.get(ATTR_ENTITY_ID)
action_id: Optional[str] = event.data.get(ATTR_ACTION_ID)
if not entity_id or not action_id:
Expand Down

0 comments on commit 4b463d8

Please sign in to comment.