I am connecting Home Assitant to my existing PLC using Modbus. I can sussefully configure a switch and connect it to a coil.
But now I have one coil (garage door) for which I do not want to toggle state (0/1) using a switch but just want to send a pulse to it using a button.
The goal: I have a button shown in Home Assistant. When I click on the button is sets the coil to “1” for a certain time period (e.g. 100ms) and then sets the coil back to “0”.
Can this be done in Home Assistant? Any pointers to where I can find documentation on how to do that?
You can use a script, and it will appear as a button on the interface.
An alternative is using a switch, and an automation that sets it to off after it has been turned on for 100ms.
The script aproach sounds good. In such a script I would need a function to write a coil. I was searching the documentations but could not find out how to write such a coil from a script. Could anyone point me in the right direction how I can write a Modbus coil from a script? Thanks.
My 2 cents…I have done this with function into the PLC. I use the switch in Hass to “set” or “reset” coils. This is pure a PLC configuration and as such easier to solve than with a script.
Let me know if you need more information on the PLC programming. I can look it up if you want.
I got also the Problem as I use a WAGO 750-841 for my whole house control… I use the Function “Stromstoss” on my Wago for all binary Lights and other stuff, as I use pushbuttons 24VDC to control evereything and know I would’nt programm any new PLC- Components on it for every application on my PLC…
@arnadan or @abmantis
you spoke of a script, where do I found information upon this?
sorry for using this old topic, but making a new one and clarifying, what i mean is surely not necessary.
I used this Code as described here to toggle a modbus coil (send a “1” to the WagoPLC - which itself in code resets this “1” in the register to “0”).
It works very well as described here, but i have several coils to use, so is there a possibility to parameterize an automation , so i only have to declare 20 buttons like:
input_boolean:
button1:
button2:
buttonX:
and in the automation it reacts to all these buttons, but “reads” the buttons number (as a parametre maybe) and depending on this it switches different coils (Adresses) of the modbus / wago?
So that i can prevent too much automation scripts…
Its hard to describe if english isn’t your foreign language