Ethernet Relays

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Ethernet Relays

Zaaphod
Does anyone have any advice on how to get started sending commands from FPC to use these ethernet relays:

https://www.amazon.com/gp/product/B076CNJNFH


Default IP :192.168.1.4       prot:30000        http://192.168.1.4/30000 

HTTP Comment:
http://192.168.1.4/30000/00 : Relay-01 OFF
http://192.168.1.4/30000/01 : Relay-01 ON
http://192.168.1.4/30000/02 : Relay-02 OFF
http://192.168.1.4/30000/03 : Relay-02 ON
http://192.168.1.4/30000/04 : Relay-03 OFF
http://192.168.1.4/30000/05 : Relay-03 ON
...
http://192.168.1.4/30000/14 : Relay-8 OFF
http://192.168.1.4/30000/15 : Relay-8 ON
http://192.168.1.4/30000/41 : Enter
http://192.168.1.4/30000/40 : Exit
http://192.168.1.4/30000/42 : Next Page
http://192.168.1.4/30000/43 : Next Page

I don't really know what I even need to do to send commands like that over the network.  Of course I can get it to work just typing the commands from a browser but that's not what I want, I want my FPC console program to send the appropriate commands whenever I want one of the relays to come on or go off.

Any suggestions on how this might be accomplished?

James

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Ethernet Relays

Free Pascal - General mailing list
Hello James,

You'll find a source of happiness with unit fphttpclient .
Particularily with the simplget function:

TFPHTTPCLIENT.SIMPLEGET('http://192.168.1.4/30000/00')

It is said that it works with https also, but under the Mageia7 distro, you probably encounter problems I
haven't yet solved. But for http, that should be right.

Cheers, Ched




Le 24.05.20 à 18:46, James Richters a écrit :

> Does anyone have any advice on how to get started sending commands from FPC to use these ethernet relays:
>
> https://www.amazon.com/gp/product/B076CNJNFH
>
>
> Default IP :192.168.1.4       prot:30000        http://192.168.1.4/30000
>
> HTTP Comment:
> http://192.168.1.4/30000/00 : Relay-01 OFF
> http://192.168.1.4/30000/01 : Relay-01 ON
> http://192.168.1.4/30000/02 : Relay-02 OFF
> http://192.168.1.4/30000/03 : Relay-02 ON
> http://192.168.1.4/30000/04 : Relay-03 OFF
> http://192.168.1.4/30000/05 : Relay-03 ON
> ...
> http://192.168.1.4/30000/14 : Relay-8 OFF
> http://192.168.1.4/30000/15 : Relay-8 ON
> http://192.168.1.4/30000/41 : Enter
> http://192.168.1.4/30000/40 : Exit
> http://192.168.1.4/30000/42 : Next Page
> http://192.168.1.4/30000/43 : Next Page
>
> I don't really know what I even need to do to send commands like that over the network.  Of course I can get it to work just typing the commands from a browser but that's not what I want, I want my FPC console program to send the appropriate commands whenever I want one of the relays to come on or go off.
>
> Any suggestions on how this might be accomplished?
>
> James
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Ethernet Relays

Zaaphod
Thanks!!  
I'm happy with http, I should have mentioned I'm on Windows 10, any issues with that unit under windows?  

James

-----Original Message-----
From: fpc-pascal <[hidden email]> On Behalf Of Ched via fpc-pascal
Sent: Sunday, May 24, 2020 3:02 PM
To: [hidden email]
Cc: Ched <[hidden email]>
Subject: Re: [fpc-pascal] Ethernet Relays

Hello James,

You'll find a source of happiness with unit fphttpclient .
Particularily with the simplget function:

TFPHTTPCLIENT.SIMPLEGET('http://192.168.1.4/30000/00')

It is said that it works with https also, but under the Mageia7 distro, you probably encounter problems I haven't yet solved. But for http, that should be right.

Cheers, Ched




Le 24.05.20 à 18:46, James Richters a écrit :

> Does anyone have any advice on how to get started sending commands from FPC to use these ethernet relays:
>
> https://www.amazon.com/gp/product/B076CNJNFH
>
>
> Default IP :192.168.1.4       prot:30000        http://192.168.1.4/30000
>
> HTTP Comment:
> http://192.168.1.4/30000/00 : Relay-01 OFF
> http://192.168.1.4/30000/01 : Relay-01 ON
> http://192.168.1.4/30000/02 : Relay-02 OFF
> http://192.168.1.4/30000/03 : Relay-02 ON
> http://192.168.1.4/30000/04 : Relay-03 OFF
> http://192.168.1.4/30000/05 : Relay-03 ON ...
> http://192.168.1.4/30000/14 : Relay-8 OFF
> http://192.168.1.4/30000/15 : Relay-8 ON
> http://192.168.1.4/30000/41 : Enter
> http://192.168.1.4/30000/40 : Exit
> http://192.168.1.4/30000/42 : Next Page
> http://192.168.1.4/30000/43 : Next Page
>
> I don't really know what I even need to do to send commands like that over the network.  Of course I can get it to work just typing the commands from a browser but that's not what I want, I want my FPC console program to send the appropriate commands whenever I want one of the relays to come on or go off.
>
> Any suggestions on how this might be accomplished?
>
> James
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

