Toggle Switch

Hi all,

after some fiddling I got my Wago PLC integrated and working in HomeAssistant.
It has some digital in and outputs. The inputs are connected to physical wall switches. When pressed they set the input “high”. When released they go “low”. This is default behaviour. When a button is pressed I want to toggle a light switch. Depending on its state on or off. The status should be changed. e.g when off, button pressed, switch lights on and vice versa.

I managed to get it half working using an automation. When the corresponding entity is pressed it calls a toggle switch service. The last part seems to work. But I cannot get the input working correctly.

The input switch looks like this:

- name: DI 01-5
       unique_id: DI 01-5
       address: 4
       write_type: coil
       verify:
         input_type: coil
         state_on: 1
         state_off: 0

The output looks like this:

      unique_id: DI 01-1
      address: 0
      write_type: coil
      verify:
        input_type: coil
        state_on: 1
        state_off: 0

The automation config looks like this:

id: '1656433613119'
alias: Verlichting TV Zone Schakelen
description: ''
trigger:
  - platform: state
    entity_id:
      - switch.di_01_5
condition: []
action:
  - service: switch.toggle
    data: {}
    target:
      entity_id: switch.verlichting_tv_zone
mode: single

And as often asked, what am I missing/doing wrong?

Please reformat your text as its very diffcult to read. You can use 3 backticks at begin and end of each for the code blocks.

Wago make some awesome PLC’s.
Side note - Rather than using Modbus, you could use the native MQTT on the Wago.

https://www.youtube.com/watch?v=F7tVQ5xspAc&ab_channel=KurtBraun

Check out more of Kurt Braun’s videos as he does stuff with the PLC interfacing with Node Red, Raspberry pi’s, etc.

Hi atomic,

Thats not the wago plc I own. Mine is an older version 750-880.

Any suggestion on the button/switch?

Anyone any suggestions?

Questions you have probably asked and tested yourself -
Does the input show the correct state in home assistant when on and off?
Can you control the output coil from home assistant?
Should your input be a binary sensor not a coil?

It works. thnx for the suggestions. I still have a timing issue, see if I can work it out.