2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 01:14:19 +00:00

HMCCU: Added example script in readme file for calling FHEM commands from CCU

git-svn-id: https://svn.fhem.de/fhem/trunk@9433 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
fhemzap 2015-10-11 10:48:38 +00:00
parent e2abb9f828
commit 4fbe4e4f21

View File

@ -11,12 +11,16 @@
1 HMCCU Introduction
1.1 HMCCU Description
1.2 HMCCU Requirements
2 HMCCU Usage
2.1 HMCCU Set Commands
2.2 HMCCU Get Commands
2.3 HMCCU Attributes
2.4 HMCCU Parameter File
3 Executing FHEM commands on CCU
------------------------------------
1 HMCCU Introduction
------------------------------------
@ -188,3 +192,39 @@ The format of a parfile entry is:
Empty lines and lines starting with a '#' are ignored.
------------------------------------
3 Executing FHEM commands on CCU
------------------------------------
It's possible to execute FHEM commands from CCU via the FHEM telnet port.
The following shell script encapsulates the necessary commands. It can
be placed somewhere under /etc/config/addons directory in CCU. The script
requires the installation of the netcat command (nc) on CCU (search for
the binary in google and install it somewhere in /etc/config/addons).
--- Script ---
#!/bin/sh
# Set name or IP address and port of FHEM server
FHEM_SERVER="myfhem"
FHEM_PORT=7072
# Set path to nc command
NCCMD="/etc/config/addons/scripts"
if [ $# -ne 1 ]; then
echo "Usage: $0 Command"
exit 1
fi
echo -e "$1\nquit\n" | $NCCMD/nc $FHEM_SERVER $FHEM_PORT
--- End of script ---
The script should be called from a CCU program by using the CUXD exec object.
If FHEM command contains blanks it should be enclosed in double quotes.
*** Have fun! zap ***