Goodmorning everyone.
I’m new to HA and I’m passionate about it.
Currently I have home automation controlled by a raspberry with codesys
and with 2 controllino.biz for the ignitions and various other operations.
Everything works perfectly.
The two controllino.biz them control via modbus tcp
Now I would like to pair HA to create the same automations and to understand whether to migrate definitively to HA.
I started with the modbus tcp protocol on HA.
I only control the lights by using an entity button to press twice to turn a lamp on and off and the lamp status is not displayed correctly.
I am attaching the part of the configuration code hoping for help.
In my case I use function block diagram (FBD) programs on my Micro PLC’s.
The ‘switch’ is toggled by HA toggling a digital flag. The result of that state change has caused my modbus switch to turn on OR off.
To read that state I use another digital flag to read that switch state.
That digital flag is the one that reports the switch state back to HA.
ok, so in a few words you tell me that I should always keep the plc management (in my case codesys) working and add HA in parallel?
But what if I just wanted HA?
Pretty much…I try to use HA as my monitoring device and program my PLC to do the nuts and bolts stuff. For devices which are not able to have their own program then HA takes on that role.
For your use then it’s up to you how you setup your system of course.
Good morning,
I’m back on the subject because I can’t understand how to visualize the status of an on / off button.
Every time I press the button the light turns on and for a moment the button is yellow but soon after Phrygian returns but the light stays on. If I press the button again the light is turned off and the yellow button returns to gray.
I use bistable relays and I get the relay status from a second contact that enters the plc from an input.
So if the input status is high the lamp is on and if it is low the lamp is off.
In HA I entered a register that at the push of a button writes the value on the Modbus to turn on the light.
I then added a switch that reads the value of its input
coils:
- name: Test
hub: maxi
slave: 1
coil: 1
So in HA I have a button and a switch and I see that those work correctly!
When I press the button, which writes in the modbus register, shortly after I see the switch turned on and permanent, if we repeat the button the switch goes off.
How can I create a code that shows the light status in one button?
I try to rephrase the question because I just can’t do what I would like … maybe impossible?
Then I have relays controlled via modbus.
The modbus command controls bistable relays.
The relays have 4 contacts
two contacts are used to switch on the lamp, the other two are used to know the status of the lamp ignition.
The lamp ignition status enters an input that reads the status.
If high the lamp is on if low is off.
In the home assistant I inserted a switch that turns on a lamp and a sensor that reads the status.
I would like the pressure of the switch in HA to illuminate the icon and remain so, but when I press the button the light turns on but the status of the icon after a short time goes off while the light is on.
While the icon of the state that controls the status remains on.
How can I do everything with a button?
I think, I say I think I understand what you mean.
If so, as I think I understand, but I use a step by step relay then the plc output does not remain high.
In fact modbus goes high with an impulse and the relay exchanges (on) then returns to zero, another impulse exchanges (off) and returns to zero.
The digital output is what would actually turn the light on or off in your setup (ie: your plc relay)
The Flag F14 which is configured as a binary sensor entity is giving you the on or off status of your light.
However I would always have a button (switch in HA) that turns on but the display would always be through another component (sensor in HA)
I would need the switch to do its duty but its icon would show the status of the sensor !!
I’ve been going around this thing for weeks and now I think it’s not possible with HA.
Too bad I’d miss only that to start replacing codesys with HA.
He has so many things that make me gorge but if I can’t do this for me it’s just, unfortunately, a waste of time.
The modbus implementation in HA is possibly not as ‘mature’ as other platforms such as MQTT say but I for one find it is reliable and I can live within its limitations.
HA has so many other benefits once you get it nutted out I would encourage you to try to live with some minor limitations.
I moved from a so called ‘professional’ SCADA product which had absolutely nothing on this fantastic product which by the way is still in beta state. Chin up keep plugging away!
PS: have you looked at node-red? It has some pretty nifty modbus Contrib’s which may be what you are looking for?
@alverman As an illustration here is a way I have learned to live with the limitations and at the end of the day (for me anyway) the solution seems to be more logical…?
In the case of my Grey Water Sump (my Control Panel).
The logic starts from the bottom working upwards to the pump icon:
I can set a limit on how many times I want the pump to run (the program resets it every 6 hours)
Then I can read the current runcount setpoint
If I wish and runcount trips I can reset it
Then I can see if other systems are not ready to receive grey water (inhibit on or off)
See if the runcount is tripped or not
HA Switch here Turn the system from Off to Auto NOTE: this is not a toggle switch. For process reasons I want the system to not restart if I lose power. It restarts in Off position.
HA binary sensor here Read that the system status is Auto or is Off (it is presently On so is Auto)
Thanks Wellsy for your interest
Actually I don’t want to abandon HA also because making small changes in codesys involves different problems.
While in HA it is simpler and more immediate.
Actually I also thought of node red, I installed it but at the moment it doesn’t work for me.
I’ll be in the tests because actually HA satisfies me 99%.
That little 1% is only given by my need to have a button that enables the icon based on a state.
I am confident: D
Cool…post your problems you are having (on a new post) with node-red and/or look up the videos on youtube which got me up and running easy enough. For my needs I have shut down node-red as I am looking more towards keeping everything running on HA alone.