python-broadlink icon indicating copy to clipboard operation
python-broadlink copied to clipboard

Control RM3 from webserver

Open bmscenter opened this issue 4 years ago • 13 comments

Hello,

Does anyone know how to achieve website control with our rm3 controller ??

I have apache, php and no have idea how to achieve it.

Please help

bmscenter avatar Feb 03 '21 22:02 bmscenter

This is a Python library, not a PHP library. I would recommend installing Home Assistant instead.

KTibow avatar Feb 03 '21 23:02 KTibow

Thank you for your answer. I know this is a python library, but I would still like to script it over http anyway. I already have a smart home at home and the only communication with it is through http requests. I tried to execute the script using shell exec, but I don't know what the full syntax should look like then.

bmscenter avatar Feb 04 '21 07:02 bmscenter

I already have a smart home at home and the only communication with it is through http requests.

Could you elaborate? Personally I really like Home Assistant, and I would recommend you move to it.

KTibow avatar Feb 04 '21 15:02 KTibow

I have a Polish GRENTON system and an HTTP module.

bmscenter avatar Feb 04 '21 15:02 bmscenter

I tried to execute the script using shell exec, but I don't know what the full syntax should look like then.

What's the example that didn't work?

KTibow avatar Feb 04 '21 15:02 KTibow

exec('bash /home/pi/rm3/python-broadlink/cli/broadlink_cli --type 0x2737 --host 192.168.0.190 --mac 34ea34429fda --send @BED-TV.power');

I've got problem with good syntax

bmscenter avatar Feb 04 '21 17:02 bmscenter

So does it work when you execute it in the command line? Specific error messages?

KTibow avatar Feb 04 '21 20:02 KTibow

Now i have code like this

<?php
    $command = escapeshellcmd('python3 /home/pi/rm3/python-broadlink/cli/broadlink_cli --type 0x2737 --host 192.168.0.190 --mac 34ea34429fda --send @BED-TV.power');
    $output = exec($command);
    echo $output;
?>

The command works because I added print test to the script. However, unfortunately, it does not accept any parameters.

bmscenter avatar Feb 05 '21 12:02 bmscenter

However, unfortunately, it does not accept any parameters.

What do you mean?

KTibow avatar Feb 05 '21 14:02 KTibow

It runs the script but takes no arguments, nothing happens. When I run a query on the command line, it works fine.

bmscenter avatar Feb 05 '21 17:02 bmscenter

I don't know a lot about PHP; maybe if they have an official forum, you can ask for help there, and close this issue.

KTibow avatar Feb 06 '21 18:02 KTibow

Is the apache running at local network?

Consider reading parameters from $_GET or $_POST.

<?php echo $_GET['param_name']; ?>

That is how php handle them. It doesn't have anything do with this library.

w35l3y avatar Mar 23 '21 03:03 w35l3y

Possibly related to https://github.com/mjg59/python-broadlink/issues/194?

felipediel avatar Oct 18 '21 18:10 felipediel