We built our house in 1999-2000 and I installed a PLC in the electrical cabinet (first an Omron C200HS and later an Omron CS1) to control the lights, blinds, some outlets, valves for heating etc.
Last year, I wrote a software gateway (called Omron2Mqtt) in Python for a 2-way communication between my old Omron CS1 PLC and Home Assistant, using a MQTT broker. This way, I can use Zigbee devices, tracker devices etc to interact with the PLC: Home Assistant can use everything from the PLC and can send data to the PLC. Now I have the best of 2 worlds: a very stable PLC as the heart of the installation and the ease of HA to couple with other things.
My setup: Omron PLC <-> my Omron2Mqtt gateway <-> Mqtt broker <-> Home Assistant
The software gateway does 2 things:
- it uses the Omron FINS protocol to communicate with the CS1 PLC and publishes the configuration data and the changes to the MQTT broker. In Home Assistant, all the topics coming from the PLC are integrated via automated MQTT discovery. Nothing in the yaml files.
- it subscribes to the topics (on the Mqtt Broker) the PLC needs to know and passes the data to the PLC, again using the FINS protocol.
In the communication with the PLC, I used the “Multiple memory area read” command. This is 1 command to read all the different bits, words in different memory areas. So it’s a very efficient way of communicating. Only the data that you need is send in the response. This way, you don’t have to put the data together in the PLC in successive memory words or bits.
To couple the right memory bits and words of the PLC to the MQTT topics the easy way, I use a config file. Here are some pieces of this file (note that the parameter interval isn’t used anymore):
PLC connection data + lights:
Binary sensors (for example the pir sensors):
The blinds:
In MQTT explorer it looks like this:
-
Configuration topics:
-
State topics:
The result (all items in the PLC on the Home Assistant dashboard):