mirror of
https://github.com/fhem/fhem-mirror.git
synced 2024-11-22 02:59:49 +00:00
Version 1.4 from Martin.
git-svn-id: https://svn.fhem.de/fhem/trunk@329 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c2fdbc4f43
commit
1c341dae0b
45
fhem/contrib/fhem2speech/ChangeLog
Normal file
45
fhem/contrib/fhem2speech/ChangeLog
Normal file
@ -0,0 +1,45 @@
|
||||
2009-01-11 (1.4) Martin Fischer <m_fischer@gmx.de>
|
||||
|
||||
* test for arguments added
|
||||
* new option --set to set device status added
|
||||
* documentation updated
|
||||
|
||||
2009-01-07 (1.3) Martin Fischer <m_fischer@gmx.de>
|
||||
|
||||
* Perl modul JSON::XS for communication with FHEM included. This requires
|
||||
jsonlist (fhem/contrib) for FHEM.
|
||||
* several changes for parsing the JSON result
|
||||
* buffering disabled
|
||||
* output as asterisk AGI command added
|
||||
* new subroutine for removing value units
|
||||
|
||||
2009-01-01 (1.2) Martin Fischer <m_fischer@gmx.de>
|
||||
|
||||
* Perl modul Term::ANSIColor removed
|
||||
* external command 'recode' for converting UTF8 to latin1. mbrola need
|
||||
this to speek german umlauts
|
||||
* new output format gsm
|
||||
* options for outputformat now configurable
|
||||
* translation for special chars added
|
||||
* new option --asterisk, -a to support asterisk parsing added
|
||||
* new option --prefix to flag outfiles with a user prefix added
|
||||
* new option --force to override existing files added
|
||||
* support for reading files added
|
||||
* several changes in subroutine text2speech (code cleanup)
|
||||
|
||||
2008-12-31 (1.1) Martin Fischer <m_fischer@gmx.de>
|
||||
|
||||
* command-line options now works with Getopt::Long
|
||||
* check for external files (mbrola, txt2pho, sox, etc.) included
|
||||
* include a debug routine. use it with --debug on command-line
|
||||
* documentation added
|
||||
* added support for quiet mode. use it with -q, --quiet
|
||||
* FHEM error trap added
|
||||
* new option -t "TEXT". read the given text
|
||||
* new option to support female or male voice. use it with -S, --Sex
|
||||
on command-line
|
||||
* replace unwanted chars with text, e.g. - = Minus
|
||||
* support for generating (cached) wave files
|
||||
* update the documentation
|
||||
* added cached files for all modes
|
||||
|
BIN
fhem/contrib/fhem2speech/JSON-XS-2.231.tar.gz
Normal file
BIN
fhem/contrib/fhem2speech/JSON-XS-2.231.tar.gz
Normal file
Binary file not shown.
345
fhem/contrib/fhem2speech/README.fhem-speech
Normal file
345
fhem/contrib/fhem2speech/README.fhem-speech
Normal file
@ -0,0 +1,345 @@
|
||||
NAME
|
||||
fhem-speech - Synthesized voice (based on MBROLA) extension for FHEM
|
||||
|
||||
SYNOPSIS
|
||||
fhem-speech -d device [-achopqS]
|
||||
|
||||
fhem-speech -d device --set state [-hp]
|
||||
|
||||
fhem-speech -f file [-acoqS]
|
||||
|
||||
fhem-speech -t "text" [-acoqS]
|
||||
|
||||
fhem-speech [-HmV?]
|
||||
|
||||
Try `fhem-speech --man` for full manual!
|
||||
|
||||
DESCRIPTION
|
||||
fhem-speech
|
||||
fhem-speech read the status of a FHEM device and talk using the MBROLA
|
||||
speech synthesizer. Furthermore it can read the content of a given file
|
||||
or text.
|
||||
|
||||
FHEM
|
||||
FHEM is used to automate some common tasks in the household like
|
||||
switching lamps/shutters/heating/etc. and to log events like
|
||||
temperature/humidity/power consumption. Visit the FHEM's homepage
|
||||
<http://www.koeniglich.de/fhem/fhem.html> for more information.
|
||||
|
||||
The MBROLA project
|
||||
Central to the MBROLA project is MBROLA, a speech synthesizer based on
|
||||
the concatenation of diphones. It takes a list of phonemes as input,
|
||||
together with prosodic information, and produces speech samples on 16
|
||||
bits (linear), at the sampling frequency of the diphone database used.
|
||||
This synthesizer is provided for free, for non commercial, non military
|
||||
applications only. Visit the MBROLA's homepage
|
||||
<http://tcts.fpms.ac.be/synthesis/> for more information.
|
||||
|
||||
Asterisk
|
||||
Optionally fhem-speech supports AGI commands to communicate with
|
||||
Asterisk. Visit the Asterisk(R) homepage <http://www.asterisk.org/> for
|
||||
more information.
|
||||
|
||||
OPTIONS
|
||||
Mandatory arguments to long options are mandatory for short options too.
|
||||
Ordering Options:
|
||||
|
||||
-d, --device device
|
||||
Run in FHEM mode. Specifies the FHEM device to be queried. The given
|
||||
device must be defined.
|
||||
|
||||
-f, --file file-name
|
||||
Run in file mode. fhem-speech will read the given file.
|
||||
|
||||
-t, --text "TEXT"
|
||||
Run in Speaker's mode. fhem-speech will read the given "TEXT".
|
||||
|
||||
Other options:
|
||||
|
||||
-a, --asterisk
|
||||
Run in Asterisk mode. fhem-speech print out AGI-commands for direct
|
||||
usage in Asterisk.
|
||||
|
||||
-c, --cache directory
|
||||
Specifies the location of where the files should be saved if
|
||||
fhem-speech started with the -o or --out argument.
|
||||
|
||||
Default location: current directory.
|
||||
|
||||
--force
|
||||
Overwrites existing files.
|
||||
|
||||
-h, --host host
|
||||
Specifies the hostaddress for FHEM.
|
||||
|
||||
Default address: "localhost".
|
||||
|
||||
-o, --out [gsm|wav]
|
||||
fhem-speech saves the output to a file with the specified output
|
||||
format.
|
||||
|
||||
Default address: "localhost".
|
||||
|
||||
-p, --port port
|
||||
Communicate with FHEM on defined port.
|
||||
|
||||
Default port: "7072".
|
||||
|
||||
--prefix prefix
|
||||
Set the given prefix in front of filename.
|
||||
|
||||
-q, --quiet
|
||||
Run in quiet mode.
|
||||
|
||||
--set state
|
||||
Send <state> to device.
|
||||
|
||||
-S, --sex [f|m]
|
||||
Specifies the sex for the voice. It depends on which voices for
|
||||
MBROLA have been installed.
|
||||
|
||||
Default: "de3" for the German female voice and "de2" for the German
|
||||
male voice.
|
||||
|
||||
-m, --man
|
||||
Show the manual page and exits.
|
||||
|
||||
-H, --help
|
||||
Show a brief help message and exits.
|
||||
|
||||
-V, --version
|
||||
Show fhem-speech's version number and exit.
|
||||
|
||||
EXAMPLES
|
||||
Get status information for device <EG.wz.HZ> in quiet mode:
|
||||
|
||||
`fhem-speech -d EG.wz.HZ -q`
|
||||
|
||||
Same as above with a male voice. FHEM runs on IP 192.168.1.100:
|
||||
|
||||
`fhem-speech -d EG.wz.HZ -S m -h 192.168.1.100`
|
||||
|
||||
Get status information for device <EG.wz.HZ> in Asterisk mode:
|
||||
|
||||
`fhem-speech -d EG.wz.HZ -a -q -o gsm -c /var/lib/asterisk/sounds/fhem/`
|
||||
|
||||
Read the file <foobar>:
|
||||
|
||||
`fhem-speech -f foobar`
|
||||
|
||||
Read the given text "Geht nicht gibt's nicht.":
|
||||
|
||||
`fhem-speech -t "Geht nicht gibt's nicht."`
|
||||
|
||||
Set the state for device <EG.wz.SD.01>:
|
||||
|
||||
`fhem-speech -d EG.wz.SD.01 --set on`
|
||||
|
||||
INSTALLATION
|
||||
Requirements
|
||||
MBROLA
|
||||
You need MBROLA synthesizer, a synthesis voice, txt2pho and sox. For
|
||||
more information visit:
|
||||
|
||||
o MBROLA project, <http://tcts.fpms.ac.be/synthesis/>
|
||||
|
||||
o hadifix, <http://www.ikp.uni-bonn.de/dt/forsch/phonetik/hadifix/>
|
||||
|
||||
FHEM
|
||||
For FHEM mode you need FHEM 4.5+ and the command extension "jsonlist".
|
||||
For more information take a look at:
|
||||
|
||||
<fhem_src_path>/contrib/JsonList/README.JsonList
|
||||
|
||||
or visit the FHEM's homepage:
|
||||
|
||||
<http://www.koeniglich.de/fhem/fhem.html>
|
||||
|
||||
JSON::XS
|
||||
The required command extension "jsonlist" send the result as a JSON
|
||||
encoded string. fhem-speech need the Perl module JSON::XS to decode the
|
||||
information.
|
||||
|
||||
There are several ways to install the module:
|
||||
|
||||
You can download the last version at:
|
||||
|
||||
<http://search.cpan.org/~mlehmann/JSON-XS-2.231/XS.pm>
|
||||
|
||||
Or you can use the package from the contrib-folder which was delivered
|
||||
with fhem-speech.
|
||||
|
||||
You can use the cpan command on bash-prompt.
|
||||
|
||||
Installation
|
||||
This describes the installation on ubuntu:
|
||||
|
||||
Make a temporarily directory for the needed files and change to the new
|
||||
directory, e.g.:
|
||||
|
||||
`mkdir /usr/local/src/mbrola; cd !$`
|
||||
|
||||
Download the required files:
|
||||
|
||||
`wget http://www.ikp.uni-bonn.de/dt/forsch/phonetik/hadifix/txt2pho.zip`
|
||||
`wget http://tcts.fpms.ac.be/synthesis/mbrola/bin/pclinux/mbrola3.0.1h_i386.deb`
|
||||
|
||||
Download at least one synthesis voice (e.g. German female voice):
|
||||
|
||||
`wget http://tcts.fpms.ac.be/synthesis/mbrola/dba/de3/de3.zip`
|
||||
|
||||
txt2pho
|
||||
Install txt2pho:
|
||||
|
||||
`unzip txt2pho.zip -d /usr/share/`
|
||||
`chmod 755 /usr/share/txt2pho/txt2pho`
|
||||
|
||||
Edit txt2phorc:
|
||||
|
||||
`vi /usr/share/txt2pho/txt2phorc`
|
||||
|
||||
and change the path for DATAPATH and INVPATH:
|
||||
|
||||
DATAPATH=/usr/share/txt2pho/data/
|
||||
INVPATH=/usr/share/txt2pho/data/
|
||||
|
||||
Copy txt2phorc to /etc/txt2pho:
|
||||
|
||||
`cp /usr/share/txt2pho/txt2phorc /etc/txt2pho`
|
||||
|
||||
Synthesis Voice
|
||||
Install the synthesis voice (e.g. German female voice):
|
||||
|
||||
`unzip de7.zip -d /usr/share/mbrola/de7`
|
||||
|
||||
fhem-speech use "de2" and "de3" as default voices. You can change this
|
||||
if you like.
|
||||
|
||||
MBROLA
|
||||
Install MBROLA:
|
||||
|
||||
`dpkg -i mbrola3.0.1h_i386.deb`
|
||||
|
||||
sox
|
||||
Install sox:
|
||||
|
||||
`apt-get install sox libsox-fmt-all`
|
||||
|
||||
Test
|
||||
Test your installation:
|
||||
|
||||
`echo "Test" | /usr/share/txt2pho/txt2pho |\
|
||||
mbrola /usr/share/mbrola/de7/de7 - -.au | play -q -t au -`
|
||||
|
||||
fhem-speech
|
||||
Copy the script fhem-speech to a directory of your choice, e.g.:
|
||||
|
||||
`cp fhem-speech /usr/local/bin`
|
||||
|
||||
and make it executable:
|
||||
|
||||
`chmod 775 /usr/local/bin/fhem-speech`
|
||||
|
||||
Perl
|
||||
If you use the delivered module contrib/JSON-XS-2.231.tar.gz:
|
||||
|
||||
`tar xzf JSON-XS-2.231.tar.gz`
|
||||
`cd JSON-XS-2.231`
|
||||
`perl Makefile.pl`
|
||||
`make`
|
||||
`make test`
|
||||
|
||||
and as root:
|
||||
|
||||
`make install`
|
||||
|
||||
CONFIGURATION
|
||||
Open fhem-speech with your prefered editor.
|
||||
|
||||
FHEM host settings
|
||||
Change the default host, if you like:
|
||||
|
||||
###########################
|
||||
# FHEM
|
||||
$sys{fhem}{host} = "localhost";
|
||||
$sys{fhem}{port} = "7072";
|
||||
|
||||
External commands
|
||||
Change the paths depending on the installed distribution:
|
||||
|
||||
###########################
|
||||
# Mandatory external Files
|
||||
$sys{file}{mbrola} = "/usr/local/bin/mbrola";
|
||||
$sys{file}{pipefilt} = "/usr/local/bin/pipefilt";
|
||||
$sys{file}{play} = "/usr/bin/play";
|
||||
$sys{file}{preproc} = "/usr/local/bin/preproc";
|
||||
[...]
|
||||
|
||||
Change the default settings for synthesis voice:
|
||||
|
||||
###########################
|
||||
# mbrola / txt2pho options
|
||||
$sys{speech}{sex} = "f";
|
||||
$sys{speech}{male} = "-f0.8 -t0.9 -l 15000";
|
||||
$sys{speech}{female} = "-f1.2 -t1.0 -l 22050";
|
||||
|
||||
Translation
|
||||
fhem-speech need the $lang{} settings to decide what messages from FHEM
|
||||
to be spoken. For example take a look at the FHT part:
|
||||
|
||||
###########################
|
||||
# FHEM Translation
|
||||
|
||||
[...]
|
||||
|
||||
###########################
|
||||
# FHT
|
||||
# keys:
|
||||
$lang{'actuator'} = "Ventilstellung: %s Prozent";
|
||||
$lang{'day-temp'} = "Temperatur Tag: %s Grad";
|
||||
$lang{'desired-temp'} = "Angeforderte Temperatur: %s Grad";
|
||||
$lang{'measured-temp'} = "Gemessene Temperatur: %s Grad";
|
||||
$lang{'mode'} = "Modus: %s";
|
||||
$lang{'night-temp'} = "Temperatur Nacht: %s Grad";
|
||||
$lang{'windowopen-temp'} = "Temperatur Fenster offen: %s Grad";
|
||||
[...]
|
||||
|
||||
On every FHEM response all of the defined $lang{} status information
|
||||
will be spoken. If you don't like status information for e.g.
|
||||
'windowopen-temp' then comment this out:
|
||||
|
||||
# $lang{'windowopen-temp'} = "Temperatur Fenster offen: %s Grad";
|
||||
|
||||
If you like to know the status for e.g. 'lowtemp-offset' add a line like
|
||||
this:
|
||||
|
||||
$lang{'lowtemp-offset'} = "Versatz Temperatur %s Grad";
|
||||
|
||||
The '%s' stands as a placeholder for the value.
|
||||
|
||||
OPTIONAL
|
||||
Asterisk
|
||||
fhem-speech support AGI commands for direct output in Asterisk.
|
||||
|
||||
Wrapper
|
||||
If you like fhem-speech for use in Asterisk, you have to install a
|
||||
wrapper around fhem-speech. You can use the example from
|
||||
contrib/fhem-speech.agi.
|
||||
|
||||
Copy the wrapper to your asterisk-environment, e.g:
|
||||
|
||||
`cp contrib/fhem-speech.agi /var/lib/asterisk/agi-bin/`
|
||||
|
||||
extension.conf
|
||||
Take a look at the example from contrib/extension.conf.
|
||||
|
||||
LEGALESE
|
||||
License GPLv3+: GNU GPL version 3 or later
|
||||
<http://gnu.org/licenses/gpl.html>.
|
||||
|
||||
This is free software: you are free to change and redistribute it. There
|
||||
is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
AUTHOR
|
||||
Copyright (C) 2008 Martin Fischer <m_fischer@gmx.de>
|
||||
|
@ -1,63 +0,0 @@
|
||||
Copyright (c)2008 Martin Fischer <m_fischer@gmx.de>
|
||||
|
||||
Description:
|
||||
The script fhem2speech.sh let FHEM talk.
|
||||
|
||||
Requirements:
|
||||
You need MBROLA synthesizer, a synthesis voice, txt2pho and bplay.
|
||||
For more information visit:
|
||||
o MBROLA Project, http://tcts.fpms.ac.be/synthesis/
|
||||
o hadifix, http://www.ikp.uni-bonn.de/dt/forsch/phonetik/hadifix/
|
||||
|
||||
Installation:
|
||||
This describes the installation on ubuntu:
|
||||
|
||||
Make a temporarily directory for the needed files and change to
|
||||
the new directory, e.g.:
|
||||
'mkdir /usr/local/src/mbrola; cd !$'
|
||||
|
||||
Download the required files:
|
||||
'wget http://www.ikp.uni-bonn.de/dt/forsch/phonetik/hadifix/txt2pho.zip'
|
||||
'wget http://tcts.fpms.ac.be/synthesis/mbrola/bin/pclinux/mbrola3.0.1h_i386.deb'
|
||||
|
||||
Download at least one synthesis voice (e.g. german female voice):
|
||||
'wget http://tcts.fpms.ac.be/synthesis/mbrola/dba/de7/de7.zip'
|
||||
|
||||
Install txt2pho:
|
||||
'unzip txt2pho.zip -d /usr/share/'
|
||||
'chmod 755 /usr/share/txt2pho/txt2pho'
|
||||
|
||||
Edit txt2phorc:
|
||||
'vi /usr/share/txt2pho/txt2phorc'
|
||||
and change the path for DATAPATH and INVPATH:
|
||||
DATAPATH=/usr/share/txt2pho/data/
|
||||
INVPATH=/usr/share/txt2pho/data/
|
||||
|
||||
Copy txt2phorc to /etc/txt2pho:
|
||||
'cp /usr/share/txt2pho/txt2phorc /etc/txt2pho'
|
||||
|
||||
Install the synthesis voice (e.g. german female voice):
|
||||
'unzip de7.zip -d /usr/share/mbrola/de7'
|
||||
|
||||
Install mbrola:
|
||||
'dpkg -i mbrola3.0.1h_i386.deb'
|
||||
|
||||
Install bplay:
|
||||
'apt-get install bplay'
|
||||
|
||||
Test your installation:
|
||||
'echo "Test" | /usr/share/txt2pho/txt2pho | mbrola /usr/share/mbrola/de7/de7 - - | bplay -s22050 -
|
||||
b 16'
|
||||
|
||||
Copy the script fhem2speech.sh to a directory of your choice,
|
||||
e.g.:
|
||||
'cp fhem2speech.sh /usr/local/bin'
|
||||
and make it executable:
|
||||
'chmod 775 /usr/local/bin/fhem2speech.sh'
|
||||
|
||||
Usage:
|
||||
Edit your FHEM configuration file and add a line like this:
|
||||
define speechBattery notify .*warnings.*Battery.*low.* "/usr/local/bin/fhem2speech.sh -s "Achtung, Batterie schwach: @""
|
||||
|
||||
At last restart FHEM or do a rereadcfg and listen to your speaker.
|
||||
|
163
fhem/contrib/fhem2speech/extensions.conf
Normal file
163
fhem/contrib/fhem2speech/extensions.conf
Normal file
@ -0,0 +1,163 @@
|
||||
; extensions.conf - the Asterisk dial plan
|
||||
;
|
||||
|
||||
[myHCE]
|
||||
; houseautomation
|
||||
exten => 5000,1(myhce),Answer()
|
||||
exten => 5000,n,Set(TIMEOUT(digit)=5)
|
||||
exten => 5000,n,Set(TIMEOUT(response)=10)
|
||||
; skip authentication for known numbers
|
||||
exten => 5000,n,GotoIf($["${CALLERID(num)}" = "01601234567"]?5000,main)
|
||||
exten => 5000,n,GotoIf($["${CALLERID(num)}" = "01701234567"]?5000,main)
|
||||
; authentication
|
||||
exten => 5000,n,Authenticate(1137)
|
||||
exten => 5000,n,Wait(1)
|
||||
; main menu
|
||||
exten => 5000,n(main),NoOp(Main Menu)
|
||||
exten => 5000,n,Set(GLOBAL(myHCE_ext)=${EXTEN})
|
||||
exten => 5000,n,Set(GLOBAL(myHCE_pExt)=5000)
|
||||
exten => 5000,n,Set(GLOBAL(myHCE_pCon)=myHCE)
|
||||
include => myHCE-default
|
||||
exten => 5000,n(menu),AGI(fhem-speech.agi,t,"Hauptmenü")
|
||||
exten => 5000,n(choice),AGI(fhem-speech.agi,t,"Bitte wählen Sie")
|
||||
exten => 5000,n,AGI(fhem-speech.agi,t,"1 für Statusabfrage")
|
||||
exten => 5000,n,AGI(fhem-speech.agi,t,"2 für Steuerung")
|
||||
exten => 5000,n,AGI(fhem-speech.agi,t,"5 für Hilfe")
|
||||
exten => 5000,n,Background(silence/3)
|
||||
exten => 5000,n,Goto(choice)
|
||||
; help
|
||||
exten => 5000,n(help),AGI(fhem-speech.agi,t,"Menüsteuerung für alle Menüs")
|
||||
exten => 5000,n,AGI(fhem-speech.agi,t,"8 zurück zum letzten Menü")
|
||||
exten => 5000,n,AGI(fhem-speech.agi,t,"9 zurück zum Hauptmenü")
|
||||
exten => 5000,n,AGI(fhem-speech.agi,t,"0 zum Beenden")
|
||||
exten => 5000,n,Background(silence/3)
|
||||
exten => 5000,n,Goto(menu)
|
||||
; selection
|
||||
exten => 1,1,Goto(myHCE-status,5100,status)
|
||||
exten => 2,1,Goto(myHCE-control,5200,control)
|
||||
exten => 5,1,Goto(5000,help)
|
||||
|
||||
[myHCE-default]
|
||||
; global menu navigation
|
||||
exten => 8,1,Goto(${myHCE_pCon},${myHCE_pExt},menu)
|
||||
exten => 9,1,Goto(myHCE,5000,main)
|
||||
exten => 0,1,Goto(myHCE-exit,5099,exit)
|
||||
; wrong input
|
||||
exten => i,1,AGI(fhem-speech.agi,t,"Falsche Eingabe.")
|
||||
exten => i,2,Goto(${myHCE_ext},menu)
|
||||
|
||||
[myHCE-exit]
|
||||
; exit
|
||||
exten => 5099,n(exit),AGI(fhem-speech.agi,t,"Verbindung wird getrennt. Vielen Dank!")
|
||||
exten => 5099,n,Hangup()
|
||||
|
||||
[myHCE-status]
|
||||
exten => 5100,1(status),NoOp(Status Menu)
|
||||
exten => 5100,n,Set(GLOBAL(myHCE_ext)=${EXTEN})
|
||||
exten => 5100,n,Set(GLOBAL(myHCE_pExt)=5000)
|
||||
exten => 5100,n,Set(GLOBAL(myHCE_pCon)=myHCE)
|
||||
include => myHCE-default
|
||||
; submenu device status
|
||||
exten => 5100,n(menu),AGI(fhem-speech.agi,t,"Menü Statusabfrage")
|
||||
exten => 5100,n(choice),AGI(fhem-speech.agi,t,"Bitte wählen Sie")
|
||||
exten => 5100,n,AGI(fhem-speech.agi,t,"1 für Wetterstation")
|
||||
exten => 5100,n,AGI(fhem-speech.agi,t,"2 für Rauchmelder")
|
||||
exten => 5100,n,AGI(fhem-speech.agi,t,"5 für Raumthermostate")
|
||||
exten => 5100,n,Background(silence/3)
|
||||
exten => 5100,n,Goto(choice)
|
||||
; selection
|
||||
exten => 1,1,Playback(beep)
|
||||
exten => 1,n,AGI(fhem-speech.agi,d,GH.ga.WE.01)
|
||||
exten => 1,n,Playback(beep)
|
||||
exten => 1,n,Goto(5100,status)
|
||||
exten => 2,1,Playback(beep)
|
||||
exten => 2,n,AGI(fhem-speech.agi,d,NN.xx.RM.01)
|
||||
exten => 2,n,Playback(beep)
|
||||
exten => 2,n,Goto(5100,status)
|
||||
exten => 5,1,Goto(myHCE-status_fht,5110,menu)
|
||||
|
||||
[myHCE-status_fht]
|
||||
exten => 5110,1(status),NoOp(Status Menu)
|
||||
exten => 5110,n,Set(GLOBAL(myHCE_ext)=${EXTEN})
|
||||
exten => 5110,n,Set(GLOBAL(myHCE_pExt)=5100)
|
||||
exten => 5110,n,Set(GLOBAL(myHCE_pCon)=myHCE-status)
|
||||
include => myHCE-default
|
||||
; submenu fht devices
|
||||
exten => 5110,n(menu),AGI(fhem-speech.agi,t,"Menü Raumthermostate")
|
||||
exten => 5110,n(choice),AGI(fhem-speech.agi,t,"Bitte wählen Sie")
|
||||
exten => 5110,n,AGI(fhem-speech.agi,t,"1 für Wohnzimmer")
|
||||
exten => 5110,n,AGI(fhem-speech.agi,t,"2 für Schlafzimmer")
|
||||
exten => 5110,n,AGI(fhem-speech.agi,t,"3 für Büro")
|
||||
exten => 5110,n,AGI(fhem-speech.agi,t,"4 für Badezimmer")
|
||||
exten => 5110,n,Background(silence/3)
|
||||
exten => 5110,n,Goto(choice)
|
||||
; selection
|
||||
exten => 1,1,Playback(beep)
|
||||
exten => 1,n,AGI(fhem-speech.agi,d,EG.wz.HZ)
|
||||
exten => 1,n,Playback(beep)
|
||||
exten => 1,n,Goto(5110,status)
|
||||
exten => 2,1,Playback(beep)
|
||||
exten => 2,n,AGI(fhem-speech.agi,d,EG.sz.HZ)
|
||||
exten => 2,n,Playback(beep)
|
||||
exten => 2,n,Goto(5110,status)
|
||||
exten => 3,1,Playback(beep)
|
||||
exten => 3,n,AGI(fhem-speech.agi,d,EG.bu.HZ)
|
||||
exten => 3,n,Playback(beep)
|
||||
exten => 3,n,Goto(5110,status)
|
||||
exten => 4,1,Playback(beep)
|
||||
exten => 4,n,AGI(fhem-speech.agi,d,EG.bz.HZ)
|
||||
exten => 4,n,Playback(beep)
|
||||
exten => 4,n,Goto(5110,status)
|
||||
|
||||
[myHCE-control]
|
||||
include => myHCE-default
|
||||
exten => 5200,1(control),AGI(fhem-speech.agi,t,"Menü Steuerung")
|
||||
exten => 5200,n(menu),AGI(fhem-speech.agi,t,"Bitte wählen Sie")
|
||||
exten => 5200,n,AGI(fhem-speech.agi,t,"1 für Wohnzimmer")
|
||||
exten => 5200,n,AGI(fhem-speech.agi,t,"2 für Schlafzimmer")
|
||||
exten => 5200,n,AGI(fhem-speech.agi,t,"3 für Büro")
|
||||
exten => 5200,n,AGI(fhem-speech.agi,t,"4 für Badezimmer")
|
||||
exten => 5200,n,Background(silence/3)
|
||||
exten => 5200,n,Goto(menu)
|
||||
|
||||
exten => 1,1,Goto(myHCE-control_wohnen,5210,menu)
|
||||
|
||||
exten => i,1,AGI(fhem-speech.agi,t,"Falsche Eingabe.")
|
||||
exten => i,2,Goto(5200,menu)
|
||||
|
||||
[myHCE-control_wohnen]
|
||||
include => myHCE-default
|
||||
exten => 5210,1(control),AGI(fhem-speech.agi,t,"Menü Steuerung")
|
||||
exten => 5210,n,AGI(fhem-speech.agi,t,"Wohnzimmer")
|
||||
exten => 5210,n(menu),AGI(fhem-speech.agi,t,"Bitte wählen Sie")
|
||||
exten => 5210,n,AGI(fhem-speech.agi,t,"1 für Lampen")
|
||||
exten => 5210,n,Background(silence/3)
|
||||
exten => 5210,n,Goto(menu)
|
||||
|
||||
exten => 1,1,Goto(myHCE-control_wohnen-lampen,5211,set)
|
||||
|
||||
exten => 8,1,Goto(myHCE-control,5200,menu)
|
||||
|
||||
exten => i,1,AGI(fhem-speech.agi,t,"Falsche Eingabe.")
|
||||
exten => i,2,Goto(5200,menu)
|
||||
|
||||
[myHCE-control_wohnen-lampen]
|
||||
include => myHCE-default
|
||||
exten => 5211,1(set),AGI(fhem-speech.agi,t,"Steuerung Lampen")
|
||||
exten => 5211,n,AGI(fhem-speech.agi,d,EG.wz.SD.Licht.grp)
|
||||
exten => 5211,n(menu),AGI(fhem-speech.agi,t,"1 für an")
|
||||
exten => 5211,n,AGI(fhem-speech.agi,t,"2 für aus")
|
||||
exten => 5211,n,Background(silence/3)
|
||||
exten => 5211,n,Goto(menu)
|
||||
|
||||
exten => 1,1,AGI(fhem-speech.agi,s,EG.wz.SD.Licht.grp,on)
|
||||
exten => 1,n,Goto(5211,set)
|
||||
|
||||
exten => 2,1,AGI(fhem-speech.agi,s,EG.wz.SD.Licht.grp,off)
|
||||
exten => 2,n,Goto(5211,set)
|
||||
|
||||
exten => 8,1,Goto(myHCE-control_wohnen,5210,menu)
|
||||
|
||||
exten => i,1,AGI(fhem-speech.agi,t,"Falsche Eingabe.")
|
||||
exten => i,2,Goto(5211,menu)
|
||||
|
1169
fhem/contrib/fhem2speech/fhem-speech
Executable file
1169
fhem/contrib/fhem2speech/fhem-speech
Executable file
File diff suppressed because it is too large
Load Diff
55
fhem/contrib/fhem2speech/fhem-speech.agi
Executable file
55
fhem/contrib/fhem2speech/fhem-speech.agi
Executable file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/perl
|
||||
################################################################
|
||||
#
|
||||
# $Id: fhem-speech.agi,v 1.1 2009-01-12 10:26:50 rudolfkoenig Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
$|=1;
|
||||
|
||||
# Setup some variables
|
||||
my $sounds = "/var/lib/asterisk/sounds/fhem/";
|
||||
|
||||
my %AGI;
|
||||
my $tests = 0;
|
||||
my $fail = 0;
|
||||
my $pass = 0;
|
||||
|
||||
while(<STDIN>) {
|
||||
chomp;
|
||||
last unless length($_);
|
||||
if (/^agi_(\w+)\:\s+(.*)$/) {
|
||||
$AGI{$1} = $2;
|
||||
}
|
||||
}
|
||||
|
||||
print STDERR "AGI Environment Dump:\n";
|
||||
foreach my $i (sort keys %AGI) {
|
||||
print STDERR " -- $i = $AGI{$i}\n";
|
||||
}
|
||||
|
||||
sub checkresult {
|
||||
my ($res) = @_;
|
||||
my $retval;
|
||||
$tests++;
|
||||
chomp $res;
|
||||
if ($res =~ /^200/) {
|
||||
$res =~ /result=(-?\d+)/;
|
||||
if (!length($1)) {
|
||||
print STDERR "FAIL ($res)\n";
|
||||
$fail++;
|
||||
} else {
|
||||
print STDERR "PASS ($1)\n";
|
||||
$pass++;
|
||||
}
|
||||
} else {
|
||||
print STDERR "FAIL (unexpected result '$res')\n";
|
||||
$fail++;
|
||||
}
|
||||
}
|
||||
|
||||
system("fhem-speech -d $ARGV[1] -a -q -o gsm -c $sounds") if ($ARGV[0] eq "d");
|
||||
system("fhem-speech -t $ARGV[1] -a -q -o gsm -c $sounds") if ($ARGV[0] eq "t");
|
||||
system("fhem-speech -d $ARGV[1] --set $ARGV[2]") if ($ARGV[0] eq "s");
|
||||
|
@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [ $# = 0 ]; then
|
||||
echo "Usage: `basename $0` -f [filename]"
|
||||
echo " `basename $0` -s \"Text\""
|
||||
exit 1;
|
||||
elif [ $1 = -f ]; then
|
||||
/usr/share/txt2pho/txt2pho -i $2 -f | /usr/bin/mbrola /usr/share/mbrola/de7/de7 - - \
|
||||
| /usr/bin/bplay -s 22050 -b 16 -q
|
||||
elif [ $1 = -s ]; then
|
||||
echo $2 | /usr/share/txt2pho/txt2pho -f | /usr/bin/mbrola /usr/share/mbrola/de7/de7 - - \
|
||||
| /usr/bin/bplay -s 22050 -b 16 -q
|
||||
fi
|
Loading…
Reference in New Issue
Block a user