This is the latest installment in a series about using gRPC to interact with the PLCnext Runtime on a PLCnext Control device.
Earlier posts in the series included:
The articles listed above show how to access the gRPC server on a PLCnext Control device from a remote client device. This post gives an example of a local gRPC client - that is, a gRPC client running on a PLCnext Control device, which accesses the gRPC server on the same device.
Other examples of local gRPC clients on PLCnext Control devices can be found here:
- How to create a client for the PLCnext Control gRPC server in C#
- Use gRPC to interface Python scripts with PLCnext Engineer Projects.
Since there is no gRPC client software installed on PLCnext Control devices as standard, this article shows how to run a gRPC client (in this case, grpcurl) in an OCI container using Podman and a suitable image from dockerhub.
Prerequisites
-
A PLCnext Control device (e.g. AXC F 3152), with firmware version 2025.0 or later, with internet access. Currently, the OCI image used in this article is not available for armv7 targets like the AXC F 2152.
-
In a browser, open the Web-based Management (WBM) site on the device and, on the System Services page, make sure the GRPC LOCAL SERVER feature is activated.
Procedure:
-
Open a secure shell session on the PLCnext Control device using the admin user account.
-
In the shell session, execute the following command:
podman pull docker.io/fullstorydev/grpcurl:latest-alpineThis downloads an OCI image containing the grpcurl command-line tool to the PLCnext Control device.
-
List the gRPC services available on the local PLCnext Control device:
podman run -it --rm -v /run/plcnext/:/run/plcnext/ --userns=keep-id docker.io/fullstorydev/grpcurl:latest-alpine --plaintext unix:///run/plcnext/grpc.sock listResponse:
Arp.Device.Interface.Services.Grpc.IDeviceControlService Arp.Device.Interface.Services.Grpc.IDeviceInfoService Arp.Device.Interface.Services.Grpc.IDeviceSettingsService Arp.Device.Interface.Services.Grpc.IDeviceStatusService Arp.Io.Axioline.Services.Grpc.IAcyclicCommunicationService Arp.Io.Axioline.Services.Grpc.IAxioMasterService Arp.Plc.Gds.Services.Grpc.IDataAccessService Arp.Plc.Gds.Services.Grpc.IForceService Arp.Plc.Gds.Services.Grpc.ISubscriptionService Arp.Services.DataLogger.Services.Grpc.IDataLoggerService2 Arp.Services.NotificationLogger.Services.Grpc.INotificationLoggerService Arp.System.Commons.Services.Io.Grpc.IDirectoryService Arp.System.Commons.Services.Io.Grpc.IFileService Arp.System.Commons.Services.Io.Grpc.IFileSystemInfoService Arp.System.Lm.Services.Grpc.ILicenseStatusService Arp.System.Nm.Services.Grpc.INotificationManagerService Arp.System.Security.Services.Grpc.IAuthenticationService Arp.System.Um.Services.Grpc.IAuthorizationInfoService Arp.System.Um.Services.Grpc.IPasswordAuthenticationService grpc.reflection.v1.ServerReflection grpc.reflection.v1alpha.ServerReflection -
(Optional) Create an alias to simplify subsequent grpcurl commands:
alias grpcurl="podman run -it --rm -v /run/plcnext/:/run/plcnext/ --userns=keep-id docker.io/fullstorydev/grpcurl:latest-alpine --plaintext unix:///run/plcnext/grpc.sock" -
Retrieve the board temperature from the PLCnext Control device:
grpcurl -format json -d '{"identifier":"Status.Board.Temperature.Centigrade"}' Arp.Device.Interface.Services.Grpc.IDeviceStatusService.GetItemResponse:
{ "_ReturnValue": { "TypeCode": "CT_Int8", "Int8Value": 46 } }
Leave a Reply
You must be logged in to post a comment.