Topic-icon xPhcExtc, send commands over EXT interface to a PHC system

Mehr
15 Aug 2015 01:39 - 17 Aug 2015 22:30 #1 von simonjo
Hallo,

Maybe it can be handy to send commands to STMv1/v2/v3 from the command line, instead of using the xWRC/xiControl webserver.

I therefor created a new xphcextc application which runs no RaspBerry PI, this does the same but with some enhancements.

It does not require any license, so it always works in FULL mode.

To install, just unzip attached file to a directory on Raspi, make sure the file xphcextc.raspi has execute rights.

Now type "./xphcextc.raspi -?" to get below help on how to use this tool:

>>>
xPhcExtc (Linux/RbPI)
v4.0.0.0, Aug 14 2015, Jo Simons (c) 2005-2015
+ =============================================================================
+ Syntax: xphcextc *[<option>] "<ccmd>" *[<option> | "<ccmd>"]
+ Send commands over EXT interface to a PHC system
+
+ Option:
+ -?, --help display help info
+ --ini <file> read configuration from <file>, no default
+ --loglevel <level> loglevel, decimal (123) or hex (0x123), default=0
+ --console copy logging to console
+ --quiet run in quiet mode
+ --remmode <mode> remote STM mode, 0=STMv1/v2, 1=STMv3, default=0
+ --remaddr <addr> remote IP address of STM, default=127.0.0.1
+ --remport <port> remote IP port of STM, default=10000
+ --stmaddr <stm> remote STM address (0-7), default=0
+ --repeat <val> number of repetitions, default is 1
+ --terse use terse reporting mode, default is verbose
+ --timeout <val> request timeout in ms, default is 2000
+
+ Ccmd Compound command
+ ccmd <cmd> *[; <cmd>]
+ cmd <inst-cmd> | <stm-cmd> | <mod-cmd>
+ inst-cmd <method> *[.<parm>]
+ method stats
+ method wait
+ stm-cmd stm.<method> *[.<parm>]
+ mod-cmd <mod>.<0-31> [.<chn>[.]<nbr>]
+ [.<method> *[.<parm>]] *[<oper><value>]
+ mod imd | imw | tab | uim | utm | bwm | omd | jrm | amd |
+ fui | fu2 | ebs | ebr | ebd | dim | et0 | et1 | mcc
+
+ Help: -? will report available commands and syntax at that level
+ xphcextc -?
+ xphcextc -? wait
+ xphcextc -? stm
+ xphcextc -? stm.time
+ xphcextc -? jrm.0
+ xphcextc -? jrm.0.out0
+ xphcextc -? jrm.0.out0.tipdelayedup
+
+ Usage:
+ xphcextc --remaddr 192.168.0.2 --repeat 16 "omd.0.out4.toggle;wait.500"
+ xphcextc --ini my.ini --repeat 16 "omd.0.out4.toggle;wait.500"
+ xphcextc --ini my.ini "omd.0.out4.ontimed.10" --repeat 16 "wait.1000;omd.0"
+ xphcextc --ini my.ini "omd.0 ^ 0x55" "omd.0.out.0.toggle*4-1"
+
- 0 (Success)
<<<
Letzte Änderung: 17 Aug 2015 22:30 von simonjo.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
17 Aug 2015 22:31 #2 von simonjo
Updating to version 4.0.0.1

Included zip file contains sample ini-file + Windows (xphcextc.exe) and Raspi (xphcextc.raspi) version.
Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
02 Nov 2016 07:35 #3 von Biland
Hey, I’m quite new in using xwrc and xphcextc so I have some questions and problems.

My xwrc is running well and I can send commands to the stm. In summary it works nice.
But with xphcextc I have some problems.

I copy the files to /xwrc/xphcextc and give xphcextc.raspi the access rights“chmod x ….”.
After that I change the IP in the ini-file and safe it.

In the next step I want to send a command via terminal to STM. Therfore I wrote:
/xwrc/xphcextc/xphcetc.raspi --ini /xwrc/xphcextc/xphcetc.ini “omd.1.out.6.toggle”
Now the app shows:
+ xPhcExtc (Linux/RbPI) ------ v4.0.0.1, Aug 17 2015, Jo Simons (c) 2005-2015
+=============================================================
Omd.1.out.6.toggle: err 21, Closed
- 0 (Success)

