I have to control 3 105A three phase burners. Im using Shelly 1 Pros connected to a 150A contactor (just for details here and yes It is being certified by a licensed electrical engineer)
I have 3 input bools lets call them B1,B2,+B3 and these are in the frontend as buttons using call_service: input_bool: toggle. These 3 bools have device automations that control 3 Shelly 1Pro devices. Lets call them P1 P2 + P3.
I need to make a way of locking out the ability to press one of the three input bools if any of 2 the Shellys have states as ON. The locked out bool MUST be the bool for the DEVICE (shelly) that is NOT ON. The states of the bools MUST be derived from the Shellys specifically.
Its doing my head in that the state of an input_bool cant be derived from a device.
This assumes your switch entity id’s are switch.p1, switch.p2, switch.p3
There’s a bit going on here, so unpacking it:
The trigger occurs on any state change of any of the listed input_booleans. Because of the null to: it ignores attribute changes.
The first choose action tests if the input boolean that triggered the automation changed to on or off. If it was ‘off’ then switch off the corresponding switch, and that is all.
If the triggering input boolean changed to ‘on’, then test if there are already 2 input booleans on. If there are less than 2 input booleans on, then switch on the corresponding switch. If there are 2 or more input booleans already on, then turn off the triggering input boolean right away.
This is untested and going on my past experience is likely to contain errors.
Can I just ask if you need to have these 3 contactors interlocked, have you also done this physically with wiring? It’s simple to do and will ensure that you aren’t just relying on code to provide your interlock.
Hey thanks to @tom_l. His insight was the seed for achieving this. After playing with his template what I was trying to achieve got way too convoluted. In the end I didnt use the jinja code - i simplified it by using groups and a bunch of input booleans as inhibits of the elements that could not be active and then use the restriction card to restrict the selection of the elements that cant be used based on the states of the inhibits.
There are physical inhibits as mandated by the Electrical Engineer for safety - However I needed inhibits within HA as well so that the physical ones dont get activated (as they are a manual/physical reset) if they are ever triggered.