If I try to run
modbus 192.168.X.Y:502 -s 0 REGISTER
I get a TimeoutError. Sniffing with wireshark revealed that modbus-cli was sending a slave-id of 255.
I belive that this line is responsible, as 0 is interpreted als falsy and gets replaced by 255.
A possible fix would be adding a default of 255 to the command line argument -s and dropping the check referenced above. This should not change the behaviour, unless 0 is explicitly set on the commandline