Hallo,
ich versuche Funktionen, die ich immer wieder benötige in ein Script auszulagern. Nur leider wird das Script nicht abgearbeitet.
Was ich gefunden habe ist, das man den Pfad zu den Java Klassen komplett angeben muss, leider finde ich nicht alle Klassen.
Ich habe auch vor transfom mal org.openhab.core.
gestellt, hat aber auch keine Wirkung gezeigt.
Im log werden keine Fehler eingetragen, das Script wird aber gestartet, kommt aber nur bis zur ersten Logmessage.
Geht das überhaupt, und wenn ja, wie müsste der Aufruf der sendhttpgetrequest und transform aussehen?
Vielen Dank und Gruß
Christian
ich versuche Funktionen, die ich immer wieder benötige in ein Script auszulagern. Nur leider wird das Script nicht abgearbeitet.
Was ich gefunden habe ist, das man den Pfad zu den Java Klassen komplett angeben muss, leider finde ich nicht alle Klassen.
Code:
[COLOR=#3933FF][FONT=Monaco][SIZE=11px][COLOR=#000000]logInfo([/COLOR]"node"[COLOR=#000000],[/COLOR]"Script: read_node_id_details [U]wurde[/U] [U]gestartet[/U]"[COLOR=#000000])[/COLOR][/SIZE][/FONT][/COLOR] [COLOR=#4E9072][FONT=Monaco][SIZE=11px][COLOR=#931a68]var[/COLOR][COLOR=#000000] String json = [/COLOR][COLOR=#3933ff]""[/COLOR]//json_string_transfer.state.toString()[/SIZE][/FONT][/COLOR] [COLOR=#3933FF][FONT=Monaco][SIZE=11px][COLOR=#931a68]var[/COLOR][COLOR=#000000] String url = [/COLOR]"http://192.168.114.212/user/node/data_node.php?node_id='"[COLOR=#000000]+node_id_transfer.state.toString()+[/COLOR]"'"[/SIZE][/FONT][/COLOR] [FONT=Monaco][SIZE=11px]json = [U]org[/U].[U]openhab[/U].[U]io[/U].[U]net[/U].[U]http[/U].[U]HttpUtil[/U].[U]executeUrl[/U]([COLOR=#3933ff]"GET"[/COLOR], url, [COLOR=#909090]5000[/COLOR])[/SIZE][/FONT] [COLOR=#3933FF][FONT=Monaco][SIZE=11px][COLOR=#000000]logInfo([/COLOR]"node"[COLOR=#000000],[/COLOR]"[U]json[/U] String: "[COLOR=#000000]+json)[/COLOR][/SIZE][/FONT][/COLOR] [FONT=Monaco][SIZE=11px]json = json.[COLOR=#bb4300]replace[/COLOR]([COLOR=#3933ff]"["[/COLOR], [COLOR=#3933ff]""[/COLOR])[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]json = json.[COLOR=#bb4300]replace[/COLOR]([COLOR=#3933ff]"]"[/COLOR], [COLOR=#3933ff]""[/COLOR])[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]node_id.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.node_id"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]customer_name.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.cust_name"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]customer_forename.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.cust_forename"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]customer_number.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.cust_nr"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]customer_plz.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.cust_plz"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]customer_street.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.cust_street"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]customer_city.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.cust_city"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]customer_mail.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.cust_mail"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]interval_support.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.interval_support"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]interval_updates.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.interval_updates"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]customer_longitude.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.cust_longitude"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]customer_latitude.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.cust_latitude"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]change_node_id.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.change_nodeID"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]new_node_id.[COLOR=#bb4300]postUpdate[/COLOR]([U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.new_nodeID"[/COLOR],json))[/SIZE][/FONT] [FONT=Monaco][SIZE=11px][COLOR=#931a68]var[/COLOR] String longitude = [U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.cust_longitude"[/COLOR],json)[/SIZE][/FONT] [FONT=Monaco][SIZE=11px][COLOR=#931a68]var[/COLOR] String latitude = [U]org[/U].[U]openhab[/U].[U]core[/U].[U]transform[/U]([COLOR=#3933ff]"JSONPATH"[/COLOR],[COLOR=#3933ff]"$.cust_latitude"[/COLOR],json)[/SIZE][/FONT] [FONT=Monaco][SIZE=11px][COLOR=#931a68]var[/COLOR] String location_string = longitude+[COLOR=#3933ff]","[/COLOR]+latitude[/SIZE][/FONT] [FONT=Monaco][SIZE=11px]customer_location.[COLOR=#bb4300]postUpdate[/COLOR]([COLOR=#931a68]new[/COLOR] org.openhab.core.library.types.PointType(location_string))[/SIZE][/FONT] [COLOR=#931A68][FONT=Monaco][SIZE=11px]returntrue[/SIZE][/FONT][/COLOR]
gestellt, hat aber auch keine Wirkung gezeigt.
Im log werden keine Fehler eingetragen, das Script wird aber gestartet, kommt aber nur bis zur ersten Logmessage.
Geht das überhaupt, und wenn ja, wie müsste der Aufruf der sendhttpgetrequest und transform aussehen?
Vielen Dank und Gruß
Christian