Help developing a hub based on Baytech RPC3 and MQTT integration


I need some help to develop a new component,
It’s for a Baytech RPC3-NC, basically a PDU with 8 outlets and some sensors (temperature, current and voltage).
It support remote access via telnet, and it’s possible to turn ON or OFF each outlet and also collect the different stats.

My idea is to built around MQTT to provide a SWITCH for each outlet and the different SENSORs for each stats available.

I have the basic logic to collect stats and turn on/off each outlet, and I was able to implement the basic SWITCH part (but not via MQTT).

Now, there is a limitation with the RPC3-NC, it only allows one telnet session at a time.
Which mean the telnet connection should be management by the main component.

My challenges are the following,
#1 - Send update status every 5/10s:
How could I have my main component to send an update of each sensor and switch state on a frequent basis ?
Because of the telnet limitation, I was thinking to have my main component to telnet to the RPC3-NC and collect the status, then send via MQTT the update.

#2 - Receive via MQTT the order to turn On/Off the outlet:
How could I fire an action based on the message sent via MQTT ?

If you have any code reference I could look at, that would be great.
If I should go with a different approach, I would take the recommendations.

Hello, I have the same pdu, I controlled it via blynk cloud, now I’m trying to migrate everything to HA, can you please share your code as well. Thank you Pavel

Has anyone been successful doing this?