_______________________________________________
fpc-pascal maillist  -  [hidden email] https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Ethernet Relays

Zaaphod
I got this working, thanks for the advice Ched,

Here's my test program:
uses  fphttpclient;
Begin
TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/01');
TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/03');
TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/05');
TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/07');
TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/43');
TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/09');
TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/11');
TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/13');
TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/15');
End.

I have to give it a command to go the next page for some reason or relays 5-8 won't work... so now I'm wondering if there is a way I can retrieve the data that is normally displayed in my browser to I can see what page number I'm on,  I could also then check the status of the relays as well by analyzing what I read.

James

-----Original Message-----
From: fpc-pascal <[hidden email]> On Behalf Of James Richters
Sent: Sunday, May 24, 2020 3:41 PM
To: 'FPC-Pascal users discussions' <[hidden email]>
Cc: 'Ched' <[hidden email]>
Subject: Re: [fpc-pascal] Ethernet Relays

Thanks!!  
I'm happy with http, I should have mentioned I'm on Windows 10, any issues with that unit under windows?  

James

-----Original Message-----
From: fpc-pascal <[hidden email]> On Behalf Of Ched via fpc-pascal
Sent: Sunday, May 24, 2020 3:02 PM
To: [hidden email]
Cc: Ched <[hidden email]>
Subject: Re: [fpc-pascal] Ethernet Relays

Hello James,

You'll find a source of happiness with unit fphttpclient .
Particularily with the simplget function:

TFPHTTPCLIENT.SIMPLEGET('http://192.168.1.4/30000/00')

It is said that it works with https also, but under the Mageia7 distro, you probably encounter problems I haven't yet solved. But for http, that should be right.

Cheers, Ched




Le 24.05.20 à 18:46, James Richters a écrit :

> Does anyone have any advice on how to get started sending commands from FPC to use these ethernet relays:
>
> https://www.amazon.com/gp/product/B076CNJNFH
>
>
> Default IP :192.168.1.4       prot:30000        http://192.168.1.4/30000
>
> HTTP Comment:
> http://192.168.1.4/30000/00 : Relay-01 OFF
> http://192.168.1.4/30000/01 : Relay-01 ON
> http://192.168.1.4/30000/02 : Relay-02 OFF
> http://192.168.1.4/30000/03 : Relay-02 ON
> http://192.168.1.4/30000/04 : Relay-03 OFF
> http://192.168.1.4/30000/05 : Relay-03 ON ...
> http://192.168.1.4/30000/14 : Relay-8 OFF
> http://192.168.1.4/30000/15 : Relay-8 ON
> http://192.168.1.4/30000/41 : Enter
> http://192.168.1.4/30000/40 : Exit
> http://192.168.1.4/30000/42 : Next Page
> http://192.168.1.4/30000/43 : Next Page
>
> I don't really know what I even need to do to send commands like that over the network.  Of course I can get it to work just typing the commands from a browser but that's not what I want, I want my FPC console program to send the appropriate commands whenever I want one of the relays to come on or go off.
>
> Any suggestions on how this might be accomplished?
>
> James
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

_______________________________________________
fpc-pascal maillist  -  [hidden email] https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email] https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Ethernet Relays

Michael Van Canneyt


On Sun, 24 May 2020, James Richters wrote:

> I got this working, thanks for the advice Ched,
>
> Here's my test program:
> uses  fphttpclient;
> Begin
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/01');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/03');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/05');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/07');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/43');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/09');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/11');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/13');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/15');
> End.
>
> I have to give it a command to go the next page for some reason or relays
> 5-8 won't work...  so now I'm wondering if there is a way I can retrieve
> the data that is normally displayed in my browser to I can see what page
> number I'm on,  I could also then check the status of the relays as well
> by analyzing what I read.

Simpleget is a function that returns the page:

S:=TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/15');

S will contain the page of HTML.

If you need to send a command, you'll probably need to use SimplePost()

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Ethernet Relays

Zaaphod
Thanks!

Is there some convenient way to get the HTML into a Tstringlist?

James

