Class Item
This class implements the following methods and properties:
- class lib.item.item.Item(smarthome, parent, path, config, items_instance=None)[Quellcode]
Bases:
objectClass from which item objects are created
The class
Itemimplements the methods and attributes of an item. Each item is represented by an instance of the classItem. For an item to be valid and usable, it has to be part of the item tree, which is maintained by an object of classItems.This class is used by the method
`load_itemdefinitions()of the Items object.- class ListHandler(item)
Bases:
TypeHandlerHandle list-type items — mirrors Python list mutation methods.
- append(value, caller='Logic', source=None, dest=None)
- clear(caller='Logic', source=None, dest=None)
- delete(value, caller='Logic', source=None, dest=None)
Mimic
del list[x:y]— supply"x:y"as value. Named delete rather than del for syntax reasons.
- extend(value, caller='Logic', source=None, dest=None)
- insert(index, value, caller='Logic', source=None, dest=None)
- item_functions = ['append', 'prepend', 'insert', 'pop', 'extend', 'clear', 'delete', 'remove']
- pop(index=None, caller='Logic', source=None, dest=None)
- prepend(value, caller='Logic', source=None, dest=None)
- remove(value, caller='Logic', source=None, dest=None)
- class DictHandler(item)
Bases:
TypeHandlerHandle dict-type items — mirrors Python dict mutation methods.
- clear(caller='Logic', source=None, dest=None)
- delete(key, caller='Logic', source=None, dest=None)
Named delete rather than del for syntax reasons.
- get(key, default=None)
- item_functions = ['get', 'delete', 'clear', 'pop', 'popitem', 'update']
- pop(key, caller='Logic', source=None, dest=None, default=None)
- popitem(caller='Logic', source=None, dest=None)
- update(value, caller='Logic', source=None, dest=None)
- remove()[Quellcode]
Notify plugins of item deletion — delegates to _lifecycle.remove().
- find_attribute(attr, default='', level=-1, strict=False)[Quellcode]
Find attribute value walking up the item tree — delegates to _pathresolution.
- Rückgabetyp:
str
- path()[Quellcode]
Path of the item
Available only in SmartHomeNG v1.6, not in versions above
- Rückgabe:
String with the path of the item
- Rückgabetyp:
str
- id()[Quellcode]
Old method name - Use item.property.path instead of item.property.path
- type()[Quellcode]
Datatype of the item
- Rückgabe:
Datatype of the item
- Rückgabetyp:
str
- last_change()[Quellcode]
Timestamp of last change of item’s value
- Rückgabe:
Timestamp of last change
- age()[Quellcode]
Age of the item’s actual value. Returns the time in seconds since the last change of the value
- Rückgabe:
Age of the value
- Rückgabetyp:
int
- last_update()[Quellcode]
Timestamp of last update of item’s value (not necessarily change)
- Rückgabe:
Timestamp of last update
- update_age()[Quellcode]
Update-age of the item’s actual value. Returns the time in seconds since the value has been updated (not necessarily changed)
- Rückgabe:
Update-age of the value
- Rückgabetyp:
int
- last_trigger()[Quellcode]
Timestamp of last trigger of item’s eval expression (if available)
- Rückgabe:
Timestamp of last update
- trigger_age()[Quellcode]
Trigger-age of the item’s last eval trigger. Returns the time in seconds since the eval has been triggered
- Rückgabe:
Update-age of the value
- Rückgabetyp:
int
- prev_change()[Quellcode]
Timestamp of the previous (next-to-last) change of item’s value
- Rückgabe:
Timestamp of previous change
- prev_age()[Quellcode]
Age of the item’s previous value. Returns the time in seconds the item had the the previous value
- Rückgabe:
Age of the previous value
- Rückgabetyp:
int
- prev_update()[Quellcode]
Timestamp of previous (next-to-last) update of item’s value (not necessarily change)
- Rückgabe:
Timestamp of previous update
- prev_update_age()[Quellcode]
Update-age of the item’s previous value. Returns the time in seconds the previous value existed since it had been updated (not necessarily changed)
- Rückgabe:
Update-age of the previous value
- Rückgabetyp:
int
- prev_trigger()[Quellcode]
Timestamp of previous (next-to-last) trigger of item’s eval
- Rückgabe:
Timestamp of previous update
- prev_trigger_age()[Quellcode]
Trigger-age of the item’s previous eval trigger. Returns the time in seconds of the previous eval trigger
- Rückgabe:
Update-age of the previous value
- Rückgabetyp:
int
- prev_value()[Quellcode]
Next-to-last value of the item
- Rückgabe:
Next-to-last value of the item
- changed_by()[Quellcode]
Returns an indication, which plugin, logic or event changed the item’s value
- Rückgabe:
Changer of item’s value
- Rückgabetyp:
str
- updated_by()[Quellcode]
Returns an indication, which plugin, logic or event updated (not necessarily changed) the item’s value
- Rückgabe:
Updater of item’s value
- Rückgabetyp:
str
- triggered_by()[Quellcode]
Returns an indication, which plugin, logic or event triggered the item’s eval
- Rückgabe:
Updater of item’s value
- Rückgabetyp:
str
- get_absolutepath(relativepath, attribute='')[Quellcode]
Build an absolute item path from a relative path — delegates to _pathresolution.
- expand_relativepathes(attr, begintag, endtag)[Quellcode]
Convert relative paths in a conf attribute to absolute paths — delegates to _pathresolution.
- get_stringwithabsolutepathes(evalstr, begintag, endtag, attribute='')[Quellcode]
Convert relative path references in a string to absolute paths — delegates to _pathresolution.
- get_class_from_frame(fr)[Quellcode]
Return debug frame string — delegates to _stackinfo.get_class_from_frame().
- get_calling_item_from_frame(fr)[Quellcode]
Return calling item string from frame — delegates to _stackinfo.get_calling_item_from_frame().
- get_stack_info()[Quellcode]
Return caller info from call stack — delegates to _stackinfo.get_stack_info().
- get_attr_time(attr)[Quellcode]
Return resolved time for ‚cycle‘ or ‚autotimer‘ — delegates to _autotimer.get_attr_time().
- get_attr_value(attr, value=None)[Quellcode]
Return resolved value for ‚cycle‘/‘autotimer‘/‘cron‘ — delegates to _autotimer.get_attr_value().
- hysteresis_state()[Quellcode]
Return the inner hysteresis state — delegates to _hysteresis.get_hysteresis_state()
- hysteresis_data()[Quellcode]
Return hysteresis diagnostics dict — delegates to _hysteresis.get_hysteresis_data()
- add_logic_trigger(logic)[Quellcode]
Add a logic trigger — delegates to _triggers.add_logic_trigger().
- remove_logic_trigger(logic)[Quellcode]
Remove a logic trigger — delegates to _triggers.remove_logic_trigger().
- get_logic_triggers()[Quellcode]
Return logic triggers list — delegates to _triggers.get_logic_triggers().
- add_method_trigger(method)[Quellcode]
Add a method trigger — delegates to _triggers.add_method_trigger().
- remove_method_trigger(method)[Quellcode]
Remove a method trigger — delegates to _triggers.remove_method_trigger().
- get_method_triggers()[Quellcode]
Return method triggers list — delegates to _triggers.get_method_triggers().
- get_item_triggers()[Quellcode]
Return item triggers list — delegates to _triggers.get_item_triggers().
- get_hysteresis_item_triggers()[Quellcode]
Return hysteresis item triggers list — delegates to _triggers.get_hysteresis_item_triggers().
- timer(time, value, auto=False, caller=None, source=None, compat='latest')[Quellcode]
Start a one-shot or autotimer — delegates to _autotimer.item_timer().
- remove_timer()[Quellcode]
Cancel the running timer — delegates to _autotimer.item_remove_timer().
- autotimer(time=None, value=None, compat='latest')[Quellcode]
Set or clear the autotimer time/value — delegates to _autotimer.item_autotimer().
- fade(dest, step=1, delta=1, caller=None, stop_fade=None, continue_fade=None, instant_set=True, update=False)[Quellcode]
Fade item value to dest — delegates to _fade.fade().
- return_children()[Quellcode]
- return_parent(level=1, strict=False)[Quellcode]
Return ancestor item at given level — delegates to _navigation.return_parent_item().
- set(value, caller='Logic', source=None, dest=None, prev_change=None, last_change=None)[Quellcode]
Set an Item value and optionally set prev_change and last_change timestamps
(This method is called eg. by the database plugin to initialize items from the database on start)
- Parameter:
value –
caller –
source –
dest –
prev_change –
last_change –
- Rückgabe:
- get_children_path()[Quellcode]
- jsonvars()[Quellcode]
Return serialisable attribute dict — delegates to _json.jsonvars().
- to_json()[Quellcode]
Return pretty-printed JSON string — delegates to _json.to_json().