1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Ethernet Relay: PHP or Python Script

Discussion in 'Relay Modules' started by Lox, Feb 5, 2017.

  1. Lox

    Lox New Member

    Joined:
    Feb 5, 2017
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Location:
    Germany
    Hi Numato-Team,

    can you provide a example script in php (best) or python (also ok) on how to get logged in and at least one command (like open/read Relay 1) over TELNET? All i tried so far just failed at the login (i managed to connect via php-script using "fsockopen()" but only got to the point where password is asked).

    I just got the 32-Channel-Ethernet-Relay (http://numato.com/32-channel-ethernet-relay-module/) and was hoping for an easy way to implement in my whole php-based system like using simple http-Get requests incl the username/pass and a command like the user here asked: https://community.numato.com/thread...-to-activate-a-relay-with-an-html-request.81/

    Web interface and normal connection via TELNET-Client (used Putty) works great and fast with the board. But i need to implement all in my system.

    Hoping for good news.
    Best regards,
    Lox
     
  2. Lox

    Lox New Member

    Joined:
    Feb 5, 2017
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Location:
    Germany
    Hi Numato-Team,

    good news. I just managed to build a small python-script, that is working with the basics to login and open a relay via telnet. Problem with my first attempt was, that i missed to send the commands as ".encode("ascii")". As soon as i got some time, i will recreate the code with some comments and provide it to you. Maybe you want to put it on your downloadsection/git. Guess there are some more people looking for that.

    Best Regards,
    Lox
     

Share This Page