Hi
if you are using python you can execute a CLI command to check the state of ethernet
eth 1 status
Activation Status: Inactive
Connection Status: Disconnected
Link: 10Base-T Half-Duplex
Physical Port: ETH 0
MAC: 00 04 2D 02 54 FC
IP Address: 0.0.0.0
Mask: 255.255.255.0
Gateway: 0.0.0.0
then scrape the state
on the result set the io up or down
for ethernet port to go up and down you will needed to enable the "linkdeact" setting so when the cable is removed from ethernet the interface will go down