Calling a python script and using the result as an variable?

I have several raspberry pies around my house for various purposes. Amongst others measuring the moisture of the soil in my (comming) cucumber plants. Because I barely know what I’m doing the easiest route for me to get the walue of the probe to IPS is to call a python script which came with the probe on the rPi, and get the result to IPS. But I can’t get the result to the variable in question. For now I’m content with running the script on the local Pie, bu eventually I’ll be wanting to un the script on another Pie in my home network.

I have tried:
$output = IPS_Execute („whoami“, „“, true, true);
SetValue (52245, $output);

which gets the correct result in the variable, but:
$output = IPS_Execute („python“, „/home/pi/“, false, true);
SetValue (52245, $output);

won’t give any result.

Is it possible to get what I want done?

I have tried searching the forum, but I can’t seem to find what I’m looking for, und meine deutsch ist nicht gut, leider :wink:



Search forum for „exec“ or „shell_exec“. There are some threads about this topic.
Essential thing - your python script has to „output“/echo the result to shell >> If you run your python script directly via ssh, the result must be shown in shell.

Another possibility is to call your python script from IPS, but pass your result(s) back to IPS via IPS-API (IPS Documentation - „Datenaustausch“) or via WebHook.

Kind regards,

I use JSON RPC, see thread
JSON-RPC über Python

Viele Danke:)

I thought I had it, but I just fooled myself… I got the python script to send the variable to IPS, but I still can’t call it from ips. I thought that going through tasker and autoremote om my android would help me, but alas, although I manage to call the script from the phone, I still cant make it do as I want from IPS. I guess it’s a basic error, but I cant get response through any of the exec/system/shell_exec/IPS_execute commands I have tried. : Banghead:

Do either of you have a noob-approach for me?