Control Raspberrypi board with ssh and python
Project description
Raspberry Pi controller
Feature
- Connect in ssh to the Raspberry Pi
- Module and Global call are supported
- The function can be run on the Raspberry Pi by calling
@raspberry_control.raspberry_command()
and get the result - Get Output of a function that was run on the raspberry
- Real-time output
- Run command on the Raspberry Pi with
raspberry_control.run_command("command here")
- You can do
@raspberrypi.timeout(time,default)
that will make the function stop after the time specified and stop if it's not finish
Example
import raspberrypi_control # import package for raspberrypi controlling over ssh
import os # Put import here they are take and install to the raspberrypi file.
import time
rp = raspberrypi_control # rp is for RaspBerryPi
i = 1234567890
@rp.raspberry_command() # run code and you're raspberrypi. If the raspberrypi was not find it's will be run in local.
def test():
print("Hello RaspBerryPi")
return "finished"
@rp.raspberry_command() # run code and you're raspberrypi. If the raspberrypi was not find it's will be run in local
def other():
global i
print("Hello RaspBerryPi h")
th = 0
print(i)
os.system("echo Hello World")
while True:
th = th + 1
if th == 30:
time.sleep(0.1)
break
return th
if __name__ == "__main__": # put all you're code to run at start here. Because if not the code will be run 2 time
rp.raspberrypi().set_preparation("192.168.0.10", 8, 1) # config locator for the raspberrypi
rp.raspberrypi().local("192.168.0.10") # set the start ip set in the line in the top
rp.config("main") # file name if this file (no .py)
print(test())
print(other()) # you can get the output after
How to install the package
Do pip install raspberry-control
Supported for python 3.10 and higher*
*note not tested for lower version
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
raspberrypi_control-2.0.3.tar.gz
(16.7 kB
view hashes)
Built Distribution
Close
Hashes for raspberrypi_control-2.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52621ebb43e548e2d1293c03dfe92f5ddfe56af24005654c41e4ce8aea521a66 |
|
MD5 | 219ac6a58ad56d6a83cb9199f1b94731 |
|
BLAKE2b-256 | 853355b785ede062abef62a3f9e8be31aff106c0a4b933a5d7ddb849a16588d5 |
Close
Hashes for raspberrypi_control-2.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3d6e841f5c2c8885711ebc8ce290f7f738c348ed0de7c9233328cfc404fbc07 |
|
MD5 | df45662f52456ed6fae890798cb99b50 |
|
BLAKE2b-256 | 11ee394caac375142dd80f82038008b2cdd116eae49fb910faca94d3f41527b3 |