Python script is a method to interact with Your RasbperryPi device from other devices, webpage or smartphone
Python scripts libraries are open source and can be founded here . This files can be usefull if You plan to make inteaction with other then python scripts.
Adding new python device
Adding python device has to be done while RaspberryPi is conencted to your account, since instalation process python fiels are written into your RasbperryPi
This is easiest way to add your python devices. Before add python device for learning purpouse create some variables
This wizard will:
- generate initial sourcecode with function to interaction with system and other devices
- upload generated code with needed files into Your rasbperryPi
- restart raspberryProgram, to read new added python script
Choose burger menu, then Add External script with wizard
Similar like for code generation for ESP we choose variables for which code will be generated. More about variables here
Here we specified deviceName and deviceId, since python device is like any other device in remoteMe
Just click “Create Device”
after “Create device” the sourcecode is automaticly generated based on options we choosed and device is added into RPi. And RasbperryPi program is restarting to run new device
Our Device is connected, and run.
- program to run – it’s for more advanced users to pass some arguments to program or run something else then python script
- our files, we can edit python.py to add our code
- You can also edit python.py at your computer then drag it at this place it will be automaticly sent to RPi
- Most comfortable option of editing its creating FTP connection, then You can keep synchornizing FTP with your lcoal folder, and changes at local computer will be automaticly save at Your Rpi
code genrated by wizard, automaticly connect our python script into our RemoteMe account, and setup everything for us.
You can start playing with two generated functions:
One of them is callsed if variable is changed at the system, seconds allows You in easy way tos et new variable value.
Under the hood
Python scripts can be added from the app.remoteme.org and this is prefereable way of adding scripts ( since its also setting up configuration). Python scripts are manage by remoteme application itself. Python scripts are not communicate app.remoteme.org directly but are making socket connection ( port 2329 default can be cahgned in conf.json file ). All python devices are located in leafDevices directory, each device has own directory with deviceId as a name, it’s not recomendet to remove these directories, since chagnes in configuration is needed. To remove device do it from app.remoteme.org when RasbperryPi is connected with your account
All files visible at RemoteMe account in python belt are in ./leafDevcies/deviceId You can edit your files also there, but then remember to restart RpiProgram to read newest version of you program
Soon will be available more functions to interact with your python script.