Provides universal time switches for items (German: Universelle Zeitschalt Uhr)
Calculating of sunset/sunrise in triggers, requires installation of ephem (which should already be part of core)
[uzsu]
class_name = UZSU
class_path = plugins.uzsu
uzsu:
class_name: UZSU
class_path: plugins.uzsu
You have to specify a item with type = dict
and with the uzsu_item
attribute set to the path of the item which will be set by this item. The dict has to have two keys. active
which says if the whole list of entries should be active or not and list
which contains a list of all entries (see the Item Data Format section for more details).
# items/my.conf (deprecated)
[someroom]
[[someitem]]
type = int
[[[anotheritem]]]
type = dict
uzsu_item = someroom.someitem
cache = True
# items/my.yaml
someroom:
someitem:
type: int
anotheritem:
type: dict
uzsu_item: someroom.someitem
cache: 'True'
If you specify the cache = True
as well, then you're switching entries will be there even if you restart smarthome.py.
Each UZSU item is of type list. Each list entry has to be a dict with specific key and value pairs. Here are the possible keys and what their for:
-
dtstart: a datetime object. Exact datetime as start value for the rrule algorithm. Important e.g. for FREQ=MINUTELY rrules (optional).
-
value: the value which will be set to the item.
-
active:
True
if the entry is activated,False
if not. A deactivated entry is stored to the database but doesn't trigger the setting of the value. It can be enabled later with theupdate
method. -
time: time as string to use sunrise/sunset arithmetics like in the crontab eg.
17:00<sunset
,sunrise>8:00
,17:00<sunset
. You also can set the time with17:00
. -
rrule: You can use the recurrence rules documented in the iCalendar RFC for recurrence use of a switching entry.
Activates the light every other day at 16:30 and deactivates it at 17:30 for five times:
sh.eg.wohnen.kugellampe.uzsu({'active':True, 'list':[
{'value':1, 'active':True, 'rrule':'FREQ=DAILY;INTERVAL=2;COUNT=5', 'time': '16:30'},
{'value':0, 'active':True, 'rrule':'FREQ=DAILY;INTERVAL=2;COUNT=5', 'time': '17:30'}
]})
There is a widget available which gives an interface to the UZSU. The structure has changed from SmartVISU 2.8 to 2.9 slightly, please consult the corresponding forum.