Repository navigation
fix(examples): make the OPC UA examples runnable - #1573
erossignon wants to merge 4 commits into
Conversation
bindings:opcua:1 and :2 still referred to opcua-demo1.js and opcua-demo2.js, renamed to demo-opcua1.js and demo-opcua2.js by the kebab-case rename; both scripts failed with "Cannot find module". Adds bindings:opcua:secure for the security demo, which had no script.
brewCoffee and fillTank passed the CoffeeMachineA object as the OPC UA objectId, but MakeCoffee and FillTank are components of its 2:MethodSet, not of the machine. The server rejected the pairing with BadMethodInvalid, after resolving the method node itself just fine. Point opcua:nodeId at 2:MethodSet in both action forms.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1573 +/- ##
==========================================
+ Coverage 78.25% 79.34% +1.09%
==========================================
Files 91 91
Lines 15907 16162 +255
Branches 1544 1587 +43
==========================================
+ Hits 12448 12824 +376
+ Misses 3436 3315 -121
Partials 23 23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
danielpeintner
left a comment
There was a problem hiding this comment.
A general comment. The readme in packages/examples/src/bindings/opcua does not explain what all the ts files are for. Maybe we can spend some time describing what each demo is meant to show...
|
I'll add a followup commit with improved readme. |
The temperature property copied the unit of pumpSpeed, and demo-opcua2 printed it. The demo server reports values around 27, i.e. degrees.
Describes what each of the four demos shows, how to run it (including the test server the secure demo needs), and the two TD idioms readers trip on: browse paths, and the method owner in an action form. Output samples come from real runs; images are hand-made SVGs. Written in ASD-STE100 Simplified Technical English.
|
@danielpeintner , the readme in packages/examples/src/bindings/opcua now explains |
|
I think the update looks good. I would wait for #1574 to be merged first since after that we need to change the TDs providing the right contentType... |
I'll take take of this, but first merge this PR... |
Two independent fixes that make the OPC UA examples runnable. Refs #1012.
npm run bindings:opcua:1/:2pointed at files that do not existThe scripts still named
opcua-demo1.js/opcua-demo2.js; the sources aredemo-opcua1.ts/demo-opcua2.ts. Also adds the missingbindings:opcua:secure—demo-opcua-secure.tsarrived with #1552 but never got a script, so there was no way to run it.All four
bindings:opcua:*targets now resolve againstdist/afternpm run build.The coffee machine demo could not invoke its actions
brewCoffeefailed against the live demo server with:Both action forms passed the
CoffeeMachineAobject as the OPC UAobjectId, butMakeCoffeeandFillTankare components of its2:MethodSet, not of the machine. The Call service requires the method to belong to the object named, so the server refused the pairing — after resolving the method node itself perfectly well, which is what made the error puzzling.Verified against
opc.tcp://opcuademo.sterfive.com:26543, calling the same method two ways:objectIdns=1;i=1676(the machine)BadMethodInvalid (0x80750000)ns=1;i=1709(2:MethodSet)Good (0x00000000)fillTankhad the identical defect and would have failed next; the script just died atbrewCoffeefirst. Both forms now point at2:MethodSet, and the demo runs end to end: bothbrewCoffeecalls andfillTankcomplete, bean level drops 500 -> 460 g.Caveats
recordActiononly appends to an array, and the display repaints solely from observation callbacks, so nothing redraws once the machine settles back to standby.uav:componentOf, with a fallback to browsing the method's inverseHasComponent— that would remove this footgun.