Node-Red + plc siemens toggle hassio

Good morning, I have managed to configure my Node-Network with my plc S7-300 I have done it by configuring several input_boolean associated with the input of the plc with a tigger of 250ms. Everything works fine but in hassio it is not displayed correctly since the switch goes from on to off regardless of whether the light is on or off.

I think the correct way to do it is to take into account the output of the plc so that the state of the switch corresponds to the light, but I do not know how to do it.