I want to have a perspective project for configuring some devices over serial.
I want the user to be able to:
open the perspective webpage on their computer
plug a serial device into their computer
See it in the perspective session and be able to configure it somehow and send data back and forth to the device.
I tried using system.serial within a Perspective project and opening the correct COM port I got from Device Manager on Windows but I was not able to get data from the serial device.
You need to use Vision for this. Perspective scripting always runs on the Gateway, and Perspective browser sessions do not have access to host hardware.
It is designed to do exactly what you need through a direct connection between your client and the gateway (it works even you have not even started the Perspective session)!
You 100000% should be using TLS in production, but I can appreciate that it’s an extra step for local development. However, it’s trivial to self-sign certs once you understand the workflow.
Honestly we have been looking (waiting) for years for Web-serial to come, and it was stalled for 5 years+.
The topic is very contrasted as now it is available for Chromium based browsers, but this has been rejected both by Mozilla & Apple because of "harmful to web standards".
So today I am not sure this guy has a real future; and from an automation perspective I would be also a bit anxious about its reliability on long term (a browser update could just make everything not working).
There are not many solutions there : if you need something serious best is still to have serial to network converter, relatively cheap & super reliable on long term as there is no dependency on OS.
And anyhow code is run in Gateway with Perspective, not much on clients.
This is what I ended up going with. I needed to develop a tool for configuring embedded devices via serial but luckily it didn't need to be integrated with our SCADA system. So I build a standalone web tool with React that used the Chrome WebUSB API.
In the end it turned out pretty well and was much easier than developing a standalone application that every tech needed to install on their laptop and we could easily link to it from an Ignition page.