Class Item

This class implements the following methods and properties:

class lib.item.item.Item(smarthome, parent, path, config, items_instance=None)[Quellcode]

Bases: object

Class from which item objects are created

The class Item implements the methods and attributes of an item. Each item is represented by an instance of the class Item. For an item to be valid and usable, it has to be part of the item tree, which is maintained by an object of class Items.

This class is used by the method `load_itemdefinitions() of the Items object.

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.path() instead of item.id()

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]

Builds an absolute item path relative to the current item

Parameter
  • relativepath – string with the relative item path

  • attribute – string with the name of the item’s attribute, which contains the relative path (for log entries)

Rückgabe

string with the absolute item path

expand_relativepathes(attr, begintag, endtag)[Quellcode]

converts a configuration attribute containing relative item paths to absolute paths

The item’s attribute can be of type str or list (of strings)

The begintag and the endtag remain in the result string!

Parameter
  • attr – Name of the attribute. Use * as a wildcard at the end

  • begintag – string or list of strings that signals the beginning of a relative path is following

  • endtag – string or list of strings that signals the end of a relative path

get_stringwithabsolutepathes(evalstr, begintag, endtag, attribute='')[Quellcode]

converts a string containing relative item paths to a string with absolute item paths

The begintag and the endtag remain in the result string!

Parameter
  • evalstr – string with the statement that may contain relative item paths

  • begintag – string that signals the beginning of a relative path is following

  • endtag – string that signals the end of a relative path

  • attribute – string with the name of the item’s attribute, which contains the relative path

Rückgabe

string with the statement containing absolute item paths

add_logic_trigger(logic)[Quellcode]

Add a logic trigger to the item

Parameter

logic

Rückgabe

remove_logic_trigger(logic)[Quellcode]
get_logic_triggers()[Quellcode]

Returns a list of logics to trigger, if the item gets changed

Rückgabe

Logics to trigger

Rückgabetyp

list

add_method_trigger(method)[Quellcode]
remove_method_trigger(method)[Quellcode]
get_method_triggers()[Quellcode]

Returns a list of item methods to trigger, if this item gets changed

Rückgabe

methods to trigger

Rückgabetyp

list

timer(time, value, auto=False, compat='', caller=None, source=None)[Quellcode]
remove_timer()[Quellcode]
autotimer(time=None, value=None, compat='compat_1.2')[Quellcode]
fade(dest, step=1, delta=1)[Quellcode]
return_children()[Quellcode]
return_parent()[Quellcode]
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]

Translation method from object members to json :return: Key / Value pairs from object members

to_json()[Quellcode]