Wenn dies dein erster Besuch hier ist, lies bitte zuerst die Hilfe - Häufig gestellte Fragen durch. Du musst dich vermutlich registrieren, bevor du Beiträge verfassen kannst. Klicke oben auf 'Registrieren', um den Registrierungsprozess zu starten. Du kannst auch jetzt schon Beiträge lesen. Suche dir einfach das Forum aus, das dich am meisten interessiert.
Ankündigung
Einklappen
(KI-) Softwarelösungen
Um die Flut an (primär KI-erzeugter) Software zu kanalisieren, sind solche Lösungen ab sofort im Unterforum "Codeschnipsel" einzustellen. Bereits gepostete Themen werden sukzessive dorthin verschoben.
Mehr anzeigen
Weniger anzeigen
X1 Logic Node: Scripting - One block. Endless possibilities.
Thx for the great work i really like your Logic Node, but i am facing the problem with syntax error while using python.
I'm using your script converter from multli-line to single-line and paste it into GPA....
Thanks!
Thanks for the example, shindig632. The old converter joined the import, assignment and if statement with spaces. My original workaround also contained a syntax error: Python 2.7 does not allow a compound if statement after a semicolon.
Here is a one-line version you can paste straight into the Python Script field on X1. For this test, configure one output. OUT1 shows 0 on the first trigger and keeps the stored value on later triggers.
Code:
exec("import time\nnow = time.time()\nif 'running' not in STATE:\n STATE['running'] = 0\nOUT1 = STATE['running']")
The \n sequences recreate the line breaks. The four spaces keep the assignment inside the if block. For longer scripts, keep the multiline original and use the Scripting editor to generate the line for GPA.
Hey, I had a problem on the X1 where other modules stopped working (using your v.0.2.000000). For example, the Fritzbox check (HostCheck) stopped working, but no error message was displayed.
Hi Roel,
First of all, thank you for your great Scripting Logic Node! We are currently using v0.2.000000 in GPA 6.1 on a Gira X1 running Firmware 4.0.350 and trying to send simple ASCII strings via UDP (172.18.227.118:6553) to control a ChamSys MagicQ lighting controller.
Unfortunately, we hit a roadblock with all three scripting languages on X1 FW 4.0.350:
Python 2.7 (import socket):
The project check and upload succeed without errors.
When triggered on the X1, the node fails immediately and outputs to Error Text:
Error running script: python.exe, PID=2180
It seems X1 Firmware 4.0.350 blocks or fails to start/communicate with the external Python worker process.
Lua 5.4 (require("socket")):
Fails already during the GPA project check with:
LuaScriptException: [string "script"]:1: module 'socket' not found (missing socket.lua / socket.dll / socket54.dll in the node package).
JavaScript (System.Net.Sockets.UdpClient):
Runs natively and fast on the X1, but direct access to .NET socket classes is blocked in the Jint sandbox (Script error: System is not defined).
Question:
Is there a known workaround to run Python on X1 Firmware 4.0.350, or is there a built-in helper function in JavaScript/Lua within your node to send raw UDP packets?
Thanks in advance for your help!
Best regards,
Christoph
Hi Roeller this is awesome. But I am failing at the very beginning: I am unable to copy-paste a multi-line code into the "Script" field in GPA 6.1. It only keeps the first line of the copied block. Also if i copy the example code already in the block, it only keeps the first line when i paste it.
The work-around is to convert it to one-liner Base64
Your scripting logic is truly a sensational approach to generating logical content with “a single” block. Kudos for that—and you're also showing just what's possible with the “little machine.”
It would certainly be more than helpful if you could also describe what the “development environment” should look like for the user..... :-)
I hardly think that the average X1 user writes their “working” code block in a text editor and simply pastes it in. So, for most people, using Visual Studio Code—with the appropriate environment configuration (C# Dev Kit, etc.)—will be a helpful workaround.
Perhaps you could add a description of what the minimal test/development environment should look like?
Best regards and thanks to you for your dedication to the X1, André
The topic of “triggers” has already been discussed elsewhere here, and you solved it with a simple “double” link.
However, this doesn't work in my case...
I want to convert a total of 38 data points into JSON and then send them to an API endpoint. Since the script logic is only triggered when the trigger is activated, I’d have to add all 38 data points to the trigger input as well.
I don’t think that’s a great solution, and maybe in one of the next versions you could add the option to set the inputs to “listen” mode.
Best regards, André
Hallo Roeller,
An anderer Stelle hier wurde ja schon das Theme "Trigger" angesprochen und Du hast es mit einem einfachen "doppelten" Verknüpfen gelöst.
In meinem Versuch funktioniert dies allerdings nicht.....
Ich möchte insgesamt 38 Datenpunkte in ein JSON wandeln und dann an einen API-Endpunkt senden. Die Script Logik wird ja nur beim Trigger ausgelöst; somit müsste ich alle 38 Datenpunkte zusätzlich auf den Trigger-Eingang legen.
Ich halte das für keine schöne Lösung und vielleicht hast Du für eine der nächsten Versionen die Möglichkeit die Eingänge optional "hörend" zu stellen.
Wir verarbeiten personenbezogene Daten über die Nutzer unserer Website mithilfe von Cookies und anderen Technologien, um unsere Dienste bereitzustellen. Weitere Informationen findest Du in unserer Datenschutzerklärung.
Indem Du unten auf "ICH stimme zu" klickst, stimmst Du unserer Datenschutzerklärung und unseren persönlichen Datenverarbeitungs- und Cookie-Praktiken zu, wie darin beschrieben. Du erkennst außerdem an, dass dieses Forum möglicherweise außerhalb Deines Landes gehostet wird und bist damit einverstanden, dass Deine Daten in dem Land, in dem dieses Forum gehostet wird, gesammelt, gespeichert und verarbeitet werden.
Kommentar