xPhcExtc, send commands over EXT interface to a PHC system
- simonjo
- Autor
- Offline
- Gold Boarder
- Beiträge: 148
- Dank erhalten: 55
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)
<<<
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- simonjo
- Autor
- Offline
- Gold Boarder
- Beiträge: 148
- Dank erhalten: 55
Included zip file contains sample ini-file + Windows (xphcextc.exe) and Raspi (xphcextc.raspi) version.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
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”
+ 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.
- simonjo
- Autor
- Offline
- Gold Boarder
- Beiträge: 148
- Dank erhalten: 55
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.
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
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.
- simonjo
- Autor
- Offline
- Gold Boarder
- Beiträge: 148
- Dank erhalten: 55
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.
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
I would be happy if you can support us with this client especially for Raspi
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- simonjo
- Autor
- Offline
- Gold Boarder
- Beiträge: 148
- Dank erhalten: 55
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
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
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.
- Biland
- Offline
- Senior Boarder
- Beiträge: 34
- Dank erhalten: 0
/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.
- simonjo
- Autor
- Offline
- Gold Boarder
- Beiträge: 148
- Dank erhalten: 55
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- DonCamillo
- Offline
- Fresh Boarder
- Beiträge: 1
- Dank erhalten: 0
I have used this helpful tool from time to time for testing purposes.
After reinstalling the Raspberry with a new OS it no longer works. I guess the Raspi-Version works only on kernels with 32-bit support?
Thanks,
Michael
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- simonjo
- Autor
- Offline
- Gold Boarder
- Beiträge: 148
- Dank erhalten: 55
Which OS are you using ?
Jo
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Aktuelle Seite:
- Startseite
- Forum
- PHC-Forum
- Visualisierung
- xPhcExtc, send commands over EXT interface to a PHC system