-----Original Message-----
From: fpc-pascal <[hidden email]> On Behalf Of Michael Van Canneyt
Sent: Monday, May 25, 2020 4:47 AM
To: [hidden email]; FPC-Pascal users discussions <[hidden email]>
Cc: 'Ched' <[hidden email]>
Subject: Re: [fpc-pascal] Ethernet Relays



On Sun, 24 May 2020, James Richters wrote:

> I got this working, thanks for the advice Ched,
>
> Here's my test program:
> uses  fphttpclient;
> Begin
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/01');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/03');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/05');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/07');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/43');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/09');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/11');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/13');
> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/15');
> End.
>
> I have to give it a command to go the next page for some reason or
> relays
> 5-8 won't work...  so now I'm wondering if there is a way I can
> retrieve the data that is normally displayed in my browser to I can
> see what page number I'm on,  I could also then check the status of
> the relays as well by analyzing what I read.

Simpleget is a function that returns the page:

S:=TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/15');

S will contain the page of HTML.

If you need to send a command, you'll probably need to use SimplePost()

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email] https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Ethernet Relays

Michael Van Canneyt


On Mon, 25 May 2020, James Richters wrote:

> Thanks!
>
> Is there some convenient way to get the HTML into a Tstringlist?

Yes. Simpleget is overloaded to accept a tstrings:

L:=TstringList.Create;
try
    TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/01',L);
finally
   L.Free;
end;

Michael.

>
> James
>
> -----Original Message-----
> From: fpc-pascal <[hidden email]> On Behalf Of Michael Van Canneyt
> Sent: Monday, May 25, 2020 4:47 AM
> To: [hidden email]; FPC-Pascal users discussions <[hidden email]>
> Cc: 'Ched' <[hidden email]>
> Subject: Re: [fpc-pascal] Ethernet Relays
>
>
>
> On Sun, 24 May 2020, James Richters wrote:
>
>> I got this working, thanks for the advice Ched,
>>
>> Here's my test program:
>> uses  fphttpclient;
>> Begin
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/01');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/03');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/05');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/07');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/43');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/09');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/11');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/13');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/15');
>> End.
>>
>> I have to give it a command to go the next page for some reason or
>> relays
>> 5-8 won't work...  so now I'm wondering if there is a way I can
>> retrieve the data that is normally displayed in my browser to I can
>> see what page number I'm on,  I could also then check the status of
>> the relays as well by analyzing what I read.
>
> Simpleget is a function that returns the page:
>
> S:=TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/15');
>
> S will contain the page of HTML.
>
> If you need to send a command, you'll probably need to use SimplePost()
>
> Michael.
> _______________________________________________
> fpc-pascal maillist  -  [hidden email] https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Ethernet Relays

Zaaphod
Thank you Michael, I would have really overcomplicated that, glad I asked

James

-----Original Message-----
From: fpc-pascal <[hidden email]> On Behalf Of Michael Van Canneyt
Sent: Monday, May 25, 2020 6:54 AM
To: [hidden email]; FPC-Pascal users discussions <[hidden email]>
Subject: Re: [fpc-pascal] Ethernet Relays



On Mon, 25 May 2020, James Richters wrote:

> Thanks!
>
> Is there some convenient way to get the HTML into a Tstringlist?

Yes. Simpleget is overloaded to accept a tstrings:

L:=TstringList.Create;
try
    TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/01',L);
finally
   L.Free;
end;

Michael.

>
> James
>
> -----Original Message-----
> From: fpc-pascal <[hidden email]> On Behalf
> Of Michael Van Canneyt
> Sent: Monday, May 25, 2020 4:47 AM
> To: [hidden email]; FPC-Pascal users discussions
> <[hidden email]>
> Cc: 'Ched' <[hidden email]>
> Subject: Re: [fpc-pascal] Ethernet Relays
>
>
>
> On Sun, 24 May 2020, James Richters wrote:
>
>> I got this working, thanks for the advice Ched,
>>
>> Here's my test program:
>> uses  fphttpclient;
>> Begin
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/01');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/03');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/05');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/07');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/43');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/09');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/11');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/13');
>> TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/15');
>> End.
>>
>> I have to give it a command to go the next page for some reason or
>> relays
>> 5-8 won't work...  so now I'm wondering if there is a way I can
>> retrieve the data that is normally displayed in my browser to I can
>> see what page number I'm on,  I could also then check the status of
>> the relays as well by analyzing what I read.
>
> Simpleget is a function that returns the page:
>
> S:=TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/15');
>
> S will contain the page of HTML.
>
> If you need to send a command, you'll probably need to use
> SimplePost()
>
> Michael.
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email] https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal