How do I set up separate control pins for the relay?

I damaged the zigbee chip, but the ability to control the relay remains. The relay changes state when a high signal is applied to a certain contact
image

I didn’t find any relevant information on the documentation page(gpio switch). The most appropriate thing is to create 4 momentary switch.

But how to properly combine them into a stateful switch? Or are there more elegant solutions?

Esphome and zigbee?

Post which device you have.

I plan to connect the esp8266 (with esphome), instead of the broken jn5169.

Use the momentary switch example in the GPIO switch documentation: