I am trying to create a button in Vision to force a redundancy fail over. I intend it to work like the button in the gateway webpage.
I have found this post:
and also I have found this on Ignition Exchange which use the same lines of code:
But the code doesn't work for me. when I launch the function via script console, I receive an error.
Either this one:
Traceback (most recent call last):
File "<input>", line 1, in
File "<module:diagnostics>", line 33, in requestFailover
ImportError: cannot import name IgnitionGateway
Or this one:
Traceback (most recent call last):
File "<input>", line 1, in
File "<module:diagnostics>", line 33, in requestFailover
ImportError: No module named redundancy
Print would never show in the gateway web interface's logs. If executed in gateway scope, a print may show up in the wrapper log. But Vision client scripts would print to the vision client's diagnostic console, not the gateway, because they aren't gateway scope. These scripts will never work directly in a Vision button. You need to send a message to a gateway message handler and have that handler execute these operations.