Read/set values with perl



  • Hello,

    has anyone more detailed tutorial for get and set values on unipi with perl?
    HTTP get and post no Problem for me , but i'm beginner in perl ,
    so it's really tricky to write functional code.
    thx
    Gerhard



  • Hello,

    has anyone more detailed tutorial for get and set values on unipi with perl?
    HTTP get and post no Problem for me , but i'm beginner in perl ,
    so it's really tricky to write functional code.
    thx
    Gerhard



  • Hello Gerthard,

    see the example at out github https://github.com/UniPiTechnology/evok ... ng-jsonrpc

    If you dig deeper in your perl applicaiton try using the websocket perl library and send us your code

    Best regards,
    Tomas



  • Hello Tomas,

    Thx for reply.
    I looked at github. I understand the json code.
    But when I want to switch more then one relay at the same time
    with while or for loop, only one relay change status.

    #!/usr/bin/perl -w
    use strict;
    use warnings;
    use JSON::RPC::Client;
    my $client = new JSON::RPC::Client;
    my $url = "http://<ip address and port from unipi>/rpc";

    $client->prepare($url, ["relay_set_for_time"]);
    for (my $i=1; $i<=4; $i++)
    {
    $client->relay_set_for_time($i, 1, 3600);
    }
    exit();

    thx for help
    regards Gerhard