Toggle/Light switch with off delay, on/off state based on binary sensor

Hi All,

I have 8 toggle relays that switch lights and power sockets.
The relays have a contact that reports back if the light/wallsocket is on or off.
The relays are controlled through a piface digital 2
The contacts are read by the piface digital 2 inputs.
The hardware and Piface are setup and work within HA

I am looking for the code for a switch in HA to control these toggle relays and display the status of the toggle relay.

The switch should look like a HA standard switch on the dashboard:

  • On the Left side the symbol of a light or wallsocket, that changes its color (on or off) based on a binary switch

  • In the middle free text to give the switch a name

  • Right a push button, when pushed it switches an switch on for 0,5 second.

Who can help with generating code for this switch?