So I hope that anybody can tell what I made wrong ;-)

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
02 Nov 2016 09:26 #4 von simonjo
What can be the issue:

1) Using an ini-file replaces the usage of other command line options by specifying them in the ini-file,in your case you should check the contents of the ini-file of following options, most likely remaddr is wrong:
- remaddr
- remport
- remmode
- stmaddr

2) When xWRC is running, it will permanently connect over IP to the STM. If the IP-2-RS232 convertor module allows only 1 connection at a time, then you are stuck here. In this case stop xWRC and retry to send a command using xphcextc.

xPhcExtc sets up a connection over IP to the STM each time you start it, then sends all commands you specified and finally closes the connection.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
02 Nov 2016 14:42 #5 von Biland
Thanks for fast feedback. Problem was that xWRC was still running.

So perhaps you have a possible solution for my plan.
My plan is to send a command via script at sunset and sunrise to STM.

Therefore I use another script which updates the actual sunset and sunrise times in my crontab.
So on sunset my cron will execute a script which stop xWRC send a command via xphcextc to the STM and start xWRC again.
#! /bin/bash
pkill xwrc.raspi
/xwrc/xphcextc/xphcetc.raspi --ini /xwrc/xphcextc/xphcetc.ini “omd.1.out.6.toggle”
/xwrc/bin/xwrc.raspi -httpport 9999 -httpaddr 192.168.1.28 -remaddr 192.168.1.4 -remport 10000&

The problem is that my html-files are not reachable after restarting xWRC with the script.
If I execute the script by hand in terminal I see that it freeze at:
xWRC (Linux/PbPI) – v3.3.1.0 – Sep 18 2016 -------- webInterface for PHC-
==============================================================
Running in licensed mode 
Press CTRL+C to terminate xWRC

Do you have an Idea how I can start xWRC via script complete in background? I guess that the ampersand isn’t enough.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
02 Nov 2016 19:57 #6 von simonjo
I have another command line tool called xhttpc, this is just an HTTP client that can request a URL. I use it to test xWRC from a set of bash scripts.

I will compose a zip file with a Windows/Linux x86 and Raspi version and post it here.

That way you don;t have to (over)kill xWRC ;)

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
03 Nov 2016 06:58 #7 von Biland
Oh this sounds great. A http client which gets URL commands from a bash script and can handle it is exactly that what I need.
I would be happy if you can support us with this client especially for Raspi ;-)

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
07 Nov 2016 23:09 #8 von simonjo
Sorry for the delay but it seems had killed my Raspi and had to get a new one first ;)

Attached xhttpc.v4.0.0.0.zip contains the latest http client tool:
- xhttpc.exe = Windows
- xhttpc.x86 = Linux on x86 machine
- xhttpc.raspi = Raspbian


To use it:
- unzip it to a directory
- give it execute rights (chmod +x xhttpc.raspi)
- ./xhttpc.raspi -? will show the help

Here is a sample to control xWRC:
./xhttpc.raspi "http://<xwrc-ip-address>/icontrol.dll?ccmd=omd.0.out0.toggle&terse"

Please note that for Linux the double quotes are needed because of the '&terse' in the end, actually because of the '&'


cu, Jo
Anhänge:
Folgende Benutzer bedankten sich: ansgar75

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
08 Nov 2016 09:12 #9 von Biland
Hi and thanks a lot for the http client.
It works fine. The only thing what I have to adjust is to add the http-port of xwrc behind the ip-address.

Now my scripts works fine and crontab execute the scripts at sunrise / sunset and I don't have to kill xwrc every time.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
29 Sep 2018 17:52 #10 von Biland
Hi, I hope that somebody can help me... today morning my SD-Card is broken. So I bought a new one, installed a fresh raspian and copy and pasty the complete xwrc folder into the new system. This folder includes the xhttpc folder with all my scripts and xhttpc.raspi. In the next step I give all fliles the needed execute rights and xwrc works fine. But xhttpc dosn't work. If I the following command:
/xwrc/xhttpc/xhttpc.raspi "http://192.168.1.28:9999/icontrol.dll?ccmd=jrm.2.out0.down.1.0.700&terse"
I geht the following ERROR: Segmentation fault
Does somboy know what can be teh root cause for this issue?

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
29 Sep 2018 22:32 #11 von simonjo
Can you add --loglevel 0xFFFFFFFF to your command and report the outcome

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Powered by Kunena Forum