S7Client
Hi-Level API for node-snap7 to communicate with Siemens S7 PCLs (See compatibility).
- Promise based,
async/await
support - Returns javascript objects with parsed var objects
- EventEmitter: (
connect
,disconnect
,connect_error
,value
) - Optional auto reconnect
Blog post about my SIMATIC S7 Web HMI project.
Usage
npm install s7client
const S7Client = ; // PLC Connection Settingsconst plcSettings = name: "LocalPLC" host: 'localhost' port: 9102 rack: 0 slot: 2; // DBA to readlet dbNr = 1;let dbVars = type: "CHAR" start: 0 type: "BOOL" start: 2 bit: 0 type: 'INT' start: 3 ; let client = plcSettings;client; { await client; // Read DB const res = await client; console; // Write multiple Vars await client; client;};
Special thanks to
- Davide Nardella for creating snap7
- Mathias Küsel for creating node-snap7
License & copyright
- S7Client: MIT
- node-snap7: MIT
- snap7: LGPLv3