Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
domotikad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
domotika
domotikad
Commits
2313ce68
Commit
2313ce68
authored
8 years ago
by
nextime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add force action to speech commands
parent
43d8a02d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
a03-speech_forceact.sql
Databases/createdb/a03-speech_forceact.sql
+1
-0
domotika.py
domotika/domotika.py
+7
-3
words.py
domotika/voiceui/filters/words.py
+5
-1
No files found.
Databases/createdb/a03-speech_forceact.sql
0 → 100644
View file @
2313ce68
ALTER
TABLE
`speech_actions`
ADD
`ikap_force_act`
INT
UNSIGNED
NOT
NULL
DEFAULT
'0'
AFTER
`ikap_arg`
,
ADD
INDEX
(
`ikap_force_act`
)
;
This diff is collapsed.
Click to expand it.
domotika/domotika.py
View file @
2313ce68
...
@@ -1860,7 +1860,7 @@ class domotikaService(service.Service):
...
@@ -1860,7 +1860,7 @@ class domotikaService(service.Service):
return
'NOACT'
return
'NOACT'
def
manageSpeechActions
(
self
,
results
,
speechres
=
{
"action"
:
False
}):
def
manageSpeechActions
(
self
,
results
,
speechres
=
{
"action"
:
False
}):
if
len
(
results
)
>
0
and
speechres
[
"action"
]:
if
len
(
results
)
>
0
:
for
res
in
results
:
for
res
in
results
:
log
.
info
(
"SPEECH ACTION ID: "
+
str
(
res
.
id
)
+
" NAME: "
+
str
(
res
.
speechaction_name
))
log
.
info
(
"SPEECH ACTION ID: "
+
str
(
res
.
id
)
+
" NAME: "
+
str
(
res
.
speechaction_name
))
if
genutils
.
isTrue
(
res
.
active
):
if
genutils
.
isTrue
(
res
.
active
):
...
@@ -1881,7 +1881,9 @@ class domotikaService(service.Service):
...
@@ -1881,7 +1881,9 @@ class domotikaService(service.Service):
continue
continue
res
.
lastrun
=
time
.
time
()
res
.
lastrun
=
time
.
time
()
res
.
save
()
res
.
save
()
if
genutils
.
isTrue
(
res
.
ikapacket
):
if
res
.
ikap_force_action
>
0
:
speechres
[
"action"
]
=
res
.
force_action
if
genutils
.
isTrue
(
res
.
ikapacket
)
and
speechres
[
"action"
]:
# XXX Manca gestione local only e ipdest!
# XXX Manca gestione local only e ipdest!
# XXX Gestire gli arg! (e lo use arg! per il received)
# XXX Gestire gli arg! (e lo use arg! per il received)
self
.
sendCommand
(
res
.
ikap_dst
,
act
=
int
(
speechres
[
"action"
]),
ctx
=
res
.
ikap_ctx
,
msgtype
=
res
.
ikap_msgtype
,
self
.
sendCommand
(
res
.
ikap_dst
,
act
=
int
(
speechres
[
"action"
]),
ctx
=
res
.
ikap_ctx
,
msgtype
=
res
.
ikap_msgtype
,
...
@@ -2190,7 +2192,7 @@ class domotikaService(service.Service):
...
@@ -2190,7 +2192,7 @@ class domotikaService(service.Service):
def
voiceRecognized
(
self
,
txt
,
confidence
=
0.0
,
lang
=
"it"
,
voicesrc
=
'VoIP'
):
def
voiceRecognized
(
self
,
txt
,
confidence
=
0.0
,
lang
=
"it"
,
voicesrc
=
'VoIP'
):
log
.
debug
(
"voiceRecognized: ["
+
txt
+
"] confidence: "
+
str
(
confidence
)
+
" lang: "
+
lang
+
" src: "
+
voicesrc
)
log
.
info
(
"voiceRecognized: ["
+
txt
+
"] confidence: "
+
str
(
confidence
)
+
" lang: "
+
lang
+
" src: "
+
voicesrc
)
def
speechactres
(
res
,
v
):
def
speechactres
(
res
,
v
):
if
len
(
res
)
>
0
:
if
len
(
res
)
>
0
:
...
@@ -2200,7 +2202,9 @@ class domotikaService(service.Service):
...
@@ -2200,7 +2202,9 @@ class domotikaService(service.Service):
else
:
else
:
useoutput
=
genutils
.
isTrue
(
self
.
config
.
get
(
'voiceui'
,
'useoutput'
))
useoutput
=
genutils
.
isTrue
(
self
.
config
.
get
(
'voiceui'
,
'useoutput'
))
if
useoutput
:
if
useoutput
:
log
.
info
(
"Speech using output"
)
return
(
'OUTPUT'
,
False
)
return
(
'OUTPUT'
,
False
)
log
.
info
(
"Speech output disabled"
)
return
(
'NOACT'
,
False
)
return
(
'NOACT'
,
False
)
def
actionres
(
ares
,
vres
):
def
actionres
(
ares
,
vres
):
...
...
This diff is collapsed.
Click to expand it.
domotika/voiceui/filters/words.py
View file @
2313ce68
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
from
dmlib
import
constants
as
c
from
dmlib
import
constants
as
c
IT_REMOVE
=
[
IT_REMOVE
=
[
"il"
,
"la"
,
"per"
,
"favore"
,
"mi"
,
"le"
,
"tiri"
,
"del"
,
"della"
,
"dell"
,
"dei"
,
"di"
,
"delle"
,
"degli"
,
"d"
,
"de"
"il"
,
"la"
,
"per"
,
"favore"
,
"mi"
,
"le"
,
"tiri"
,
"del"
,
"della"
,
"dell"
,
"dei"
,
"di"
,
"delle"
,
"degli"
,
"d"
,
"de"
,
"i"
,
"lo"
]
]
IT_ACTIONS
=
{
IT_ACTIONS
=
{
...
@@ -34,10 +34,14 @@ IT_ACTIONS={
...
@@ -34,10 +34,14 @@ IT_ACTIONS={
"aprire"
:
c
.
IKAP_ACT_OPEN
,
"aprire"
:
c
.
IKAP_ACT_OPEN
,
"apre"
:
c
.
IKAP_ACT_OPEN
,
"apre"
:
c
.
IKAP_ACT_OPEN
,
"aprimi"
:
c
.
IKAP_ACT_OPEN
,
"aprimi"
:
c
.
IKAP_ACT_OPEN
,
"aprimi"
:
c
.
IKAP_ACT_OPEN
,
"chiudi"
:
c
.
IKAP_ACT_CLOSE
,
"chiudi"
:
c
.
IKAP_ACT_CLOSE
,
"chiudere"
:
c
.
IKAP_ACT_CLOSE
,
"chiudere"
:
c
.
IKAP_ACT_CLOSE
,
"chiude"
:
c
.
IKAP_ACT_CLOSE
,
"chiude"
:
c
.
IKAP_ACT_CLOSE
,
"chiudimi"
:
c
.
IKAP_ACT_CLOSE
,
"chiudimi"
:
c
.
IKAP_ACT_CLOSE
,
"cambia"
:
c
.
IKAP_ACT_CHANGE
,
"inverti"
:
c
.
IKAP_ACT_CHANGE
,
"muovi"
:
c
.
IKAP_ACT_CHANGE
,
"alza"
:
c
.
IKAP_ACT_UP
,
"alza"
:
c
.
IKAP_ACT_UP
,
"alzare"
:
c
.
IKAP_ACT_UP
,
"alzare"
:
c
.
IKAP_ACT_UP
,
"alzami"
:
c
.
IKAP_ACT_UP
,
"alzami"
:
c
.
IKAP_ACT_UP
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment