Skip to content

Connect Siemens S7 to Mqtt with Homeassistant discovery support

License

Notifications You must be signed in to change notification settings

dixi83/mqtt-s7-connector

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MQTT-S7-Connector

GitHub Release License

MQTT-S7-Connector connects a Siemens S7 PLC over MQTT with Home Assistant

This project is intended to use it along with Home Assistant, but is also possible to use it as a simple bridge between a S7 PLC and a MQTT broker.

⚠️ This project is still in an early stage of development and relies on your support.

Features

  • Optimized PLC DB reads using NodeS7
  • Publishing PLC values to MQTT
  • Writing MQTT values back to PLC-DBs
  • Generate and publish Home Assistant discovery messages for devices/entities.

Installation

This is just a plain Node.js App and should run with the latest LTS version of Node.js so you can invoke

npm ci
node index.js

to run the app.

Home Assistant Addon

The MQTT-S7-Connector is available as native Home Assistant Addon: https://github.com/dixi83/hassio-addons/tree/main/mqtt-s7-connector

Docker

There are docker-builds of the MQTT-S7-Connector published to ghcr.

docker run -d -v $PWD/config.yaml:/app/config.yaml ghcr.io/dixi83/mqtt-s7-connector --loglevel 2

Note: You only have to mount the configuration file, not the entire folder.

Or use docker-compose.yaml:

  mqtt-s7-connector:
    image: ghcr.io/dixi83/mqtt-s7-connector
    container_name: mqtt-s7-connector
    command: [ "--loglevel", "2" ]
    volumes:
      - ./config.yaml:/app/config.yaml
    restart: unless-stopped

Configuration

CLI-Arguments

Option Shorthand Description
--config -c Overwrite the default config.yaml file location.
--addonversion -v Set the version for the "origin" section of the discovery topic.
--loglevel -l Sets the log level (0: Trace, 1: Debug, 2: Info, 3: Notice, 4: Warning (default), 5: Error, 6: Fatal).

Config-File

Most of the configurations are done using a config file. See Configuration file documentation for detailed instructions.

Implemented entity-types:

Credits

License

Licensed under ISC

About

Connect Siemens S7 to Mqtt with Homeassistant discovery support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.7%
  • Other 1.3%