Network volume control


I’m unsure if I can do this, am I able to use ESPHome with a Espressif ESP32 Ethernet GPIO’s connected to a ULN2803a to both control and read the state of six DPDT relays that I will use to create a volume control, for example I want to set GPIO’s 1-6 in a specific sequence to create a certain percentage volume, say its 1-on, 2-off, 3-off, 4-off, 5-on & 6-off, so that sets a specific volume but I also want to read those same six GPIO’s (100010) to work out the volume?

This shows the wiring of a relay based resistor network:

Basically I want to use HASS to control my Roon music systems volume.