I would like to do some simulation of the Raspberry's GPIO pins, e.g. for automated testing and developing the scripts on another host that is not the RPi.
Are there any existing tools/scripts(preferably in Python) available for that task?
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
I do not know of any in existence, but implementing a test version of RPi.GPIO should be fairly straightforward, especially if, as @joan's comments are alluding, you don't need special features (or can implement them only as you need them, over time).
If you develop a class called "Test.GPIO" with the same interface as RPi.GPIO, then you could do automated tests by changing "import RPi.GPIO as GPIO" to "import Test.GPIO as GPIO" in all your code.
The implementation of simple pin reads would require some class state variables. For writes you could implement some random number generator. If you ever get to events and edge detection, you'd have to implement some threading just like RPi.GPIO does.
Depending on your testing requirements, you might need to implement some kind of test script that will be used by the Test.GPIO library to ensure consistent behavior across test runs.
This would be a good opportunity for someone who wants sharpen up their python skills.
Don't know if this helps, but you can check as well the Python simulator at https://create.withcode.uk/ that includes the RPi.GPIO library and can be pretty helpful when debugging code. It also includes a GPIO pinout board where you can see how the voltage changes on the selected pins.