I would be interested in implementing an S-Link interface in espHome. S-LINK or CTRL-A(II) is a two-wire bidirectional bus system mostly used in audio equipment (Sony), where many devices can be connected together.
This link provides some details of the S-Link protocol.
Robho has created an implementation of S-Link for arduino and esp8266.
My understanding is that to implement something similar in espHome external component(s) will be needed. Potentially two external components: one to send commands to the to the audio devices and one to receive information from the audio devices.
To send the commands to the audio devices I envision a component that behaves like espHome Remote Transmitted where the service can be called from Home Assistant passing the Hex code to transmit.
To receive the information from the audio devices I think two approaches are possible: either a text sensors that passes on to Home Assistant the Hex code received (to then be processed via templates) or individual sensors (device status, disk #, track number etc.).
My coding skills are quite limited and I’m looking for some guidance on what would be the easiest path to implement this.
First of all I’m looking for some advice if it would be best to do the whole implementation for the S-Link protocol in espHome (i.e. connect the S-Link bus directly to the esp8266 running espHOME with a circuit similar to the ones proposed by Robho here) or use an aurduino to run a slightly modified version of the sketch created by Robho and interface this with the esp8266 running espHome via UART. Which approach would you recommend?
In the documentation available regarding external components it is mentioned that the loop is called every 16ms and that the external component should not block for more than 10ms. Now in the S-Link protocol each message has a precursor of 3,000 micro seconds and each bit is 1,800 micro seconds if it is a 1 or 1,200 micro seconds if it is a 0. Now each command is 16 to 32 bits and the messages from the device can be up to 48 bit long. Therefore commands and messages on the S-Link protocol that are longer then 16ms.
Would this be a no-go for trying to implement this directly in an espHome external component and it is therefore better to implement this on a separate Arduino and relay the commands and messaged with the espHome esp8266 over UART?