|
<< Click to Display Table of Contents >> Navigation: Components > Control, logic & time > Script IDE (LUA / Python) > Eisbaer-specific extensions |
Special functions:
Description |
LUA |
Python |
|---|---|---|
Check whether a specific input was a trigger (add "_triggered" to the end of the input name) or whether the cyclical triggering was triggered. |
if inputName_triggered == true then ... end if inputArrayName_triggered[index] == true then ... end _cyclic_triggered |
if inputName_triggered == True ... if inputArrayName_triggered[index] == True: ... _cyclic_triggered |
Get last value of an input (add "_lastValue" at the end of the input name ): |
lastValueOfVariable = channelName_lastValue lastValueOfArrayElement = channelArrayName_lastValue[index] |
lastValueOfVariable = channelName_lastValue lastValueOfArrayElement = channelArrayName_lastValue[index] |
Get the number of elements for input/output arrays (add "_count" at the end of the input/output name ): |
elementCount = channelName_count |
elementCount = len(channelName) |
Direct set an output datapoint within the script (will be set even if the script still runs [e.g. waiting or processing]): |
eisbaerComponent:SetOutputSpFromLua("outputName", valueToSet) eisbaerComponent:SetOutputSpFromLua("outputName", valueToSet, forceOutput) eisbaerComponent:SetOutputSpFromLua("outputArrayName", valueToSet, index) eisbaerComponent:SetOutputSpFromLua("outputArrayName", valueToSet, index, forceOutput) |
Eisbaer_SetOutputSp("outputName", valueToSet) Eisbaer_SetOutputSp("outputName", valueToSet, forceOutput) Eisbaer_SetOutputSp("outputArrayName", valueToSet, index) Eisbaer_SetOutputSp("outputArrayName", valueToSet, index, forceOutput) |
Direct set an output datapoint with definition of the KNX DPT within the script (will be set even if the script still runs [e.g. waiting or processing]): valid dataPointTypes are DataPointByteArrayValue and DataPoint1OctetGenericValue - DataPoint14OctetGenericValue and the input values have to be of type byte array |
eisbaerComponent:SetOutputSpFromLuaAsDpt("outputName", valueToSet, dataPointType) |
Eisbaer_SetOutputSpAsDpt("outputName", valueToSet, dataPointType) valid dataPointTypes are: •DataPointByteArrayValue •DataPoint1OctetGenericValue •DataPoint14OctetGenericValue The input must be of the byte array type |
Direct read the current input datapoint within the script (will be read the current value even if the script still runs [e.g. waiting or processing]): |
eisbaerComponent:ReadInputSpFromLua("inputName") eisbaerComponent:ReadInputSpFromLua("inputArrayName", index) |
Eisbaer_ReadInputSp("inputName") Eisbaer_ReadInputSp("inputArrayName", index) |
Print text to the debug output: |
eisbaerComponent:SetOutputSpFromLua("#DEBUG#", text) eisbaerComponent:SetOutputSpFromLua("#DEBUG_VERBOSE#", text) |
Eisbaer_SetOutputSp("#DEBUG#", text, True) Eisbaer_SetOutputSp("#DEBUG_VERBOSE#", text, True) |
Store a value (can be read on a later script run): |
eisbaerComponent:StoreValue("freeKeyName", valueToStore) |
Eisbaer_StoreValue("freeKeyName", valueToStore) |
Store a value persistant (can be read on a later script run, even after project is reloaded): |
eisbaerComponent:StoreValue("freeKeyName", valueToStore, true) |
Eisbaer_StoreValue("freeKeyName", valueToStore, True) |
Recall a stored value: |
storedValue = eisbaerComponent:RecallValue("freeKeyName") |
storedValue = Eisbaer_RecallValue("freeKeyName") |
Remove a stored value from the storage: |
eisbaerComponent:RemoveValueFromStorage("freeKeyName") |
Eisbaer_RemoveValueFromStorage("freeKeyName") |
Clear the storage: |
eisbaerComponent:ClearStorage() |
Eisbaer_ClearStorage() |
Sleep/Delay function: |
eisbaerComponent:Sleep(delayInMs) |
Phyton eigene Implementierung. |
Convert DataPointValue function: |
convertedValue = eisbaerComponent:GetValueFromDpt(value) eisbaerComponent:SetOutputSpFromLuaAsDpt("MyChannelName", "Byte array with correct length") |
convertedValue = Eisbaer_GetValueFromDpt(value) |
Perform web request
requestType: GET=0, PUT=1, POST=2, DELETE=3 queryFormat: Unspecified=0, TEXT_HTML=1, APPLICATION_JSON=2, APPLICATION_XML=3, APPLICATION_URL_ENCODED=4, TEXT_XML=5, TEXT_JSON=6, TEXT_PLAIN=7, MULTIPART_FORM_DATA=8, VND_API_PLUS_JSON=9, APPLICATION_FORM_URL_ENCODED=10, APPLICATION_JSONP=11 authType: None=0, Basic=1, HttpBasic=2, BearerToken=3 header["User-Agent"] = "Firefox" header["andererKEy"] = "andererWert" |
eisbaerComponent:DoWebRequest(url, body, [requestType], [queryFormat], [authType], [user], [password], [headers])
Example: Answer = eisbaerComponent:DoWebRequest(Url, "", 0, 0, 0, nil, nil, header) |
Eisbaer_DoWebRequest(url, body, [requestType], [queryFormat], [authType], [user], [password], [headers]) requestType: GET=0, PUT=1, POST=2, DELETE=3 queryFormat: Unspecified=0, TEXT_HTML=1, APPLICATION_JSON=2, APPLICATION_XML=3, APPLICATION_URL_ENCODED=4, TEXT_XML=5, TEXT_JSON=6, TEXT_PLAIN=7, MULTIPART_FORM_DATA=8, VND_API_PLUS_JSON=9, APPLICATION_FORM_URL_ENCODED=10, APPLICATION_JSONP=11 authType: None=0, Basic=1, HttpBasic=2, BearerToken=3 or Python own implementation. |
Get last web request error: |
eisbaerComponent:WebRequestGetLastError() |
Eisbaer_WebRequestGetLastError() |
Get last web request status code: |
eisbaerComponent:WebRequestGetLastStatus() |
Eisbaer_WebRequestGetLastStatus() |
Valid dataPointTypes are:
DataPoint2OctetFloatValue
DataPoint2OctetSignedValue
DataPoint2OctetUnsignedValue
DataPoint4OctetFloatValue
DataPoint4OctetSignedValue
DataPoint4OctetUnsignedValue
DataPoint8BitSignedValue
DataPoint8BitUnsignedValue
DataPoint8OctetSignedValue
string and bool values are always recognised automatically and do not have to be specified explicitly.